]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r361073:
Konstantin Belousov [Fri, 22 May 2020 13:14:21 +0000 (13:14 +0000)]
MFC r361073:
Implement RTLD_DEEPBIND.

PR: 246462

4 years agoMFC r342743 (by romain):
Konstantin Belousov [Fri, 22 May 2020 13:13:34 +0000 (13:13 +0000)]
MFC r342743 (by romain):
Add man page for dlvsym(3).

4 years agoMFC r354333,r354359: zfs: enable SPA_PROCESS on the kernel side
Andriy Gapon [Fri, 22 May 2020 12:25:57 +0000 (12:25 +0000)]
MFC r354333,r354359: zfs: enable SPA_PROCESS on the kernel side

The purpose of this change is to group kernel threads specific to a
particular ZFS pool under a kernel process.  There can be many dozens of
threads per pool.  This change improves observability of those threads.

This change consists of several subchanges:
1. illumos taskq_create_proc can now pass its process parameter to
taskqueue.  Also, use zfsproc instead of NULL for taskq_create.  Caveat:
zfsproc might not be initialized yet.  But in that case it is still NULL,
so not worse than before.

2. illumos sys/proc.h: kthread id is stored in t_did field, not t_tid.

3. zfs: enable SPA_PROCESS on the kernel side.  The change is a bit hairy
as newproc() is implemented privately to spa.c.  I couldn't think of a
better way to populate process name than to poke inside the argument for
the process routine.

4. illumos thread_create: allow assigning thread to process other than
zfsproc.

5. zfs: expose spa_proc to other users, assign sync and quiesce threads
to it.

Pool-specific threads created using (relatively new) zthr mechanism are
still assigned to the zfskern process rather than to a respective
zpool-xxx process.  I am going to address this a bit later.

4 years agoMFC r353679: document taskqueue_start_threads_in_proc
Andriy Gapon [Fri, 22 May 2020 12:20:50 +0000 (12:20 +0000)]
MFC r353679: document taskqueue_start_threads_in_proc

While here, fix taskqueue_start_threads_cpuset that was documented under
old name of taskqueue_start_threads_pinned.

4 years agoMFC r361006: linuxkpi: print stack trace in WARN_ON macros
Andriy Gapon [Fri, 22 May 2020 12:10:16 +0000 (12:10 +0000)]
MFC r361006: linuxkpi: print stack trace in WARN_ON macros

4 years agoMFC r361002: snd_hda: fix typos related to quirks set via 'config' tunable
Andriy Gapon [Fri, 22 May 2020 12:08:31 +0000 (12:08 +0000)]
MFC r361002: snd_hda: fix typos related to quirks set via 'config' tunable

4 years agoMFC r361001: sound/hda: newer AMD devices still require the same PCIe snoop
Andriy Gapon [Fri, 22 May 2020 12:06:53 +0000 (12:06 +0000)]
MFC r361001: sound/hda: newer AMD devices still require the same PCIe snoop

So, replicate the ATI vendor snoop configuration for the AMD vendor.
I think that this should fix a number of cases where users currently
have to resort to polling or disabling MSI.

4 years agoMFC r360779: gpioiic_attach: fix a NULL pointer crash on hints-based systems
Andriy Gapon [Fri, 22 May 2020 12:05:01 +0000 (12:05 +0000)]
MFC r360779: gpioiic_attach: fix a NULL pointer crash on hints-based systems

The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin.  But on hints-based systems a GPIO controller
driver might not be fully initialized yet and it does not know gpiobus
hanging off it.  Thus, GPIO_GET_BUS() cannot be called yet.
The reason is that controller drivers typically create a child gpiobus
using gpiobus_attach_bus() and that leads to the following call chain:
gpiobus_attach_bus() -> gpiobus_attach() ->
bus_generic_attach(gpiobus) -> gpioiic_attach().
So, gpioiic_attach() is called before gpiobus_attach_bus() returns.

I observed this bug with nctgpio driver on amd64.
I think that the problem was introduced in r355276.

The fix is to avoid calling GPIO_GET_BUS() from the attach method.
Instead, we know that on hints-based systems only the parent gpiobus can
provide the pins.
Nothing is changed for FDT-based systems.

4 years agoMFC r360692: usbhid: add several missing usages from Digitizer page
Andriy Gapon [Fri, 22 May 2020 12:03:17 +0000 (12:03 +0000)]
MFC r360692: usbhid: add several missing usages from Digitizer page

4 years agoMFC r360499: ig4iic_acpi_probe: remove set but unused variable
Andriy Gapon [Fri, 22 May 2020 12:01:29 +0000 (12:01 +0000)]
MFC r360499: ig4iic_acpi_probe: remove set but unused variable

4 years agoMFC r360246: acpi_video: fix a crash in detach with an LCD output
Andriy Gapon [Fri, 22 May 2020 11:59:50 +0000 (11:59 +0000)]
MFC r360246: acpi_video: fix a crash in detach with an LCD output

The crash happened because of a video output object was removed from a
wrong container, crt_units instead of lcd_units.

4 years agoMFC r360242: acpi_iicbus: set device description in the probe method
Andriy Gapon [Fri, 22 May 2020 11:57:48 +0000 (11:57 +0000)]
MFC r360242: acpi_iicbus: set device description in the probe method

Kernel prints the device announcement before the attach method is
called, so if the correct description is not set by the probe method,
then the announcement would have an incorrect one.

