]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r347249:
hselasky [Thu, 16 May 2019 17:12:38 +0000 (17:12 +0000)]
MFC r347249:
Correctly define the interface state bits in mlx5en(4).

While at it remove unused interface state bits. This also fixes and issue
during shutdown:

There is an issue where the firmware fails during mlx5_load_one,
the health_care timer detects the issue and schedules a health_care call.
Then the mlx5_load_one detects the issue, cleans up and quits. Then
the health_care starts and calls mlx5_unload_one to clean up the resources
that no longer exist and causes kernel panic.

The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set
after mlx5_load_one fails. The solution is removing the bit
MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the
bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN
is redundant and we can use MLX5_INTERFACE_STATE_UP instead.

Linux commit:
10a8d00707082955b177164d4b4e758ffcbd4017
b3cb5388499c5e219324bfe7da2e46cbad82bfcf

Sponsored by: Mellanox Technologies

5 years agoMFC r347248:
hselasky [Thu, 16 May 2019 17:11:45 +0000 (17:11 +0000)]
MFC r347248:
Enable FPGA and FPGA QP errors for EQ and call the handler in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347247:
hselasky [Thu, 16 May 2019 17:11:02 +0000 (17:11 +0000)]
MFC r347247:
Add MLX5_FPGA_RELOAD IOCTL(2) to mlx5fpga.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347246:
hselasky [Thu, 16 May 2019 17:09:06 +0000 (17:09 +0000)]
MFC r347246:
Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4).

Add support for DIM based on Linux,
with some minor adaptions specific to FreeBSD.

Linux commit
f97c3dc3c0e8d23a5c4357d182afeef4c67f5c33

Sponsored by: Mellanox Technologies

5 years agoMFC r347190:
hselasky [Thu, 16 May 2019 17:04:15 +0000 (17:04 +0000)]
MFC r347190:
Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347188:
hselasky [Thu, 16 May 2019 17:03:16 +0000 (17:03 +0000)]
MFC r347188:
Disabling a PCI device should only disable busmaster in the LinuxKPI.

As Linux comment for this function point:
Signal to the system that the PCI device is not in use by the system
anymore. This only involves disabling PCI bus-mastering, if active.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347187:
hselasky [Thu, 16 May 2019 17:02:31 +0000 (17:02 +0000)]
MFC r347187:
Implement print_hex_dump_debug() function macro in the LinuxKPI.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347185:
hselasky [Thu, 16 May 2019 17:01:39 +0000 (17:01 +0000)]
MFC r347185:
Allow controlling pr_debug at runtime in the LinuxKPI.

Turning on pr_debug at compile time make it non-optional at runtime.
This often means that the amount of the debugging is unbearable.
Allow developer to turn on pr_debug output only when needed.

Build tested drm-current-kmod prior to commit.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r346968, r346973
ian [Thu, 16 May 2019 15:32:03 +0000 (15:32 +0000)]
MFC r346968, r346973

r346968:
Update the manpage text to show the output generated by the first-stage
bootloader these days (x86 instead of i386).

r346973:
Add a paragraph that mentions gptboot having an interactive mode, and
direct the user to the boot(8) manpage, which provides the details on that.

5 years agoMFC r347368:
kib [Thu, 16 May 2019 14:48:08 +0000 (14:48 +0000)]
MFC r347368:
x86: Put other CPUs into tight loop when updating Intel microcode from
loaded OS.

5 years agoMFC r343985, r344133, r345273 (by bde):
kib [Thu, 16 May 2019 14:46:21 +0000 (14:46 +0000)]
MFC r343985, r344133, r345273 (by bde):
Prevent overflow for usertime/systime in caclru1().

PR: 76972

5 years agoMFC r337715, r337751, r337754, r337758, r337813, r338354, r338687,
markj [Thu, 16 May 2019 14:42:16 +0000 (14:42 +0000)]
MFC r337715, r337751, r337754, r337758, r337813, r338354, r338687,
    r339124, r341821:
Add support for boot-time Intel microcode loading.

5 years agoMFC r346402:
tuexen [Thu, 16 May 2019 11:20:02 +0000 (11:20 +0000)]
MFC r346402:

When a checksum has to be computed for a received IPv6 packet because it
is requested by the application using the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM on a raw socket, ensure that the packet contains enough
bytes to contain the checksum at the specified offset.

5 years agoMFC r346401:
tuexen [Thu, 16 May 2019 11:18:50 +0000 (11:18 +0000)]
MFC r346401:

Avoid a buffer overwrite in rip6_output() when computing the checksum
as requested by the user via the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM. The check if there are enough bytes in the packet to
store the checksum at the requested offset was wrong by 1.

