]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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.

5 years agoMFC r346491: Polish SCSI sense data validity checks.
mav [Wed, 8 May 2019 15:17:45 +0000 (15:17 +0000)]
MFC r346491: Polish SCSI sense data validity checks.

According to specs and common sense, all sense data reported in descriptor
format should be valid.  But practice shows different, some devices return
descriptors with invalid data, resulting in error messages looking worse.

Decouple block/stream commands sense data and information field printing.
Looking on present specs, there are much more cases when those fields are
not related, and incomplete old code was not printing valid sense data and
leaving empty lines for invalid.

5 years agoMFC r346884:
ae [Wed, 8 May 2019 15:17:16 +0000 (15:17 +0000)]
MFC r346884:
  Add IPv6 support for O_IPLEN opcode.

  Obtained from: Yandex LLC

5 years agoMFC r347056:
gjb [Wed, 8 May 2019 15:16:45 +0000 (15:16 +0000)]
MFC r347056:
 Increase the default size of the GCE disk image from 3GB to 20GB,
 as 3GB is too small as discovered in last week's snapshot builds.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r345312: iflib: mark isc_driver_version as constant
erj [Mon, 6 May 2019 21:31:02 +0000 (21:31 +0000)]
MFC r345312: iflib: mark isc_driver_version as constant

(Additional comment by erj: This also adds a new sysctl_add_oid macro,
SYSCTL_ADD_CONST_STRING, for displaying const strings. This commit also
includes an edit to the sysctl.9 man page for it.)

Sponsored by: Intel Corporation

5 years agoMFC r345303, 345658, and partially MFC r345305
erj [Mon, 6 May 2019 21:21:15 +0000 (21:21 +0000)]
MFC r345303, 345658, and partially MFC r345305

These are:
r345303: prevent possible infinite loop in iflib_encap
r345305: expose the Rx mbuf buffer size to drivers
r345658: return ENETDOWN when the network device is down

r345305 is only partially MFC'd with no mergeinfo because it includes
changes to iflib-using drivers, and none of the drivers it changes use
iflib in stable/11. This commit just makes the function it adds available
for use with iflib-using kernel modules.

Sponsored by: Intel Corporation

5 years agoMFC r344817: Remove references to CONTIGMALLOC_WORKS in iflib and em
erj [Mon, 6 May 2019 20:48:27 +0000 (20:48 +0000)]
MFC r344817: Remove references to CONTIGMALLOC_WORKS in iflib and em

Sponsored by: Intel Corporation

5 years agoMFC r340435: Prevent POLA violation with TSO/CSUM offload
erj [Mon, 6 May 2019 20:41:56 +0000 (20:41 +0000)]
MFC r340435: Prevent POLA violation with TSO/CSUM offload

Sponsored by: Intel Corporation

5 years agoMFC of 346185
mckusick [Mon, 6 May 2019 19:15:59 +0000 (19:15 +0000)]
MFC of 346185

Properly calculate last block of large sparse files.

Sponsored by: Netflix

5 years agoMFC r332389, r3342331, r334343, and partially r339338
erj [Mon, 6 May 2019 18:50:08 +0000 (18:50 +0000)]
MFC r332389, r3342331, r334343, and partially r339338

This commit backports some new features from iflib in 12 back to stable/11:

r332389 - Split out flag manipulation from general context manipulation in iflib
r334231 - Add IFLIB_ADMIN_ALWAYS_RUN flag
r334343 - hold context lock across detach
r339338 - (Other updates to iflib that were included in this revision)

This commit doesn't include mergeinfo for r339338 since this only includes part
of it. I'm reminded of advice given to keep MFC-ability in mind when committing
large changes in the future.

Reviewed by: marius@ (change content)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19949

5 years agoMFC r347142:
tsoome [Mon, 6 May 2019 08:55:23 +0000 (08:55 +0000)]
MFC r347142:

loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR: 236585
Submitted by: john@feith.com
Reported by: john@feith.com

5 years agoMFC: r346856
rmacklem [Mon, 6 May 2019 03:13:22 +0000 (03:13 +0000)]
MFC: r346856
Add #ifdef INET6 around declaration of nbuf.