4 years agoMFC r360241: ig4: ensure that drivers always attach in correct order
Andriy Gapon [Fri, 22 May 2020 11:55:54 +0000 (11:55 +0000)]
MFC r360241: ig4: ensure that drivers always attach in correct order

Use DRIVER_MODULE_ORDERED(SI_ORDER_ANY) so that ig4's ACPI attachment
happens after iicbus and acpi_iicbus drivers are registered.

4 years agoMFC r358381: use ZFS_MAX_DATASET_NAME_LEN instead of MAXPATHLEN for dataset names
Andriy Gapon [Fri, 22 May 2020 11:53:07 +0000 (11:53 +0000)]
MFC r358381: use ZFS_MAX_DATASET_NAME_LEN instead of MAXPATHLEN for dataset names

The change affects only FreeBSD specific code as the common code already
mostly uses the more idiomatic and correct ZFS_MAX_DATASET_NAME_LEN.

4 years agoMFC r358380,r358382: dsl_dataset_promote_sync: populate 'oldname' before using it
Andriy Gapon [Fri, 22 May 2020 11:41:08 +0000 (11:41 +0000)]
MFC r358380,r358382: dsl_dataset_promote_sync: populate 'oldname' before using it

It's very unlikely that zfsvfs_update_fromname() and
zvol_rename_minors() ever did anything during the promote operation as
the old name was not initialized.

4 years agoMFC r361075:
Hans Petter Selasky [Fri, 22 May 2020 08:59:12 +0000 (08:59 +0000)]
MFC r361075:
Assign process group of the TTY under the "proctree_lock".

This fixes a race where concurrent calls to doenterpgrp() and
leavepgrp() while TIOCSCTTY is executing may result in tp->t_pgrp
changing value so that tty_rel_pgrp() misses clearing it to NULL. For
more details refer to the use of pgdelete() in the kernel.

No functional change intended.

Panic backtrace:
__mtx_lock_sleep() # page fault due to using destroyed mutex
tty_signal_pgrp()
tty_ioctl()
ptsdev_ioctl()
kern_ioctl()
sys_ioctl()
amd64_syscall()

Sponsored by: Mellanox Technologies

4 years agoMFC r361260: Update leap-seconds to leap-seconds.3676924800.
Xin LI [Fri, 22 May 2020 02:06:56 +0000 (02:06 +0000)]
MFC r361260: Update leap-seconds to leap-seconds.3676924800.

4 years agoMFC r347532, r347541
Mark Johnston [Thu, 21 May 2020 22:47:39 +0000 (22:47 +0000)]
MFC r347532, r347541
Provide separate accounting for user-wired pages.

4 years agoMFC r360477: Correctly set up the initial TCP congestion window in all cases
Richard Scheffenegger [Thu, 21 May 2020 19:46:11 +0000 (19:46 +0000)]
MFC r360477: Correctly set up the initial TCP congestion window in all cases

by not including the SYN bit sequence space in cwnd related calculations.
Snd_und is adjusted explicitly in all cases, outside the cwnd update, instead.

This fixes an off-by-one conformance issue with regular TCP sessions
not  using Appropriate Byte Counting (RFC3465), sending one more
packet during  the initial window than expected.

PR: 235256
Reviewed by: tuexen (mentor), rgrimes (mentor, blanket)
Approved by: tuexen (mentor), rgrimes (mentor, blanket)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D19000

4 years agoMFC r360479: Prevent premature shrinking of the scaled receive window
Richard Scheffenegger [Thu, 21 May 2020 19:41:25 +0000 (19:41 +0000)]
MFC r360479: Prevent premature shrinking of the scaled receive window

which can cause a TCP client to use invalid or stale TCP sequence numbers for ACK packets.

Packets with old sequence numbers are ignored and not used to update the send window size.
This might cause the TCP session to hang indefinitely under some circumstances.

Reported by: Cui Cheng
Reviewed by: tuexen (mentor), rgrimes (mentor, blanket)
Approved by: tuexen (mentor), rgrimes (mentor, blanket)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24515

4 years agoMFC r361039:
Mark Johnston [Thu, 21 May 2020 15:29:03 +0000 (15:29 +0000)]
MFC r361039:
Fix the i386 build after r361033.

4 years agoMFC r361033:
Mark Johnston [Thu, 21 May 2020 15:28:35 +0000 (15:28 +0000)]
MFC r361033:
Call acpi_pxm_set_proximity_info() slightly earlier on x86.

4 years agoMFC r361031:
Mark Johnston [Thu, 21 May 2020 15:18:59 +0000 (15:18 +0000)]
MFC r361031:
Assert that page table traversal functions don't operate on superpages.

4 years agoMFC r361037, r361056:
Konstantin Belousov [Thu, 21 May 2020 11:12:27 +0000 (11:12 +0000)]
MFC r361037, r361056:
Fix spurious ENOTCONN from closed unix domain socket other' side.

4 years agoMFC r361011: kernel: provide panicky version of __unreachable
Kyle Evans [Thu, 21 May 2020 02:08:34 +0000 (02:08 +0000)]
MFC r361011: kernel: provide panicky version of __unreachable

__builtin_unreachable doesn't raise any compile-time warnings/errors on its
own, so problems with its usage can't be easily detected. While it would be
nice for this situation to change and compilers to at least add a warning
for trivial cases where local state means the instruction can't be reached,
this isn't the case at the moment and likely will not happen.