5 years agoMFC r346400:
tuexen [Thu, 16 May 2019 11:14:08 +0000 (11:14 +0000)]
MFC r346400:

Improve input validation for the socket option IPV6_CHECKSUM.

When using the IPPROTO_IPV6 level socket option IPV6_CHECKSUM on a raw
IPv6 socket, ensure that the value is either -1 or a non-negative even
number.

5 years agoMFC r346182:
tuexen [Thu, 16 May 2019 11:09:53 +0000 (11:09 +0000)]
MFC r346182:

When sending IPv4 packets on a SOCK_RAW socket using the IP_HDRINCL option,
ensure that the ip_hl field is valid. Furthermore, ensure that the complete
IPv4 header is contained in the first mbuf. Finally, move the length checks
before relying on them when accessing fields of the IPv4 header.

5 years agoMFC r347016:
dchagin [Thu, 16 May 2019 10:43:52 +0000 (10:43 +0000)]
MFC r347016:

Remove unneeded includes.

5 years agoMFC r346134:
tuexen [Thu, 16 May 2019 09:33:38 +0000 (09:33 +0000)]
MFC r346134:

Fix an SCTP related locking issue. Don't report that the TCB_SEND_LOCK
is owned, when it is not.

This issue was found by running syzkaller.

5 years agoMFC r345525:
tuexen [Thu, 16 May 2019 09:32:00 +0000 (09:32 +0000)]
MFC r345525:

Fix a double free of an SCTP association in an error path.
This is joint work with rrs@. The issue was found by running
syzkaller.

5 years agoMFC r345505:
tuexen [Thu, 16 May 2019 09:29:49 +0000 (09:29 +0000)]
MFC r345505:

Initialize scheduler specific data for the FCFS scheduler.
This is joint work with rrs@. The issue was reported by using
syzkaller.

5 years agoMFC r345504:
tuexen [Thu, 16 May 2019 09:28:34 +0000 (09:28 +0000)]
MFC r345504:

Improve locking when tearing down an SCTP association.
This is joint work with rrs@ and the issue was found by
syzkaller.

5 years agoMFC r345494:
tuexen [Thu, 16 May 2019 09:27:13 +0000 (09:27 +0000)]
MFC r345494:

Fix the handling of fragmented unordered messages when using DATA chunks
and FORWARD-TSN.

This bug was reported in https://github.com/sctplab/usrsctp/issues/286
for the userland stack.

This is joint work with rrs@.

5 years agoMFC r345467:
tuexen [Thu, 16 May 2019 09:25:49 +0000 (09:25 +0000)]
MFC r345467:

Fix build issue for the userland stack.
Joint work with rrs@.

5 years agoMFC r345466:
tuexen [Thu, 16 May 2019 09:24:11 +0000 (09:24 +0000)]
MFC r345466:

Fix more signed unsigned issues. This time on the send path.
This is joint work with rrs@ and was found by running syzkaller.

5 years agoMFC r345465:
tuexen [Thu, 16 May 2019 09:22:37 +0000 (09:22 +0000)]
MFC r345465:

Fix a signed/unsigned bug when receiving SCTP messages.
This is joint work with rrs@.

5 years agoMFC r345461:
tuexen [Thu, 16 May 2019 09:20:54 +0000 (09:20 +0000)]
MFC r345461:

Limit the size of messages sent on 1-to-many style SCTP sockets with the
SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint.

This fixes an issue found by running syzkaller and is joint work with rrs@.

5 years agoMFC r345460:
tuexen [Thu, 16 May 2019 09:18:59 +0000 (09:18 +0000)]
MFC r345460:

Limit the number of bytes which can be queued for SCTP sockets.
This is joint work with rrs@.

5 years agoMFC r344925:
tuexen [Thu, 16 May 2019 09:16:47 +0000 (09:16 +0000)]
MFC r344925:

Fix locking bug.

5 years agoMFC r344924:
tuexen [Thu, 16 May 2019 09:15:18 +0000 (09:15 +0000)]
MFC r344924:

Some cleanup and consistency improvements.

5 years agoMFC r344872:
tuexen [Thu, 16 May 2019 09:13:41 +0000 (09:13 +0000)]
MFC r344872:

After removing an entry from the stream scheduler list, set the pointers
to NULL, since we are checking for it in case the element gets inserted
again.

This issue was found by running syzkaller.

5 years agoMFC r344742:
tuexen [Thu, 16 May 2019 09:12:13 +0000 (09:12 +0000)]
MFC r344742:

Allocate an assocition id and register the stcb with holding the lock.
This avoids a race where stcbs can be found, which are not completely
initialized.

This was found by running syzkaller.

5 years agoMFC r344726:
tuexen [Thu, 16 May 2019 09:10:14 +0000 (09:10 +0000)]
MFC r344726:

Remove debug output.

5 years agoMFC r344724:
tuexen [Thu, 16 May 2019 09:07:11 +0000 (09:07 +0000)]
MFC r344724:

Allow SCTP stream reconfiguration operations only in ESTABLISHED
state.

This issue was found by running syzkaller.

5 years agoMFC r344723:
tuexen [Thu, 16 May 2019 09:05:15 +0000 (09:05 +0000)]
MFC r344723:

Handle the case when calling the IPPROTO_SCTP level socket option
SCTP_STATUS on an association with no primary path (early state).

This issue was found by running syzkaller.

5 years agoMFC r344722:
tuexen [Thu, 16 May 2019 09:03:48 +0000 (09:03 +0000)]
MFC r344722:

Use correct buffer sizes in sctp_get[lp]addrs().

5 years agoMFC r344721:
tuexen [Thu, 16 May 2019 09:02:30 +0000 (09:02 +0000)]
MFC r344721:

Report the correct length when using the IPPROTO_SCTP level
socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES.

5 years agoMFC r344708:
tuexen [Thu, 16 May 2019 08:57:08 +0000 (08:57 +0000)]
MFC r344708:

Honor the memory limits provided when processing the IPPROTO_SCTP
level socket option SCTP_GET_LOCAL_ADDRESSES in a getsockopt() call.

Thanks to Thomas Barabosch for reporting the issue which was found by
running syzkaller.

5 years agoMFC r344704:
tuexen [Thu, 16 May 2019 08:53:55 +0000 (08:53 +0000)]
MFC r344704:

mprove consistency, not functional change.

5 years agoMFC r344048:
tuexen [Thu, 16 May 2019 08:50:25 +0000 (08:50 +0000)]
MFC r344048:

Improve input validation for raw IPv4 socket using the IP_HDRINCL
option.

This issue was found by running syzkaller on OpenBSD.
Greg Steuck made me aware that the problem might also exist on FreeBSD.

5 years agoMFC r343961:
tuexen [Thu, 16 May 2019 08:47:28 +0000 (08:47 +0000)]
MFC r343961:

Fix a locking issue when reporing outbount messages.

5 years agoMFC r343960:
tuexen [Thu, 16 May 2019 08:45:54 +0000 (08:45 +0000)]
MFC r343960:

Fix a locking issue in the IPPROTO_SCTP level SCTP_PEER_ADDR_THLDS socket
option. The problem affects only setsockopt with invalid parameters.

This issue was found by syzkaller.

5 years agoMFC r343954:
tuexen [Thu, 16 May 2019 08:44:12 +0000 (08:44 +0000)]
MFC r343954:

Fix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option.
This occurs when call setsockopt() with invalid parameters.

This issue was found by syzkaller.

5 years agoMFC r343951:
tuexen [Thu, 16 May 2019 08:42:20 +0000 (08:42 +0000)]
MFC r343951:

Fix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option.
This problem occurred when calling setsockopt() will invalid parameters.

This issue was found by running syzkaller.

5 years agoMFC r343770:
tuexen [Thu, 16 May 2019 08:40:10 +0000 (08:40 +0000)]
MFC r343770:

Only reduce the PMTU after the send call. The only way to increase it, is
via PMTUD.

This fixes an MTU issue reported by Timo Voelker.

5 years agoMFC r343769:
tuexen [Thu, 16 May 2019 08:38:20 +0000 (08:38 +0000)]
MFC r343769:

Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
socketoption.

This was found by running syzkaller.

5 years agoMFC r339221:
tuexen [Thu, 16 May 2019 08:26:44 +0000 (08:26 +0000)]
MFC r339221:

Avoid truncating unrecognised parameters when reporting them.
This resulted in sending malformed packets.

5 years agoMFC r339219:
tuexen [Thu, 16 May 2019 08:24:53 +0000 (08:24 +0000)]
MFC r339219:

Ensure that the ips_localout counter is incremented for
locally generated SCTP packets sent over IPv4. This make
the behaviour consistent with IPv6.

5 years agoMFC r339040:
tuexen [Thu, 16 May 2019 08:22:50 +0000 (08:22 +0000)]
MFC r339040:

After allocating chunks set the fields in a consistent way.
This removes two assignments for the flags field being done
twice and adds one, which was missing.
Thanks to Felix Weinrank for reporting the issue he found
by using fuzz testing of the userland stack.