It was reported that without #ifdef INET6 around the declaration of "nbuf",
a build would report an unused variable. For some reason, I didn't see that
warning when I did a build, but it seems reasonable to add these #ifdef INET6's.

5 years agoMFC r347027-r347028: libbe(3) mountpoint handling fixes
kevans [Mon, 6 May 2019 02:10:04 +0000 (02:10 +0000)]
MFC r347027-r347028: libbe(3) mountpoint handling fixes

r347027:
libbe(3): Properly mount BEs with mountpoint=none

Instead of pretending to successfully mount them while not actually
mounting anything, we'll now actually mount them *and* claim we mounted them
successfully.

Reported by: ler

r347028:
libbe: set mountpoint=none in be_import

If we're going to set a mountpoint at all, mountpoint=none makes more sense
than mountpoint=/.

5 years agoMFC r337737:
tuexen [Sun, 5 May 2019 20:14:36 +0000 (20:14 +0000)]
MFC r337737:
Remove a set but not used warning showing up in usrsctp.

5 years agoMFC r337708:
tuexen [Sun, 5 May 2019 20:08:01 +0000 (20:08 +0000)]
MFC r337708:

Use the stcb instead of the asoc in state macros.
This is not a functional change. Just a preparation for upcoming
dtrace state change provider support.

5 years agoMFC r337706:
tuexen [Sun, 5 May 2019 19:39:32 +0000 (19:39 +0000)]
MFC r337706:
Use consistently the macors to modify the assoc state.
No functional change.

5 years agoMFC r337688:
tuexen [Sun, 5 May 2019 19:31:17 +0000 (19:31 +0000)]
MFC r337688:
Add explicit cast to silence a warning for the userland stack.

Thanks to Felix Weinrank for providing the patch.

5 years agoMFC r336937:
tuexen [Sun, 5 May 2019 19:20:27 +0000 (19:20 +0000)]
MFC r336937:
Send consistent SEG.WIN when using timewait codepath for TCP.

When sending TCP segments from the timewait code path, a stored
value of the last sent window is used. Use the same code for
computing this in the timewait code path as in the main code
path used in tcp_output() to avoid inconsistencies.

MFC r344148:
Fix a byte ordering issue for the advertised receiver window in ACK
segments sent in TIMEWAIT state, which I introduced in r336937.

5 years agoMFC r336932:
tuexen [Sun, 5 May 2019 14:14:05 +0000 (14:14 +0000)]
MFC r336932:
Add missing send/recv dtrace probes for TCP.

These missing probe are mostly in the syncache and timewait code.

Reviewed by: markj@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16369

5 years agoMFC r336574:
tuexen [Sun, 5 May 2019 12:34:32 +0000 (12:34 +0000)]
MFC r336574:
Set the IPv4 version in the IP header for UDP and UDPLite.

5 years agoMFC r336551:
tuexen [Sun, 5 May 2019 12:32:47 +0000 (12:32 +0000)]
MFC r336551:
Add missing dtrace probes for received UDP packets.

Fire UDP receive probes when a packet is received and there is no
endpoint consuming it. Fire the probe also if the TTL of the
received packet is smaller than the minimum required by the endpoint.

Clarify also in the man page, when the probe fires.

Reviewed by: dteske@, markj@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16046

5 years agoMFC r336511:
tuexen [Sun, 5 May 2019 12:28:39 +0000 (12:28 +0000)]
MFC r336511:
Whitespace changes due to changes in ident.

5 years agoMFC r335194:
tuexen [Sun, 5 May 2019 12:11:58 +0000 (12:11 +0000)]
MFC r335194:
When retransmitting TCP SYN-ACK segments with the TCP timestamp option
enabled use an updated timestamp instead of reusing the one used in
the initial TCP SYN-ACK segment.

This patch ensures that an updated timestamp is used when sending the
SYN-ACK from the syncache code. It was already done if the
SYN-ACK was retransmitted from the generic code.

This makes the behaviour consistent and also conformant with
the TCP specification.

Reviewed by: jtl@, Jason Eggleston
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D15634

5 years agoMFC r333981:
tuexen [Sun, 5 May 2019 11:35:38 +0000 (11:35 +0000)]
MFC r333981:
Only fillin data srucuture when actually stored.
Manually fixed a merge conflict.