This commit adds an __assert_unreachable, whose intent is incredibly clear:
it asserts that this instruction is unreachable. On INVARIANTS builds, it's
a panic(), and on non-INVARIANTS it expands to  __unreachable().

Existing users of __unreachable() are converted to __assert_unreachable,
to improve debuggability if this assumption is violated.

4 years agoMFC r361066:
Ryan Moeller [Thu, 21 May 2020 02:04:10 +0000 (02:04 +0000)]
MFC r361066:

jail: Add exec.prepare and exec.release command hooks

This change introduces new jail command hooks that run before and after any
other actions.

The exec.prepare hook can be used for example to invoke a script that checks
if the jail's root exists, creating it if it does not. Since arbitrary
variables in jail.conf can be passed to the command, it can be pretty useful
for templating jails.

An example use case for exec.release would be to remove the filesystem of an
ephemeral jail.

The names "prepare" and "release" are borrowed from the names of similar hooks
in libvirt.

Reviewed by:    jamie, manpages, mmacy
Approved by:    mmacy (mentor)
Differential Revision:  https://reviews.freebsd.org/D24829

4 years agoMFC r361065: pf tests: fix up a couple WARNS= 6 nits
Kyle Evans [Thu, 21 May 2020 01:55:10 +0000 (01:55 +0000)]
MFC r361065: pf tests: fix up a couple WARNS= 6 nits

common_init_tbl is only used within this single CU, so it should be marked
static.

WARNS=6 also complained about the var defined by
`ATF_TC_WITH_CLEANUP(getastats);` being unused, which turns out to be
because it's not been hooked up in ATF_TP_ADD_TCS. kp@ did not immediately
recall any reason for this, and the case passes on my local system, so hook
it up.

Note that I've not yet set WARNS= 6 here. Investigation is underway to see
if we can feasibly default WARNS to 6 for src builds to catch directories
too deep to inherit a WARNS from the top-level subdirectories' Makefile.inc.
Those particular WARNS settings will be subsequently removed as they become
redundant with a more-global default.

4 years agoMFC r361000, r361036: improve inetd(8) examples
Kyle Evans [Thu, 21 May 2020 01:53:03 +0000 (01:53 +0000)]
MFC r361000, r361036: improve inetd(8) examples

r361000:
inetd(8): Provide HTTP proxy example using netcat

One of the fortunes that are included in freebsd-tips talks about how
the superserver can be used to proxy connections with netcat, but there are
no examples provided. This commit adds an example with comment explaining
what it does.

r361036:
inetd(8): Add comments to all examples

4 years agoMFC r361022-r361023, r361148: certctl(8) fixes
Kyle Evans [Thu, 21 May 2020 01:23:59 +0000 (01:23 +0000)]
MFC r361022-r361023, r361148: certctl(8) fixes

r361022: certctl(8): don't completely nuke $CERTDESTDIR

It's been reported/noted that a well-timed `certctl rehash` will completely
obliterate $CERTDESTDIR, which may get used by ports or system
administrators. While we can't guarantee the certctl semantics when other
non-certctl-controlled bits live here, we should make some amount of effort
to play nice.

Pruning all existing links, which we'll subsequently rebuild as needed, is
sufficient for our needs. This can still be destructive, but it's perhaps
less likely to cause issues.

I also note that we should probably be pruning /etc/ssl/blacklisted upon
rehash as well.

r361023: certctl: follow-up to r361022, prune blacklist as well

Otherwise, removals from the blacklist may not get processed as they should.

While we're here, restructure these to not bother with mkdir(1) if we've
already tested them to exist.

r361148: certctl: don't fall over flat with relative DESTDIR

Up until now, all of our DESTDIR use has been with absolute paths. It turned
out that the cd in/out dance we do here breaks us down later on, as the
relative path no longer resolves.

Convert EXTENSIONS to an ERE that we'll use to grep ls -1 of the dir we're
inspecting, rather than cd'ing into it and globbing it up.

4 years agoMFC r361300: Fix indentation in bsdinstall-created wpa_supplicant.conf
Devin Teske [Wed, 20 May 2020 23:27:01 +0000 (23:27 +0000)]
MFC r361300: Fix indentation in bsdinstall-created wpa_supplicant.conf

PR: base/221982
Reported by: emaste
Reviewed by: emaste, allanjude
Differential Revision: https://reviews.freebsd.org/D23641

4 years agoMFC r361104 (jhibbits): elftoolchain: Add powerpc64 definition
Ed Maste [Wed, 20 May 2020 22:19:43 +0000 (22:19 +0000)]
MFC r361104 (jhibbits): elftoolchain: Add powerpc64 definition

powerpc is already in place, but powerpc64 is needed separately.

4 years agoMFC r349577 (arichardson): Allow bootstrapping elftoolchain on MacOS and Linux
Ed Maste [Wed, 20 May 2020 21:41:36 +0000 (21:41 +0000)]
MFC r349577 (arichardson): Allow bootstrapping elftoolchain on MacOS and Linux

This is required in order to build on non-FreeBSD systems without setting
all the XAR/XSTRINGS/etc. variables

4 years agoMFC r360690:
Mark Johnston [Wed, 20 May 2020 17:33:11 +0000 (17:33 +0000)]
MFC r360690:
Simplify arm64's pmap_bootstrap() a bit.