5 years agoMFC r339028:
tuexen [Thu, 16 May 2019 08:21:01 +0000 (08:21 +0000)]
MFC r339028:

Plug mbuf leak in the SCTP input path in an error case.

5 years agoMFC r339027:
tuexen [Thu, 16 May 2019 08:19:23 +0000 (08:19 +0000)]
MFC r339027:

Plug mbuf leaks in the SCTP output path in error cases.

5 years agoMFC r339024:
tuexen [Thu, 16 May 2019 08:17:32 +0000 (08:17 +0000)]
MFC r339024:

Fix the handling of ancillary data for SCTP socket. Implement
sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs()
similar to sctp_find_cmsg() to improve consistency and avoid
the signed/unsigned issues in sctp_process_cmsgs_for_init()
and sctp_findassociation_cmsgs().

Thanks to andrew@ for reporting the problem he found using
syzcaller.

5 years agoMFC r339022:
tuexen [Thu, 16 May 2019 08:15:54 +0000 (08:15 +0000)]
MFC r339022:
Increment the corresponding UDP stats counter (udps_opackets) when
sending UDP encapsulated SCTP packets.
This is consistent with the behaviour that when such packets are received,
the corresponding UDP stats counter (udps_ipackets) is incremented.
Thanks to Peter Lei for making me aware of this inconsistency.

5 years agoMFC r347032 (except for the part about d_off):
asomers [Thu, 16 May 2019 03:30:36 +0000 (03:30 +0000)]
MFC r347032 (except for the part about d_off):

directory.3: add a STANDARDS section

Reviewed by: jilles, ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20111

5 years agoMFC r346847:
asomers [Thu, 16 May 2019 03:24:08 +0000 (03:24 +0000)]
MFC r346847:

fsx: seed more randomly with the -S0 option

When using -S0, seed the PRNG with the current time in nanoseconds, not
seconds, so consecutive runs don't accidentally use the same seed.

Also, rename some variables for clarity.

Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20078

5 years agoMFC r345550:
gonzo [Thu, 16 May 2019 00:53:54 +0000 (00:53 +0000)]
MFC r345550:

Change default value of kern.bootfile to reflect reality

In most cases kernel.bootfile is populated from the information
provided by loader(8). There are certain scenarios when loader
is not available, for instance when kernel is loaded by u-boot
or some other BootROM directly. In this case the default value
"/kernel" points to invalid location and breaks some functinality,
like using installkernel on self-hosted system or dtrace's CTF
lookup. This can be fixed by setting the value manually but the
default that reflects correct location is better than default that
points to invalid one.

Current default was set around FreeBSD 1, when "/kernel" was the
actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3.

PR: 221550
Reviewed by: ian, imp
Differential Revision: https://reviews.freebsd.org/D18902

5 years agoMFC r346647:
gonzo [Thu, 16 May 2019 00:51:30 +0000 (00:51 +0000)]
MFC r346647:

[acpi_ibm] Add support for newer Thinkpad models

Add support for newer Thinkpad models with id LEN0268. Was tested on
Thinkpad T480 and ThinkPad X1 Yoga 2nd gen.

PR: 229120
Submitted by: Ali Abdallah <aliovx@gmail.com>

5 years agoMFC r347422:
ian [Wed, 15 May 2019 17:58:08 +0000 (17:58 +0000)]
MFC r347422:

Allow dcons(4) to be unloaded when loaded as a module.

When the module is unloaded, the tty devices are destroyed.  That requires
implementing the tsw_free callback to avoid a panic.  This driver requires
no particular cleanup to be done from the callback, but the module itself
must remain in memory until the deferred tsw_free callbacks are invoked.
These changes implement that by incrementing a reference count variable in
the detach routine, and decrementing it in the tsw_free callback.  The
MOD_UNLOAD event handler doesn't return until the count drops to zero.

PR: 237758

5 years agoMFC r339046, r339073:
markj [Wed, 15 May 2019 15:49:29 +0000 (15:49 +0000)]
MFC r339046, r339073:
Count bootstrap data as resident in the kernel pmap.

5 years agoDocument EN-19:08 through EN-19:10, SA-19:03 through SA-19:07.
gjb [Wed, 15 May 2019 15:03:55 +0000 (15:03 +0000)]
Document EN-19:08 through EN-19:10, SA-19:03 through SA-19:07.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r337738:
tuexen [Wed, 15 May 2019 08:39:16 +0000 (08:39 +0000)]
MFC r337738:
Use a macro to set the assoc state.