5 years agoMFC r333980:
tuexen [Sun, 5 May 2019 11:05:36 +0000 (11:05 +0000)]
MFC r333980:
Do the appropriate accounting when ip_output() fails.
Manually remove a merge conflict.

5 years agoMFC r333979:
tuexen [Sun, 5 May 2019 10:57:27 +0000 (10:57 +0000)]
MFC r333979:
Make clear why there is an assignment, which is not necessary.
To resolve the merge conflict, this also contains the changes
from r333869.

5 years agoMFC r333604:
tuexen [Sun, 5 May 2019 10:42:32 +0000 (10:42 +0000)]
MFC r333604:
sctp_get_mbuf_for_msg() should honor the allinone parameter.

When it is not required that the buffer is not a chain, return
a chain. This is based on a patch provided by Irene Ruengeler.

5 years agoMFC r335179:
tuexen [Sun, 5 May 2019 08:08:15 +0000 (08:08 +0000)]
MFC r335179:
Provide the ip6_plen in network byte order when calling ip6_output().

This is not strictly required by ip6_output(), since it overrides it,
but it is needed for upcoming dtrace support.

5 years agoMFC r335176:
tuexen [Sun, 5 May 2019 08:06:32 +0000 (08:06 +0000)]
MFC r335176:
Whitespace changes.

5 years agoMFC: r346715: Acpi MADT table correction for VM_MAXCPU > 21
rgrimes [Sat, 4 May 2019 13:43:48 +0000 (13:43 +0000)]
MFC: r346715: Acpi MADT table correction for VM_MAXCPU > 21

The bhyve acpi MADT table was given a static space of 256 (0x100) bytes,
this is enough space to allow VM_MAXCPU to be 21, this patch changes that
so VM_MAXCPU can be of arbitrary value and not overflow the space by
actually calculating the space needed for the table.

PR: 212782
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: bde (mentor, implicit), jhb (maintainer)
Differential Revision: https://reviews.freebsd.org/D18815

5 years agoMFC r338422: Adding support for CS46xx MIDI output.
avatar [Sat, 4 May 2019 12:19:02 +0000 (12:19 +0000)]
MFC r338422: Adding support for CS46xx MIDI output.

With this patch, users can play the MIDI files through /dev/sequencer
device with tools like playmidi. The audio output will go through
the external MIDI device such like wavetable synthesis card.

Reviewed by: matk (a long time ago), kib
Tested with:  Terratec SiXPack 5.1+ + Yamaha DB50XG

5 years agoMFC 330615: Fix a lock recursion introduced in r327065.
jhb [Sat, 4 May 2019 00:59:11 +0000 (00:59 +0000)]
MFC 330615: Fix a lock recursion introduced in r327065.

5 years agoMFC 327065:
jhb [Sat, 4 May 2019 00:56:47 +0000 (00:56 +0000)]
MFC 327065:
Recognize a pending virtual interrupt while emulating the halt instruction.

5 years agoMFC: r346266
peterj [Fri, 3 May 2019 23:07:07 +0000 (23:07 +0000)]
MFC: r346266
Specify correct Ethernet phy for RPI-B

Approved by: grog, jhb (mentors)

5 years agoMFC: r346265
peterj [Fri, 3 May 2019 23:02:55 +0000 (23:02 +0000)]
MFC: r346265
Fix cpufreq(4) on RPI-B

Approved by: grog, jhb (mentors)

5 years agoMFC r343953:
peterj [Fri, 3 May 2019 22:56:50 +0000 (22:56 +0000)]
MFC r343953:
Replace calls to sin(x) and cos(x) with a single call to sincos().
Replace calls to sinf(x) and cosf(x) with a single call to sincosf().

Approved by: grog, jhb (mentors)

5 years agoMFC r346712:
hselasky [Fri, 3 May 2019 09:38:23 +0000 (09:38 +0000)]
MFC r346712:
Don't call cdev_init where cdev_alloc is called. cdev_alloc already
handles initialization.

5 years agoMFC r346762: Add mutex_destroy() missed in r334844.
mav [Fri, 3 May 2019 03:36:00 +0000 (03:36 +0000)]
MFC r346762: Add mutex_destroy() missed in r334844.