4 years agoMFC r357826: elfcopy: set ELF OS/ABI field when converting from binary
Ed Maste [Tue, 19 May 2020 22:09:59 +0000 (22:09 +0000)]
MFC r357826: elfcopy: set ELF OS/ABI field when converting from binary

PR: 228934
Submitted by: Tiger Gao
Sponsored by: The FreeBSD Foundation

4 years agoMFC r360564: Cleanup LUN addition/removal.
Alexander Motin [Tue, 19 May 2020 14:31:47 +0000 (14:31 +0000)]
MFC r360564: Cleanup LUN addition/removal.

 - Make ctl_add_lun() synchronous.  Asynchronous addition was used by
Copan's proprietary code long ago and never for upstream FreeBSD.
 - Move LUN enable/disable calls from backends to CTL core.
 - Serialize LUN modification and partially removal to avoid double frees.
 - Slightly unify backends code.

4 years agoMFC r359686: Fix panic on kern.cam.ctl.ha_role change after r333446.
Alexander Motin [Tue, 19 May 2020 13:52:34 +0000 (13:52 +0000)]
MFC r359686: Fix panic on kern.cam.ctl.ha_role change after r333446.

4 years agoMFC r360983:
Konstantin Belousov [Tue, 19 May 2020 07:47:59 +0000 (07:47 +0000)]
MFC r360983:
Clear namespace pollution in include/malloc_np.h

4 years agoMFC r360966:
Mark Johnston [Tue, 19 May 2020 03:24:45 +0000 (03:24 +0000)]
MFC r360966:
rtwn: Add a USB ID for the TP-Link TL-WN727N.

PR: 246417

4 years agoMFC r360960:
Ryan Moeller [Tue, 19 May 2020 01:43:00 +0000 (01:43 +0000)]
MFC r360960:

nfs: Remove APPLESTATIC macro

It is no longer useful.

Reviewed by:    rmacklem
Approved by:    mav (mentor)
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D24811

4 years agoMFC r361114:
Colin Percival [Tue, 19 May 2020 01:40:45 +0000 (01:40 +0000)]
MFC r361114:

  Move the devmatch rc.d script before netif in the boot process.

  Prior to this change, using lagg to aggregate wired and wireless networks
  was broken in the (relatively common) case where wifi drivers + firmware
  are loaded by devmatch, since the interface didn't exist at the time when
  the lagg interface was being created.

PR: 246506

4 years agoMFC r361097:
Colin Percival [Tue, 19 May 2020 01:39:37 +0000 (01:39 +0000)]
MFC r361097:
  Send Lid status notification via devd from acpi_lid_status_update.

  Some laptops don't send ACPI "lid status changed" notifications upon
  opening the lid if the system was currently suspended.  In r358219
  this was partially fixed, updating the "lid_status" variable upon
  resume even if there is no "status changed" notification from ACPI.

  Unfortunately the fix in r358219 did not include notifying userland
  via devd; this causes problems on systems using upowerd (e.g. KDE),
  since upowerd remembers the most recent devd notification about the
  lid status rather than querying the sysctl to get the current status.

  This showed up as two symptoms when KDE's "When laptop lid closed: Sleep"
  option is set:
  1. 50% of the time, closing the lid would not trigger S3 sleep.
  2. 50% of the time, plugging/unplugging AC power would trigger S3 sleep.

PR: 246477

4 years agoMFC r361077, r361078, r361079:
Konstantin Belousov [Mon, 18 May 2020 14:37:10 +0000 (14:37 +0000)]
MFC r361077, r361078, r361079:
Improve comment for compat32 handling of sysctl hw.pagesizes.

4 years agoMFC r360925:
Hans Petter Selasky [Mon, 18 May 2020 09:45:59 +0000 (09:45 +0000)]
MFC r360925:
Refresh the USB device strings when a USB device is re-enumerated.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r360623:
Hans Petter Selasky [Mon, 18 May 2020 09:44:26 +0000 (09:44 +0000)]
MFC r360623:
Optimise use of sg_page_count() in __sg_page_iter_next() in the LinuxKPI.
No need to compute value twice.

No functional change intended.

Sponsored by: Mellanox Technologies

4 years agoMFC r360622:
Hans Petter Selasky [Mon, 18 May 2020 09:37:02 +0000 (09:37 +0000)]
MFC r360622:
Implement more scatter and gather functions in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D24611
Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r360621:
Hans Petter Selasky [Mon, 18 May 2020 09:35:42 +0000 (09:35 +0000)]
MFC r360621:
Fix warning about sleeping with non-sleepable lock when allocating
"current" from linux_cdev_pager_populate() in the LinuxKPI:

Backtrace:
witness_debugger()
witness_warn()
uma_zalloc_arg()
malloc()
linux_alloc_current()
linux_cdev_pager_populate()
vm_fault()
vm_fault_trap()
trap_pfault()
trap()
calltrap()

Suggested by: avg@
Sponsored by: Mellanox Technologies

4 years agoMFC r360532:
Hans Petter Selasky [Mon, 18 May 2020 09:26:42 +0000 (09:26 +0000)]
MFC r360532:
Implement more PCI-express bandwidth functions in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r360531:
Hans Petter Selasky [Mon, 18 May 2020 09:25:23 +0000 (09:25 +0000)]
MFC r360531:
Implement mutex_lock_killable() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r360530:
Hans Petter Selasky [Mon, 18 May 2020 09:24:05 +0000 (09:24 +0000)]
MFC r360530:
Implement DIV64_U64_ROUND_UP() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r360529:
Hans Petter Selasky [Mon, 18 May 2020 09:22:47 +0000 (09:22 +0000)]
MFC r360529:
Implement more lockdep macros in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r351003:
Hans Petter Selasky [Mon, 18 May 2020 09:21:45 +0000 (09:21 +0000)]
MFC r351003:
Fix build with DRM and INVARIANTS enabled.