5 years agoMFC r320009,r347075:
ngie [Wed, 15 May 2019 07:51:30 +0000 (07:51 +0000)]
MFC r320009,r347075:

r320009 (by sbruno):

Quiesce clang warning while building lpc.

usr.sbin/lpr/lpc/lpc.c
  Warning
    passing 'char *[20]' to parameter of type 'const char **' discards
    qualifiers in nested pointer types
    [-Wincompatible-pointer-types-discards-qualifiers]
  Fix:
     Explicitly cast the variable "margv" to const char ** only for it's
     use as a parameter to suppress the error

r347075:

Fix `clang -Wcast-qual` issues

Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and
deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb`
variable.

This unblocks ^/projects/runtime-coverage-v2 from building cleanly on
universe13a.freebsd.org. I suspect the issue was introduced through some
changes to `bsd.*.mk` inclusion on the branch, which I will continue to
investigate/isolate.

Tested with: clang 8 (arm64)

5 years agoMFC r347240: Fix dataset name comparison in zfs_compare().
mav [Wed, 15 May 2019 01:40:40 +0000 (01:40 +0000)]
MFC r347240: Fix dataset name comparison in zfs_compare().

The code never returned match comparing two datasets (not snapshots).
As result, uu_avl_find(), called from zfs_callback(), never succeeded,
allowing to add same dataset into the list multiple times, for example:

        # zfs get name pers pers pers@z pers@z
        NAME    PROPERTY  VALUE   SOURCE
        pers    name      pers    -
        pers    name      pers    -
        pers@z  name      pers@z  -

With the patch:

        # zfs get name pers pers pers@z pers@z
        NAME    PROPERTY  VALUE   SOURCE
        pers    name      pers    -
        pers@z  name      pers@z  -

5 years agoMFC r347566:
kib [Tue, 14 May 2019 17:05:02 +0000 (17:05 +0000)]
MFC r347566:
Mitigations for Microarchitectural Data Sampling.

Reference: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html
Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
Security: FreeBSD-SA-19:07.mds
Reviewed by: jhb
Tested by: emaste, lwhsu
Approved by: so (gtetlow)

5 years agoMFC r344085:
obrien [Tue, 14 May 2019 04:14:31 +0000 (04:14 +0000)]
MFC r344085:
Note that readpassphrase() came into FreeBSD's libc at 4.6.

5 years agoMFC r346028:
ganbold [Tue, 14 May 2019 03:05:06 +0000 (03:05 +0000)]
MFC r346028:
Fix URE_WDT6_SET_MODE value in the register definition.
Both linux and u-boot sources for RTL8152 driver has this value.
RTL8152 USB ethernet is used in NanoPI R1 board as second ethernet.
This fixes RTL8152 USB ethernet not detected problem after
reboot.

5 years agoMFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping
kevans [Tue, 14 May 2019 02:00:12 +0000 (02:00 +0000)]
MFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping

MFC r347241 (partial): Initial mechanism for mapping ifname <-> kld

if_tun/if_tap mappings have been removed and the vmnet mapping has been
updated to the if_tap module.

MFC r347392: ifconfig(8): Partial revert of r347241

r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.

MFC r347429: ifconfig(8): Add kld mappings for ipsec/enc

Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

5 years agoMFC r347160: Decode some more ATA commands found in ACS-4.
mav [Mon, 13 May 2019 13:30:34 +0000 (13:30 +0000)]
MFC r347160: Decode some more ATA commands found in ACS-4.

5 years agoMFC r346965:
dchagin [Mon, 13 May 2019 11:17:31 +0000 (11:17 +0000)]
MFC r346965:

Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.
It was first introduced in r163734 and missied by me in r283383.

5 years agoMFC r346885:
ae [Mon, 13 May 2019 08:27:52 +0000 (08:27 +0000)]
MFC r346885:
  Handle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6
  opcodes when it is needed.
  This should fix the problem, when printed by `ipfw show` rule can not
  be added due to missing "proto" keyword.

5 years agoMFC r346073:
avos [Sun, 12 May 2019 12:30:45 +0000 (12:30 +0000)]
MFC r346073:
urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8)

Was tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode.

5 years agoMFC r347150, r347180:
kib [Sun, 12 May 2019 07:55:25 +0000 (07:55 +0000)]
MFC r347150, r347180:
Do not collapse objects with OBJ_NOSPLIT backing swap or default object.

5 years agoMFC r347243:
dim [Sat, 11 May 2019 09:56:59 +0000 (09:56 +0000)]
MFC r347243:

Pull in r360099 from upstream llvm trunk (by Eli Friedman):

  [ARM] Glue register copies to tail calls.

  This generally follows what other targets do. I don't completely
  understand why the special case for tail calls existed in the first
  place; even when the code was committed in r105413, call lowering
  didn't work in the way described in the comments.

  Stack protector lowering breaks if the register copies are not glued
  to a tail call: we have to insert the stack protector check before
  the tail call, and we choose the location based on the assumption
  that all physical register dependencies of a tail call are adjacent
  to the tail call. (See FindSplitPointForStackProtector.) This is sort
  of fragile, but I don't see any reason to break that assumption.

  I'm guessing nobody has seen this before just because it's hard to
  convince the scheduler to actually schedule the code in a way that
  breaks; even without the glue, the only computation that could
  actually be scheduled after the register copies is the computation of
  the call address, and the scheduler usually prefers to schedule that
  before the copies anyway.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41417

  Differential Revision: https://reviews.llvm.org/D60427

This should fix several instances of "Bad machine code: Using an
undefined physical register", when compiling ports such as
multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with
-fstack-protector-strong.

Reported by: jbeich
PR: 237074, 237783, 237784

5 years agoMFC r345986:
asomers [Sat, 11 May 2019 03:41:58 +0000 (03:41 +0000)]
MFC r345986:

fusefs: fix a panic on mount

Don't page fault if the file descriptor provided with "-o fd" is invalid.
This is a merge of r345419 from the projects/fuse2 branch.

Reviewed by: ngie
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19836

5 years agoMFC r346750:
asomers [Sat, 11 May 2019 03:39:34 +0000 (03:39 +0000)]
MFC r346750:

[skip ci] fix typo in comment from r59840

Sponsored by: The FreeBSD Foundation

5 years agoMFC r346078:
asomers [Sat, 11 May 2019 03:38:50 +0000 (03:38 +0000)]
MFC r346078:

fix cache_lookup's documentation

cache_lookup's documentation got dislocated by r324378. Relocate and expand
it.

Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345677:
asomers [Sat, 11 May 2019 03:37:43 +0000 (03:37 +0000)]
MFC r345677:

Add man page for VOP_FDATASYNC(9)

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19678

5 years agoMFC r345202:
asomers [Sat, 11 May 2019 03:35:13 +0000 (03:35 +0000)]
MFC r345202:

VOP_INACTIVE(9): clarify wording

Reviewed by: kib, 0mp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19596

5 years agoMFC of 347064, 347066, and 347130
mckusick [Fri, 10 May 2019 23:46:42 +0000 (23:46 +0000)]
MFC of 347064, 347066, and 347130

Avoid leaking kernel stack when creating directory names.

5 years agoComplete the MFC of 345963 after the MFC of 333174.
jhb [Fri, 10 May 2019 16:51:36 +0000 (16:51 +0000)]
Complete the MFC of 345963 after the MFC of 333174.

Suggested by: kib

5 years agoMFC 342944: Fix spelling of identifier
jhb [Fri, 10 May 2019 16:38:48 +0000 (16:38 +0000)]
MFC 342944: Fix spelling of identifier

5 years agoMFC 340707:
jhb [Fri, 10 May 2019 16:36:38 +0000 (16:36 +0000)]
MFC 340707:
Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES
to avoid buffer accessed out of bounds, also switch to snprintf(3).

PR: 200859

5 years agoMFC 338957:
jhb [Fri, 10 May 2019 16:32:44 +0000 (16:32 +0000)]
MFC 338957:
Handle a guest executing a vm instruction by trapping and raising an
undefined instruction exception. Previously we would exit the guest,
however an unprivileged user could execute these.

5 years agoMFC r347234:
cy [Fri, 10 May 2019 01:02:07 +0000 (01:02 +0000)]
MFC r347234:

Improve the legibility of the login.access.5 man page by separating
each argument into its own paragraph.

5 years agoix(4): Move {mod,msf,mbx,fdir,phy,link}_task to lock protected handler
erj [Fri, 10 May 2019 00:46:43 +0000 (00:46 +0000)]
ix(4): Move {mod,msf,mbx,fdir,phy,link}_task to lock protected handler

This patch introduces adapter->task_requests register responsible for recording
requests for mod_task, msf_task, mbx_task, fdir_task, phy_task and link_task
calls. Instead of enqueueing each of these tasks with GROUPTASK_ENQUEUE, new
task is created and all handlers are called from one task while holding
adapter->core_mtx lock.

SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is deleted and
rewritten in ixgbe_handle_msf() task without holding adapter->core_mtx lock.
This change is needed to maintain data coherency when sharing adapter info via
ioctl() calls.

Since handlers for abovementioned tasks will no longer act as task handlers,
but as regular functions, 'pending' parameter is removed from them.

This patch also removes ixgbe_update_link_status() call from
ixgbe_handle_link() handler. From now on, link status will be updated by
calling ixgbe_update_link_status() periodically from ixgbe_local_timer(). This
fixes problem with link flapping during changing interface state to UP.

Parameter keep_traffic is added to ixgbe_disable_intr(). This enables
ixgbe_handle_admin_task() to not disable and queue interrupts.  Accordingly,
skip_traffic parameter is added to ixgbe_enable_intr() to let
ixgbe_handle_admin_task() skip enabling queues while enabling interrupts.

This patch is a port of r343621. r343621 can't be merged from current since
stable/11 contains ixgbe driver without iflib support.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>.

Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: #IntelNetworking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19711

5 years agoMFC 332479: Add SDT probes to vmexit on Intel.
jhb [Thu, 9 May 2019 23:57:02 +0000 (23:57 +0000)]
MFC 332479: Add SDT probes to vmexit on Intel.

5 years agoMFC 334272: bhyve: guarantee NUL termination
jhb [Thu, 9 May 2019 22:42:23 +0000 (22:42 +0000)]
MFC 334272: bhyve: guarantee NUL termination

Use strlcpy to guarantee NUL termination of the path to a
virtio console socket.

5 years agoMFC 334271: bhyve: fix small memory leak in virtio console
jhb [Thu, 9 May 2019 22:39:24 +0000 (22:39 +0000)]
MFC 334271: bhyve: fix small memory leak in virtio console

5 years agoMFC 333639:
jhb [Thu, 9 May 2019 22:31:47 +0000 (22:31 +0000)]
MFC 333639:
vmmdev: return EFAULT when trying to read beyond VM system memory max address

Currently, when using dd(1) to take a VM memory image, the capture never ends,
reading zeroes when it's beyond VM system memory max address.
Return EFAULT when trying to read beyond VM system memory max address.

5 years agoMFC 333235:
jhb [Thu, 9 May 2019 20:30:35 +0000 (20:30 +0000)]
MFC 333235:
Allow arbitrary numbers of columns for VNC server screen resolution.

The prior code only allowed multiples of 32 for the
numbers of columns. Remove this restriction to allow
a forthcoming UEFI firmware update to allow arbitrary
x,y resolutions.

(the code for handling rows already supported non mult-32 values)

5 years agoMFC r346578:
ngie [Thu, 9 May 2019 17:02:40 +0000 (17:02 +0000)]
MFC r346578:

Build libclang_rt/profile on all clang-supported architectures

There's no reason why a special case needs to be added specifically for amd64,
arm, and i386, as the code is written in machine architecture agnostic C/C++.

This will make it possible for all supporting clang architectures to produce
runtime coverage with `--coverage`.

5 years agoMFC r347198: Drop periph lock around cam_periph_unmapmem().
mav [Thu, 9 May 2019 04:16:31 +0000 (04:16 +0000)]
MFC r347198: Drop periph lock around cam_periph_unmapmem().

Since r345656 it may call copyout(), that may sleep.

5 years agoMFC r346602, r346670-r346671, r347183: tun/tap race fixes
kevans [Thu, 9 May 2019 03:51:34 +0000 (03:51 +0000)]
MFC r346602, r346670-r346671, r347183: tun/tap race fixes

r346602:
tun(4): Defer clearing TUN_OPEN until much later

tun destruction will not continue until TUN_OPEN is cleared. There are brief
moments in tunclose where the mutex is dropped and we've already cleared
TUN_OPEN, so tun_destroy would be able to proceed while we're in the middle
of cleaning up the tun still. tun_destroy should be blocked until these
parts (address/route purges, mostly) are complete.

r346670:
tun/tap: close race between destroy/ioctl handler

It seems that there should be a better way to handle this, but this seems to
be the more common approach and it should likely get replaced in all of the
places it happens... Basically, thread 1 is in the process of destroying the
tun/tap while thread 2 is executing one of the ioctls that requires the
tun/tap mutex and the mutex is destroyed before the ioctl handler can
acquire it.

This is only one of the races described/found in PR 233955.

r346671:
tun(4): Don't allow open of open or dying devices

Previously, a pid check was used to prevent open of the tun(4); this works,
but may not make the most sense as we don't prevent the owner process from
opening the tun device multiple times.

The potential race described near tun_pid should not be an issue: if a
tun(4) is to be handed off, its fd has to have been sent via control message
or some other mechanism that duplicates the fd to the receiving process so
that it may set the pid. Otherwise, the pid gets cleared when the original
process closes it and you have no effective handoff mechanism.

Close up another potential issue with handing a tun(4) off by not clobbering
state if the closer isn't the controller anymore. If we want some state to
be cleared, we should do that a little more surgically.

Additionally, nothing prevents a dying tun(4) from being "reopened" in the
middle of tun_destroy as soon as the mutex is unlocked, quickly leading to a
bad time. Return EBUSY if we're marked for destruction, as well, and the
consumer will need to deal with it. The associated character device will be
destroyed in short order.

r347183:
geom: fix initialization order

There's a race between the initialization of devsoftc.mtx (by devinit)
and the creation of the geom worker thread g_run_events, which calls
devctl_queue_data_f. Both of those are initialized at SI_SUB_DRIVERS
and SI_ORDER_FIRST, which means the geom worked thread can be created
before the mutex has been initialized, leading to the panic below:

 wpanic: mtx_lock() of spin mutex (null) @ /usr/home/osstest/build.135317.build-amd64-freebsd/freebsd/sys/kern/subr_bus.c:620
 cpuid = 3
 time = 1
 KDB: stack backtrace:
 db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe003b968710
 vpanic() at vpanic+0x19d/frame 0xfffffe003b968760
 panic() at panic+0x43/frame 0xfffffe003b9687c0
 __mtx_lock_flags() at __mtx_lock_flags+0x145/frame 0xfffffe003b968810
 devctl_queue_data_f() at devctl_queue_data_f+0x6a/frame 0xfffffe003b968840
 g_dev_taste() at g_dev_taste+0x463/frame 0xfffffe003b968a00
 g_load_class() at g_load_class+0x1bc/frame 0xfffffe003b968a30
 g_run_events() at g_run_events+0x197/frame 0xfffffe003b968a70
 fork_exit() at fork_exit+0x84/frame 0xfffffe003b968ab0
 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe003b968ab0
 --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
 KDB: enter: panic
 [ thread pid 13 tid 100029 ]
 Stopped at      kdb_enter+0x3b: movq    $0,kdb_why

Fix this by initializing geom at SI_ORDER_SECOND instead of
SI_ORDER_FIRST.

PR: 233955

5 years agoMFC r339121 (tuexen): Use strlcpy() instead of strncpy().
kevans [Thu, 9 May 2019 01:16:03 +0000 (01:16 +0000)]
MFC r339121 (tuexen): Use strlcpy() instead of strncpy().

CID: 13959801395981

5 years agoMFC 333174: Use PCI power-mgmt to reset a device if FLR fails.
jhb [Wed, 8 May 2019 23:24:47 +0000 (23:24 +0000)]
MFC 333174: Use PCI power-mgmt to reset a device if FLR fails.

A large number of devices don't support PCIe FLR, in particular
graphics adapters. Use PCI power management to perform the
reset if FLR fails or isn't available, by cycling the device
through the D3 state.

This has been tested by a number of users with Nvidia and AMD GPUs.

5 years agoiflib: Add missing return statement that was left out from r347197
erj [Wed, 8 May 2019 23:13:27 +0000 (23:13 +0000)]
iflib: Add missing return statement that was left out from r347197

5 years agoMFC r346960:
markj [Wed, 8 May 2019 16:07:43 +0000 (16:07 +0000)]
MFC r346960:
Retry upon NET_RT_IFLIST sysctl failure.

PR: 195191

5 years agoMFC r346990:
kib [Wed, 8 May 2019 16:07:01 +0000 (16:07 +0000)]
MFC r346990:
Fix another race between vm_map_protect() and vm_map_wire().

5 years agoMFC r347139:
cy [Wed, 8 May 2019 15:48:55 +0000 (15:48 +0000)]
MFC r347139:

MFV r347136: Update sqlite3-3.27.2 (3270200) --> sqlite3-3.28.0 (3280000)

Security: CVE-2019-9937, CVE-2019-9936

5 years agoMFC r346976: Respect quotes and escapes when splitting exports fields.
mav [Wed, 8 May 2019 15:25:27 +0000 (15:25 +0000)]
MFC r346976: Respect quotes and escapes when splitting exports fields.

Without this r293305 was still unable to handle names with spaces.

5 years agoMFC r346898: ip multicast debug: fix strings vs defines
mav [Wed, 8 May 2019 15:24:05 +0000 (15:24 +0000)]
MFC r346898: ip multicast debug: fix strings vs defines

Turning on multicast debug made multicast failure worse
because the strings and #define values no longer matched
up.  Fix them, and make sure they stay matched-up.