5 years agoMFC r346760: Fix minor mismerges.
mav [Fri, 3 May 2019 03:34:50 +0000 (03:34 +0000)]
MFC r346760: Fix minor mismerges.

No functional change.

5 years agoMFC: r346424
rmacklem [Fri, 3 May 2019 03:05:22 +0000 (03:05 +0000)]
MFC: r346424
Add support for the ModeSetMasked attribute to the NFSv4.1 server.

I do not know of an extant NFSv4.1 client that currently does a Setattr
operation for the ModeSetMasked, but it has been discussed on the linux-nfs
mailing list.
This patch adds support for doing a Setattr of ModeSetMasked, so that it
will work for any future NFSv4.1 client that chooses to do so.
Tested via a hacked FreeBSD NFSv4.1 client.

5 years agoMFC: r346423
rmacklem [Fri, 3 May 2019 02:51:33 +0000 (02:51 +0000)]
MFC: r346423
Replace "vp" with NULL to make the code more readable.

At the time of this nfsv4_sattr() call, "vp == NULL", so this patch doesn't
change the semantics, but I think it makes the code more readable.
It also makes it consistent with the nfsv4_sattr() call a few lines above
this one. Found during code inspection.

5 years agoMFC: r346365
rmacklem [Fri, 3 May 2019 02:17:52 +0000 (02:17 +0000)]
MFC: r346365
Fix the NFSv4.0 server so that it does not support NFSv4.1 attributes.

During inspection of a packet trace, I noticed that an NFSv4.0 mount
reported that it supported attributes that are only defined for NFSv4.1.
In practice, this bug appears to be benign, since NFSv4.0 clients will
not use attributes that were added for NFSv4.1.
However, this was not correct and this patch fixes the NFSv4.0 server
so that it only supports attributes defined for NFSv4.0.
It also adds a definition for NFSv4.1 attributes that can only be set,
although it is only defined as 0 for now.
This is anticipation of the addition of support for the NFSv4.1 mode+mask
attribute soon.

5 years agoMFC r346959:
gjb [Fri, 3 May 2019 00:45:31 +0000 (00:45 +0000)]
MFC r346959:
  Reduce the default image size for virtual machine disk images from
  30GB to 3GB.  The raw images can be resized using truncate(1), and
  other formats can be resized with tools included in hypervisors.

  Enable the growfs(8) rc(8) at firstboot if the disk was resized
  prior to booting the virtual machine for the first time.

Sponsored by: The FreeBSD Foundation

5 years agoMFC 325727:
jhb [Fri, 3 May 2019 00:20:02 +0000 (00:20 +0000)]
MFC 325727:
bhyve: avoid applying capsicum capabilities to file that was not opened

When using -l option targeting file that can't be opened (ie. nmdm module
is not loaded and /dev/nmdm* is specified) bhyve tries to apply capsicum
capabilities to a file that was not opened.

Enclose that code in an if statement and only run it on correctly opened
descriptor also providing meaningful message in case of an error.

5 years agoMFC 313732: bhyve: whitespace fix for r313727
jhb [Fri, 3 May 2019 00:02:07 +0000 (00:02 +0000)]
MFC 313732: bhyve: whitespace fix for r313727

5 years agoUpdate stable/11 from 11.2-STABLE to 11.3-PRERELEASE, marking the
gjb [Thu, 2 May 2019 23:59:44 +0000 (23:59 +0000)]
Update stable/11 from 11.2-STABLE to 11.3-PRERELEASE, marking the
official start of the code slush for the 11.3-RELEASE cycle.

Set the default mdoc(7) version to 11.3, and update the clang(1)
TARGET_TRIPLE to reflect 11.3.

Update the default pkg(8) repository to the 'quarterly' branch to
prevent further 11.3 builds from downgrading packages when invoking
'pkg upgrade' for the duration of the cycle.  This will be reverted
on the stable/11 branch once releng/11.3 is branched. [*]

Approved by: re (implicit)
MFC after: 6 weeks
MFC note: reminder to revert pkg(8) default repository [8]
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345798:
ae [Thu, 2 May 2019 17:41:42 +0000 (17:41 +0000)]
MFC r345798:
  Create 64bit mibII counters for all interfaces.

  PR: 157015
  Obtained from: Yandex LLC