The DRM drivers use the lockdep assertion macros with spinlock_t locks
which are backed by mutexes, not sx locks.  This causes compile
failures since you can't use sx_assert with a mutex.  Instead, change
the lockdep macros to use lock_class methods.  This works by assuming
that each LinuxKPI locking primitive embeds a FreeBSD lock as its
first structure and uses a cast to get to the underlying 'struct
lock_object'.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D20992

4 years agoMFC r360329:
Hans Petter Selasky [Mon, 18 May 2020 09:17:05 +0000 (09:17 +0000)]
MFC r360329:
Properly update AD field length in hccontrol(8).

While at it use strtol() instead of atoi() to support hexadecimal
numbers aswell as 10-base numbers.

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245899
Sponsored by: Mellanox Technologies

4 years agoMFC r360288:
Hans Petter Selasky [Mon, 18 May 2020 09:15:45 +0000 (09:15 +0000)]
MFC r360288:
Put advertising data in correct place.

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245848
Sponsored by: Mellanox Technologies

4 years agoMFC r360263:
Hans Petter Selasky [Mon, 18 May 2020 09:14:24 +0000 (09:14 +0000)]
MFC r360263:
Rename two commands to match the Bluetooth specification in hccontrol(8).
Fix some bad spelling while at it.

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245868
Sponsored by: Mellanox Technologies

4 years agoMFC r360243:
Hans Petter Selasky [Mon, 18 May 2020 09:13:03 +0000 (09:13 +0000)]
MFC r360243:
Add support for LE advertising to hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245848
Sponsored by: Mellanox Technologies

4 years agoMFC r360127:
Hans Petter Selasky [Mon, 18 May 2020 09:11:41 +0000 (09:11 +0000)]
MFC r360127:
Implement the atomic fetch add unless functions for the LinuxKPI.

Sponsored by: Mellanox Technologies

4 years agoMFC r360119:
Hans Petter Selasky [Mon, 18 May 2020 09:10:21 +0000 (09:10 +0000)]
MFC r360119:
Implement aligned LinuxKPI types for u16, u32 and u64.
Makes a difference for 32-bit platforms mostly.

Sponsored by: Mellanox Technologies

4 years agoMFC r360118:
Hans Petter Selasky [Mon, 18 May 2020 09:09:03 +0000 (09:09 +0000)]
MFC r360118:
Allow test_bit() in the LinuxKPI to accept a const pointer.

Sponsored by: Mellanox Technologies

4 years agoMFC r360790:
Hans Petter Selasky [Mon, 18 May 2020 09:07:14 +0000 (09:07 +0000)]
MFC r360790:
Set PCM_CAP_VIRTUAL for virtual DSP devices.

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 246206
Sponsored by: Mellanox Technologies

4 years agoMFC r360528:
Hans Petter Selasky [Mon, 18 May 2020 09:05:29 +0000 (09:05 +0000)]
MFC r360528:
Implement kstrtou64() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies

4 years agoMFC r360377:
Hans Petter Selasky [Mon, 18 May 2020 09:03:12 +0000 (09:03 +0000)]
MFC r360377:
Add support for reading temperature in mlx5en(4).

Sponsored by: Mellanox Technologies

4 years agoMFC r360197:
Hans Petter Selasky [Mon, 18 May 2020 09:00:45 +0000 (09:00 +0000)]
MFC r360197:
Add support for Read_Local_Supported_Commands command to hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245811
Sponsored by: Mellanox Technologies

4 years agoMFC r360172:
Hans Petter Selasky [Mon, 18 May 2020 08:58:41 +0000 (08:58 +0000)]
MFC r360172:
Update string tables in hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245796
Sponsored by: Mellanox Technologies

4 years agoMFC r360116:
Hans Petter Selasky [Mon, 18 May 2020 08:57:21 +0000 (08:57 +0000)]
MFC r360116:
Substitute le_read_supported_status with le_read_supported_states.
Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27.

PR: 245763
Submitted by: Marc Veldman <marc@bumblingdork.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r360115:
Hans Petter Selasky [Mon, 18 May 2020 08:55:49 +0000 (08:55 +0000)]
MFC r360115:
Allow the ERR_CAST() function in the LinuxKPI to take a const void pointer.
No functional change.

Sponsored by: Mellanox Technologies

4 years agoMFC r360095:
Hans Petter Selasky [Mon, 18 May 2020 08:52:06 +0000 (08:52 +0000)]
MFC r360095:
Fix cut and paste off-by-one error in hccontrol(8).
Make sure strncpy() doesn't write beyond its given buffer.

PR: 245739
Sponsored by: Mellanox Technologies

4 years agoMFC r360094:
Hans Petter Selasky [Mon, 18 May 2020 08:46:17 +0000 (08:46 +0000)]
MFC r360094:
Improve printing of le features in hccontrol(8).

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245739
Sponsored by: Mellanox Technologies

4 years agoMFC r360092:
Hans Petter Selasky [Mon, 18 May 2020 08:44:16 +0000 (08:44 +0000)]
MFC r360092:
Bring HCI error messages up-to-date.
See Bluetooth v5.6 core specification Vol.1 Part F: Controller error codes.

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245737
Sponsored by: Mellanox Technologies

4 years agoMFC r360070:
Hans Petter Selasky [Mon, 18 May 2020 08:40:39 +0000 (08:40 +0000)]
MFC r360070:
Add missing feature descriptions to hci_features2str().

The list of possible features in hccontrol/features2str() is incomplete.
Refer to "Bluetooth Core Specification 5.2 Vol. 2 Part C. 3.3 Feature Mask Definition".

Submitted by: Marc Veldman <marc@bumblingdork.com>
PR: 245354
Sponsored by: Mellanox Technologies

4 years agoMFC r360900:
Ryan Moeller [Mon, 18 May 2020 00:32:42 +0000 (00:32 +0000)]
MFC r360900:

vfs_exports: Tighten bounds and assert consistency of numsecflavors

We know the value must be greater than 0 and less than MAXSECFLAVORS.

Reject values outside this range in the initial check in vfs_export and add
KASSERTs in the later consumers.

Also check that we are called with one of either MNT_DELEXPORT or MNT_EXPORTED
set.

Reviewed by:    rmacklem
Approved by:    mav (mentor)
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D24753

4 years agoMFC r361064
Peter Grehan [Sun, 17 May 2020 11:09:38 +0000 (11:09 +0000)]
MFC r361064
    Hide host CPUID 0x15 TSC/Crystal ratio/freq info from guest

    In recent Linux (5.3+) and OpenBSD (6.6+) kernels, and with hosts that
    support CPUID 0x15, the local APIC frequency is determined directly
    from the reported crystal clock to avoid calibration against the 8254
    timer.

    However, the local APIC frequency implemented by bhyve is 128MHz, where
    most h/w systems report frequencies around 25MHz. This shows up on
    OpenBSD guests as repeated keystrokes on the emulated PS2 keyboard
    when using VNC, since the kernel's timers are now much shorter.

    Fix by reporting all-zeroes for CPUID 0x15. This allows guests to fall
    back to using the 8254 to calibrate the local APIC frequency.

    Future work could be to compute values returned for 0x15 that would
    match the host TSC and bhyve local APIC frequency, though all dependencies
    on this would need to be examined (for example, Linux will start using
    0x16 for some hosts).

    PR: 246321
    Reported by: Jason Tubnor (and tested)

Approved by: bz (mentor)

4 years agoAdd new stats(7) man page and hook it up to the build.
Benedict Reuschling [Sun, 17 May 2020 09:34:29 +0000 (09:34 +0000)]
Add new stats(7) man page and hook it up to the build.

This man page contains stat utilities that are available in
the base system. This is a better approach than looking them
up via "apropos stat" or similar commands.

Thanks to Daniel Ebdrup Jensen for writing the original page
and incorporating the feedback given.

Submitted by: Daniel Ebdrup Jensen
Reviewed by: 0mp, allanjude, brueffer, bcr
Approved by: bcr
Relnotes: yes (new stats(7) man page)
Differential Revision: https://reviews.freebsd.org/D24417

4 years agoMFC r360613:
Alan Somers [Sun, 17 May 2020 02:36:42 +0000 (02:36 +0000)]
MFC r360613:

Fix intermittent cleanup failures in the ggated test

4 years agoMFC r360339, r360567
Alan Somers [Sun, 17 May 2020 02:35:50 +0000 (02:35 +0000)]
MFC r360339, r360567

r360339:
mac_bsdextended: ATFify the tests

The new tests have more complete setup and cleanup, are more granular, and
correctly annotate expected failures and skipped tests. A follow-up commit
will resolve a conflict with the fusefs tests (bug 244229).

Differential Revision: https://reviews.freebsd.org/D24257

r360567:
Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests

mac_bsdextended(4), when enabled, causes ordinary operations to send many
more VOP_GETATTRs to file system. The fusefs tests expectations aren't
written with those in mind. Optionally expecting them would greatly
obfuscate the fusefs tests. Worse, certain fusefs functionality (like
attribute caching) would be impossible to test if the tests couldn't expect
an exact number of GETATTR operations.

This commit resolves that conflict by making two changes:

1. The fusefs tests will now check for mac_bsdextended, and skip if it's
   enabled.
2. The mac_bsdextended tests will now check whether the module is enabled, not
   merely loaded. If it's loaded but disabled, the tests will automatically
   enable it for the duration of the tests.

With these changes, a CI system can achieve best coverage by loading both
fusefs and mac_bsdextended at boot, and setting
security.mac.bsdextended.enabled=0

PR: 244229
Reported by: lwhsu
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D24577

4 years agoMFC r359435:
Alan Somers [Sun, 17 May 2020 02:21:53 +0000 (02:21 +0000)]
MFC r359435:

fusefs: add a dtrace probe that fires after mounting is complete

This probe is useful for showing the protocol options negotiated with a FUSE
server.

4 years agoMFC r360087:
Alan Somers [Sun, 17 May 2020 01:55:07 +0000 (01:55 +0000)]
MFC r360087:

libbsm: fix some MLINKS

Add missing MLINKS entries for a few functions. Remove some old typo
entries.

Reported by: phk
Reviewed by: cem

4 years agoMFC r360080:
Alan Somers [Sun, 17 May 2020 01:51:25 +0000 (01:51 +0000)]
MFC r360080:

zfs-program.8: fix orphan .Xr

Reported by: phk
Reviewed by: avg
Differential Revision: https://reviews.freebsd.org/D24488

4 years agoMFC r360079:
Alan Somers [Sun, 17 May 2020 01:50:04 +0000 (01:50 +0000)]
MFC r360079:

cap_dns.3: fix some orphan .Xr links

Reported by: phk

4 years agoMFC r360078, r360086
Alan Somers [Sun, 17 May 2020 01:48:12 +0000 (01:48 +0000)]
MFC r360078, r360086

r360078:
bectl.8, beinstall.sh.8: fix man page section of beinstall.sh

Reported by: phk

r360086:
bectl.8: correctly sort SEE ALSO section after 360078

Reported by: yuripv
MFC with: 360078

4 years agoMFC r360077:
Alan Somers [Sun, 17 May 2020 01:46:00 +0000 (01:46 +0000)]
MFC r360077:

zfsd.8: fix orphan .Xr

Though ZFS is a kernel module, it has no man page in section 4.

Reported by: phk

4 years agoMFC r360845:
Konstantin Belousov [Sat, 16 May 2020 09:03:18 +0000 (09:03 +0000)]
MFC r360845:
Avoid spurious ENOMEMs from sysctl hw.pagesizes.

PR: 246215

4 years agoMFC r360848:
Mark Johnston [Sat, 16 May 2020 00:28:49 +0000 (00:28 +0000)]
MFC r360848:
rtwn: Add a new USB ID.

PR: 246315

4 years agoMFC r360551-r360554
Mitchell Horne [Fri, 15 May 2020 20:01:30 +0000 (20:01 +0000)]
MFC r360551-r360554

This set of changes allows booting with OpenSBI v0.7.

r360551:
Make mpentry independent of _start

r360552:
Add support for HSM SBI extension

r360553:
Use the HSM SBI extension to start APs

r360554:
Use the HSM SBI extension to halt CPUs

4 years agoMFC r360813:
Ryan Moeller [Fri, 15 May 2020 01:01:02 +0000 (01:01 +0000)]
MFC r360813:

Remove APPLEKEXT ifndefs

They are no longer useful.

Reviewed by:    rmacklem
Approved by:    mav (mentor)
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D24752

4 years agoMFC r360952: Generate zlib.pc from source.
Xin LI [Fri, 15 May 2020 00:50:52 +0000 (00:50 +0000)]
MFC r360952: Generate zlib.pc from source.

4 years agoMFC r360594: ipfw: whitespace fix in SCTP_ABORT_ASSOCIATION case statement comment
Ed Maste [Thu, 14 May 2020 20:43:59 +0000 (20:43 +0000)]
MFC r360594: ipfw: whitespace fix in SCTP_ABORT_ASSOCIATION case statement comment

PR: Neel Chauhan <neel AT neelc DOT org>

4 years agoMFC r360398 and r360902
Eric Joyner [Thu, 14 May 2020 19:56:54 +0000 (19:56 +0000)]
MFC r360398 and r360902

These commits introduce a new iflib device-dependent method and
implements that method in the Intel ethernet network drivers;
this method tells iflib if the network interface needs to be
restarted when certain events happen.

This fixes several issues that occur when VLANs are registered
or unregistered with the network interface.

PR: 240818, 241785
Sponsored by: Intel Corporation

4 years agoBump Dd for r361044.
John Baldwin [Thu, 14 May 2020 19:15:21 +0000 (19:15 +0000)]
Bump Dd for r361044.

This is a direct commit to stable/{11,12} as I missed the bump in the
commit to head, but the file has already been removed from head.

4 years agoMFC r360915:
Dimitry Andric [Thu, 14 May 2020 19:09:13 +0000 (19:09 +0000)]
MFC r360915:

Use -fno-asynchronous-unwind-tables to compile lib/csu

Summary:
In r209294 kib added -fno-asynchronous-unwind-tables to the compile
flags for the GNU C startup components. This was done to work around a
BFD ld assertion, "no .eh_frame_hdr table will be created", which is
produced because of the layout of the startup objects.

Add the same flag to lib/csu too, for the same reason. And similarly to
r209294, also add -fno-omit-frame-pointer.

This is primarily meant to quickly MFC to stable/11, so it can end up in
the 11.4 release, as a fix for https://bugs.freebsd.org/246322.

PR: 246322
Differential Revision: https://reviews.freebsd.org/D24797

4 years agoMFC 360710: Deprecate ubsec(4) for FreeBSD 13.0.
John Baldwin [Thu, 14 May 2020 18:59:34 +0000 (18:59 +0000)]
MFC 360710: Deprecate ubsec(4) for FreeBSD 13.0.

With the removal of in-tree consumers of DES, Triple DES, and
MD5-HMAC, the only algorithm this driver still supports is SHA1-HMAC.
This is not very useful as a standalone algorithm (IPsec AH-only with
SHA1 would be the only user).

This driver has also not been kept up to date with the original driver
in OpenBSD which supports a few more cards and AES-CBC on newer cards.
The newest card currently supported by this driver was released in
2005.

Relnotes: yes

4 years agoMFC 360634: Add RFC reference for AES-CTR with IPsec.
John Baldwin [Thu, 14 May 2020 18:55:45 +0000 (18:55 +0000)]
MFC 360634: Add RFC reference for AES-CTR with IPsec.