5 years agoMFC: r346709
rmacklem [Thu, 2 May 2019 01:11:49 +0000 (01:11 +0000)]
MFC: r346709
Add support to nfsdumpstate for printing of INET6 addresses for locks.

r346190 added support for printing of INET6 addresses for the "-o" option
(all opens) but missed adding support for INET6 addresses for the "-l" option.
This patch adds that support.

5 years agoMFC 346063: Don't pre-reserve resources for CPU devices when they are set.
jhb [Wed, 1 May 2019 17:30:14 +0000 (17:30 +0000)]
MFC 346063: Don't pre-reserve resources for CPU devices when they are set.

CPUs can use shared (RF_SHAREABLE) resources for the I/O port used for
entering and exiting C states.  If this I/O port is included in an ACPI
system resource device, then this happens to still work, but if the port
wasn't part of a system resource device, only the first CPU could allocate
the I/O port and use C states since resource_list_reserve() was always
allocating the resource from nexus0 without RF_SHAREABLE.  By avoiding
the reservation, the flags from the bus_alloc_resource() in the CPU driver
(which include RF_SHAREABLE) are honored.

PR: 236513

5 years agoMFC r346644: Call delist_dev() before destroy_dev_sched_cb().
mav [Wed, 1 May 2019 13:43:49 +0000 (13:43 +0000)]
MFC r346644: Call delist_dev() before destroy_dev_sched_cb().

destroy_dev_sched_cb() is excessively asynchronous, and during media change
retaste new provider may appear sooner then device of the previous one get
destroyed.

Sponsored by: iXsystems, Inc.

5 years agoMFC r346263:
oshogbo [Wed, 1 May 2019 06:59:04 +0000 (06:59 +0000)]
MFC r346263:
  tcpdump: disable Capsicum if -E option is provided.

  The -E is used to provide a secret for decrypting IPsec.
  The secret may be provided through command line or as the file.
  The problem is that tcpdump doesn't support yet opening files in capability mode
  and the file may contain a list of the files to open.

  As a workaround, for now, let's just disable capsicum if the -E
  the option is provided.

  PR:           236819
  MFC after:    2 weeks

5 years agoMFC r346459:
cy [Wed, 1 May 2019 01:53:19 +0000 (01:53 +0000)]
MFC r346459:

  MFV r346450:

  Update sqlite3-3.27.1 (3270100) --> sqlite3-3.27.2 (3270200)

5 years agoMFC r346804:
cy [Wed, 1 May 2019 01:49:33 +0000 (01:49 +0000)]
MFC r346804:

Left justify a function header brace as it should be.
No functional change.

5 years agoMFC r341759, r341839, r346591:
cy [Wed, 1 May 2019 01:43:17 +0000 (01:43 +0000)]
MFC r341759, r341839, r346591:
The following five MFCs update wpa 2.6 --> 2.8.

r341759:
MFV r341618: Update wpa 2.6 --> 2.7.

r341839:
Set default ciphers.

Submitted by:   jkim@

r346591:
Update wpa_supplicant/hostapd 2.7 --> 2.8

Upstream documents the following advisories:

- https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
- https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
- https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
- https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
- https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
  with-unexpected-fragment.txt

Security: CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
CVE-2019-9497, CVE-2019-9498, CVE-2019-9499

Relnotes: yes

5 years agoMFC 344711: Fix missed posted interrupts in VT-x in bhyve.
jhb [Tue, 30 Apr 2019 23:53:54 +0000 (23:53 +0000)]
MFC 344711: Fix missed posted interrupts in VT-x in bhyve.

When a vCPU is HLTed, interrupts with a priority below the processor
priority (PPR) should not resume the vCPU while interrupts at or above
the PPR should.  With posted interrupts, bhyve maintains a bitmap of
pending interrupts in PIR descriptor along with a single 'pending'
bit.  This bit is checked by a CPU running in guest mode at various
places to determine if it should be checked.  In addition, another CPU
can force a CPU in guest mode to check for pending interrupts by
sending an IPI to a special IDT vector reserved for this purpose.