4 years agoMFC 360399:
John Baldwin [Thu, 14 May 2020 18:49:43 +0000 (18:49 +0000)]
MFC 360399:
Update the cached MSI state when any MSI capability register is written.

bhyve uses cached copies of the MSI capability registers to generate
MSI interrupts for device models.  Previously, these cached fields
were only set when the MSI capability control register was updated.
The Linux kernel recently adopted a change to deal with races in MSI
interrupt delivery that writes to the MSI capability address and data
registers to alter the destination of MSI interrupts without writing
to the MSI capability control register.  bhyve was not updating its
cached registers for these writes and continued to send interrupts
with the old data value to the old address.  Fix this by recomputing
the cached values for every write to any MSI capability register.

4 years agoMFC 360818: Fix a memory leak for ENCIOC_GETSTRING I introduced in r360171.
John Baldwin [Thu, 14 May 2020 18:19:28 +0000 (18:19 +0000)]
MFC 360818: Fix a memory leak for ENCIOC_GETSTRING I introduced in r360171.

4 years agoMFC 360171,360179,360285,360388: Don't dereference various user pointers.
John Baldwin [Thu, 14 May 2020 17:56:43 +0000 (17:56 +0000)]
MFC 360171,360179,360285,360388: Don't dereference various user pointers.

360171:
Don't access a user buffer directly from the kernel.

The handle_string callback for the ENCIOC_SETSTRING ioctl was passing
a user pointer to memcpy().  Fix by using copyin() instead.

For ENCIOC_GETSTRING ioctls, the handler was storing the user pointer
in a CCB's data_ptr field where it was indirected by other code.  Fix
this by allocating a temporary buffer (which ENCIOC_SETSTRING already
did) and copying the result out to the user buffer after the CCB has
been processed.

360179:
Don't pass a user buffer pointer as the data pointer in a CCB.

Allocate a temporary buffer in the kernel to serve as the CCB data
pointer for a pass-through transaction and use copyin/copyout to
shuffle the data to/from the user buffer.

360285:
Don't indirect user pointers directly in two 802.11s ioctls.

IEEE80211_MESH_RTCMD_ADD was invoking memcmp() to validate the
supplied address directly on the user pointer rather than first doing
a copyin() and validating the copied value.

IEEE80211_MESH_RTCMD_DELETE was passing the user pointer directly to
ieee80211_mesh_rt_del() rather than copying the user buffer into a
temporary kernel buffer.

360388:
Don't run strcmp() against strings stored in user memory.

Instead, copy the strings into a temporary buffer on the stack and
run strcmp on the copies.

4 years agoMFC r360568:
David Bright [Thu, 14 May 2020 12:52:08 +0000 (12:52 +0000)]
MFC r360568:

Fix various Coverity-detected errors in nvme driver

This fixes several Coverity-detected errors in the nvme driver.

CIDs addressed: 100834410093771009380119374013054701403975,
1403980

Sponsored by: Dell EMC Isilon

4 years agoMFC r360491: Introduce a lower bound of 2 MSS to TCP Cubic.
Richard Scheffenegger [Thu, 14 May 2020 09:55:41 +0000 (09:55 +0000)]
MFC r360491:   Introduce a lower bound of 2 MSS to TCP Cubic.

Running TCP Cubic together with ECN could end up reducing cwnd down to 1 byte, if the
receiver continously sets the ECE flag, resulting in very poor transmission speeds.

In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as a typecast
to prevent any potential integer overflows during intermediate calculation steps of the
adjusted cwnd.

Reported by: Cheng Cui
Reviewed by: tuexen (mentor)
Approved by: tuexen (mentor)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D23353

4 years agoMFC r360786:
Piotr Pawel Stefaniak [Thu, 14 May 2020 06:07:23 +0000 (06:07 +0000)]
MFC r360786:
ps: extend the non-standard option -d (tree view) to work with -p

4 years agoMFC 359047,359054: Deprecate procfs-based process debugging.
John Baldwin [Wed, 13 May 2020 21:16:02 +0000 (21:16 +0000)]
MFC 359047,359054: Deprecate procfs-based process debugging.

359047:
Mark procfs-based process debugging as deprecated for FreeBSD 13.

Attempting to use ioctls on /proc/<pid>/mem to control a process will
trigger warnings on the console.  The <sys/pioctl.h> include file will
also now emit a compile-time warning when used from userland.

359054:
Fix the workaround to ignore the #warning for GCC.

clang and gcc use different warning flags for #warning preprocessor
directives.

For both 12 and 11, adjust the GCC warning flags to only be added in
4.7 and later since 4.2.1 does not support -Wno-cpp.  For 11, add the
needed warning suppression to procctl's build.  procctl was removed in
12.0.

4 years agoMFC r360691:
Mark Johnston [Wed, 13 May 2020 12:33:51 +0000 (12:33 +0000)]
MFC r360691:
arm: Don't enable interrupts in init_secondary().

4 years agoMFC r359166: objcopy: add new sections also when there is no .shstrtab
Ed Maste [Tue, 12 May 2020 23:51:04 +0000 (23:51 +0000)]
MFC r359166: objcopy: add new sections also when there is no .shstrtab

Previously objcopy (elfcopy) --add-sections inserted new sections before
.shstrtab, but omitted them if there was no .shstrtab.

Now, after processing existing sections add new sections if they were
not yet added.

PR: 241437
Reported by: arrowd
Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Sponsored by: The FreeBSD Foundation