bhyve had a bug in that it would only notify a guest vCPU of an
interrupt (e.g. by sending the special IPI or by resuming it if it was
idle due to HLT) if an interrupt arrived that was higher priority than
PPR and no interrupts were currently pending.  This assumed that if
the 'pending' bit was set, any needed notification was already in
progress.  However, if the first interrupt sent to a HLTed vCPU was
lower priority than PPR and the second was higher than PPR, the first
interrupt would set 'pending' but not notify the vCPU, and the second
interrupt would not notify the vCPU because 'pending' was already set.
To fix this, track the priority of pending interrupts in a separate
per-vCPU bitmask and notify a vCPU anytime an interrupt arrives that
is above PPR and higher than any previously-received interrupt.

This was found and debugged in the bhyve port to SmartOS maintained by
Joyent.  Relevant SmartOS bugs with more background:

https://smartos.org/bugview/OS-6829
https://smartos.org/bugview/OS-6930
https://smartos.org/bugview/OS-7354

5 years agoMFC r346596:
kib [Tue, 30 Apr 2019 18:42:42 +0000 (18:42 +0000)]
MFC r346596:
ipoib: assign link-local address according to RFC.

5 years agoMFC r342208:
np [Tue, 30 Apr 2019 18:03:17 +0000 (18:03 +0000)]
MFC r342208:

cxgbe/t4_tom: fixes for issues on the passive open side.

- Fix PR 227760 by getting the TOE to respond to the SYN after the call
  to toe_syncache_add, not during it.  The kernel syncache code calls
  syncache_respond just before syncache_insert.  If the ACK to the
  syncache_respond is processed in another thread it may run before the
  syncache_insert and won't find the entry.  Note that this affects only
  t4_tom because it's the only driver trying to insert and expand
  syncache entries from different threads.

- Do not leak resources if an embryonic connection terminates at
  SYN_RCVD because of L2 lookup failures.

- Retire lctx->synq and associated code because there is never a need to
  walk the list of embryonic connections associated with a listener.
  The per-tid state is still called a synq entry in the driver even
  though the synq itself is now gone.

PR: 227760
Sponsored by: Chelsio Communications

5 years agoMFC r345334:
np [Tue, 30 Apr 2019 17:30:37 +0000 (17:30 +0000)]
MFC r345334:

cxgbe(4): Treat the viid as an opaque identifier.

Recent firmwares prefer to use a different format for viid internally
and this change allows them to do so.

Sponsored by: Chelsio Communications

5 years agoMFC r344654:
np [Tue, 30 Apr 2019 17:20:38 +0000 (17:20 +0000)]
MFC r344654:

cxgbe(4): Request high priority filter support explicitly, as required
by recent firmwares.

Sponsored by: Chelsio Communications

5 years agoMFC r343889, r344519, r344682, r344719
np [Tue, 30 Apr 2019 16:52:50 +0000 (16:52 +0000)]
MFC r343889, r344519, r344682, r344719

r343889:
cxgbev(4): Initialize debug_flags from the environment like in the PF driver.

r344519:
cxgbe(4): Use correct port_info in the call to is_bt().

This fixes a panic during configuration if the tx channel of a port
isn't the same as its port id.

Reported by: Fabrice Bruel
Sponsored by: Chelsio Communications

r344682:
cxgbe(4): Don't forget to report link state to the kernel if the link is
already up at attach.

Reported by: Fabrice Bruel @ Orange Business Service
Sponsored by: Chelsio Communications

r344719:
cxgbev(4): Enable 32b port capabilities in the VF driver.

Sponsored by: Chelsio Communications

5 years agoMFC r343666, r343861-r343862, r343923, r343968, r345660, r345810
np [Tue, 30 Apr 2019 16:41:27 +0000 (16:41 +0000)]
MFC r343666, r343861-r343862, r343923, r343968, r345660, r345810

r343666:
cxgbe(4): Improved error reporting and diagnostics.

"slow" interrupt handler:
- Expand the list of INT_CAUSE registers known to the driver.
- Add decode information for many more bits but decouple it from the
  rest of intr_info so that it is entirely optional.
- Call t4_fatal_err exactly once, and from the top level PL intr handler.

t4_fatal_err:
- Use t4_shutdown_adapter from the common code to stop the adapter.
- Stop servicing slow interrupts after the first fatal one.

Driver/firmware interaction:
- CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a
  reply or something else.
- Log the raw value of pcie_fw for some errors.
- Use correct log levels (debug vs. error).

Sponsored by: Chelsio Communications

r343861:
cxgbe(4): Auto-dump the device log on a mailbox timeout or when the
firmware reports an error in pcie_fw.

Sponsored by: Chelsio Communications

r343862:
cxgbe(4): Auto-dump the CIM block's logic analyzer on a TIMER0 interrupt.

Sponsored by: Chelsio Communications

r343923:
cxgbe(4): Delay the panic due to a fatal error by 30s.

This lets information logged by the interrupt handler reach the system
log before the system goes down.

r343968:
cxgbe(4): Ignore unused interrupts.

Sponsored by: Chelsio Communications

r345660:
cxgbe(4): Count and clear interrupts generated at the software's request.

An interrupt can be requested by setting the F_SWINT bit in PL_PF_CTL.

Sponsored by: Chelsio Communications

r345810:
cxgbe(4): Add a flag to indicate that bits in interrupt cause but not in
interrupt enable are not fatal.

The firmware sets up all the interrupt enables based on run time
configuration, which means the information in the enables is more
accurate than what's compiled into the driver.  This change also allows
the fatal bits to be updated without any changes in the driver in some
cases.

Sponsored by: Chelsio Communications

5 years agoMFC r343539:
np [Tue, 30 Apr 2019 16:30:16 +0000 (16:30 +0000)]
MFC r343539:

cxgbe(4): Add adapter information to messages logged by the OS-agnostic
code in t4_hw.c.

Sponsored by: Chelsio Communications

5 years agoMFC r343269, r346567
np [Tue, 30 Apr 2019 08:17:11 +0000 (08:17 +0000)]
MFC r343269, r346567

r343269:
cxgbe(4): Allow negative values in hw.cxgbe.fw_install and take them to
mean that the driver should taste the firmware in the KLD and use that
firmware's version for all its fw_install checks.

The driver gets firmware version information from compiled-in values by
default and this change allows custom (or older/newer) firmware modules
to be used with the stock driver.

There is no change in default behavior.

Sponsored by: Chelsio Communications

r346567:
cxgbe(4): Make sure bundled_fw is always initialized before use.

This fixes a bug that prevented the driver from auto-flashing the
firmware when it didn't see one on the card.  This feature was
introduced in r321390 and this bug was introduced in r343269.

Reported by: gallatin@
Sponsored by: Chelsio Communications

5 years agoMFC r343264:
np [Tue, 30 Apr 2019 08:08:06 +0000 (08:08 +0000)]
MFC r343264:

cxgbe(4): Use a truncated firmware header for version checks.  All the
version numbers are towards the begining of the header.

Sponsored by: Chelsio Communications

5 years agoMFC r343233:
np [Tue, 30 Apr 2019 08:01:59 +0000 (08:01 +0000)]
MFC r343233:

cxgbe(4): Clear the reply-pending status of a hashfilter when the reply
indicates an error.  Also, do not remove it twice from the hf list in
this case.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communicatons

5 years agoMFC r343569, r345307
np [Tue, 30 Apr 2019 07:53:15 +0000 (07:53 +0000)]
MFC r343569, r345307

r343569:
cxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that
was added in r342266.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

r345307:
iw_cxgbe: Remove unused smac_idx from the ep structure.

Submitted by: Krishnamraju Eraparaju @ Chelsio

5 years agoMFC r342954:
np [Tue, 30 Apr 2019 07:45:07 +0000 (07:45 +0000)]
MFC r342954:

cxgbe(4): Move some INTx specific code to a more appropriate place.

5 years agoMFC r342758:
np [Tue, 30 Apr 2019 07:40:01 +0000 (07:40 +0000)]
MFC r342758:

cxgbe(4): Clear FW_OK if the firmware reports an error.

Sponsored by: Chelsio Communications

5 years agoMFC r342356:
np [Tue, 30 Apr 2019 07:37:03 +0000 (07:37 +0000)]
MFC r342356:

Remove unused macros from t4_tom.h.