]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoin_pcb: garbage collect unused structure in_pcblist
Gleb Smirnoff [Tue, 27 Apr 2021 17:43:56 +0000 (10:43 -0700)]
in_pcb: garbage collect unused structure in_pcblist

2 years agoFix cross-building on Linux/aarch64
Kyle Evans [Mon, 18 Oct 2021 02:26:47 +0000 (21:26 -0500)]
Fix cross-building on Linux/aarch64

Add necessary bits to detect ELF format on Linux/aarch64; note that
Linux calls it aarch64 where we would typically call it arm64 (uname -m)

Reviewed by: arichardson, emaste, imp
Sponsored by: Ampere Computing LLC
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D32542

2 years agolibssh: correct libssh src file list
Ed Maste [Fri, 15 Oct 2021 16:21:23 +0000 (12:21 -0400)]
libssh: correct libssh src file list

Link against the ssh-sk-helper client rather than the sk internal
implementation.

PR: 258384
Tested by: madpilot
Fixes: f448c3ed4ae1 ("openssh: Add new source files to libssl")
Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32529

2 years agoRemove POWER_PM_TYPE_APM. It's now unused.
Warner Losh [Mon, 18 Oct 2021 14:41:17 +0000 (08:41 -0600)]
Remove POWER_PM_TYPE_APM. It's now unused.

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32549

2 years agobhyve: Fix the WITH_BHYVE_SNAPSHOT build
Mark Johnston [Sat, 16 Oct 2021 17:13:26 +0000 (13:13 -0400)]
bhyve: Fix the WITH_BHYVE_SNAPSHOT build

Note, this breaks compatibility with snapshots generated by older builds
of bhyve(8).

Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: grehan, bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32523

2 years agotimecounter: Lock the timecounter list
Mark Johnston [Sat, 16 Oct 2021 13:46:55 +0000 (09:46 -0400)]
timecounter: Lock the timecounter list

Timecounter registration is dynamic, i.e., there is no requirement that
timecounters must be registered during single-threaded boot.  Loadable
drivers may in principle register timecounters (which can be switched to
automatically).  Timecounters cannot be unregistered, though this could
be implemented.

Registered timecounters belong to a global linked list.  Add a mutex to
synchronize insertions and the traversals done by (mpsafe) sysctl
handlers.  No functional change intended.

Reviewed by: imp, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32511

2 years agox86: Remove some leftover APM support
Mark Johnston [Sat, 16 Oct 2021 13:46:43 +0000 (09:46 -0400)]
x86: Remove some leftover APM support

This is obsolete since commit 8c576a279ed5 ("Remove APM BIOS support").

Reviewed by: imp, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32510

2 years agosignal: Add SIG_FOREACH and refactor issignal()
Mark Johnston [Sat, 16 Oct 2021 13:44:40 +0000 (09:44 -0400)]
signal: Add SIG_FOREACH and refactor issignal()

Add a SIG_FOREACH macro that can be used to iterate over a signal set.
This is a bit cleaner and more efficient than calling sig_ffs() in a
loop.  The implementation is based on BIT_FOREACH_ISSET(), except
that the bitset limbs are always 32 bits wide, and signal sets are
1-indexed rather than 0-indexed like bitset(9) sets.

issignal() cannot really be modified to use SIG_FOREACH() directly.
Take this opportunity to split the function into two explicit loops.
I've always found this function hard to read and think that this change
is an improvement.

Remove sig_ffs(), nothing uses it now.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32473

2 years agocpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it
Mark Johnston [Tue, 21 Sep 2021 15:36:55 +0000 (11:36 -0400)]
cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it

This implementation is faster and doesn't modify the cpuset, so it lets
us avoid some unnecessary copying as well.  No functional change
intended.

This is a re-application of commit
9068f6ea697b1b28ad1326a4c7a9ba86f08b985e.

Reviewed by: cem, kib, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32029

2 years agobitset: Reimplement BIT_FOREACH_IS(SET|CLR)
Mark Johnston [Sat, 16 Oct 2021 13:38:26 +0000 (09:38 -0400)]
bitset: Reimplement BIT_FOREACH_IS(SET|CLR)

Eliminate the nested loops and re-implement following a suggestion from
rlibby.

Add some simple regression tests.

Reviewed by: rlibby, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32472

2 years agosafexcel: Set the context record unconditionally
Mark Johnston [Mon, 18 Oct 2021 13:40:47 +0000 (09:40 -0400)]
safexcel: Set the context record unconditionally

The condition added in commit 5bdb8b273aaf excludes plain SHA
transforms, so for such sessions crypto operations would return
incorrect results.

Fixes: 5bdb8b273aaf ("safexcel: Maintain per-session context records")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoamd64: Zero the PML5 PTI page when initializing a pmap
Mark Johnston [Mon, 18 Oct 2021 13:29:20 +0000 (09:29 -0400)]
amd64: Zero the PML5 PTI page when initializing a pmap

The root page is not zeroed at allocation time since with 4-level tables
each entry is copied from a template.  However, with 5-level tables only
a single entry is filled, so the rest need to be cleared.

Reported by: alc
Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32525

2 years agostress2: Move test added by mistake
Peter Holm [Mon, 18 Oct 2021 13:30:42 +0000 (13:30 +0000)]
stress2: Move test added by mistake
Reported by: markj

2 years agostress2: Added a syzkaller reproducer
Peter Holm [Mon, 18 Oct 2021 07:39:55 +0000 (07:39 +0000)]
stress2: Added a syzkaller reproducer

2 years agocontrib/tzdata: import tzdata 2021d
Philip Paeps [Mon, 18 Oct 2021 06:19:42 +0000 (14:19 +0800)]
contrib/tzdata: import tzdata 2021d

Merge commit 'c28d35783173c0b09ca1f7e29d2565b1602f733d'

Changes: https://github.com/eggert/tz/blob/2021d/NEWS

MFC after: 3 days

2 years agoImport tzcode 2021d
Philip Paeps [Mon, 18 Oct 2021 06:17:22 +0000 (14:17 +0800)]
Import tzcode 2021d

2 years agonfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2
Rick Macklem [Mon, 18 Oct 2021 00:50:56 +0000 (17:50 -0700)]
nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2

This patch modifies the function that does the Close RPC (nfsrpc_closerpc)
so that it does not use the open_owner (nfso_own) for NFSv4.1/4.2.
Use of the seqid in the open_owner structure is only needed for NFSv4.0.
Same applies to a NFSERR_STALESTATEID reply, which should only happen
for NFSv4.0.  This allows nfsrpc_closerpc() to be called when nfso_own
is no longer valid.  This, in turn, allows nfsrpc_closerpc() to be called
after the shared lock on the clientID is released, for NFSv4.1/4.2.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after: 2 week

2 years agoTSLOG: Report final execname, not first
Colin Percival [Sun, 17 Oct 2021 20:36:38 +0000 (13:36 -0700)]
TSLOG: Report final execname, not first

In cases such as daemons launched via limits(1), a process may call
exec multiple times; the last name of the last binary executed is
usually (always?) more informative.

Fixes: 46dd801acb23 Add userland boot profiling to TSLOG
Sponsored by: https://www.patreon.com/cperciva

2 years agoBump __FreeBSD_version for LinuxKPI changes
Jessica Clarke [Sun, 17 Oct 2021 14:35:48 +0000 (15:35 +0100)]
Bump __FreeBSD_version for LinuxKPI changes

2 years agoLinuxKPI: Support lazy BAR allocation
Jessica Clarke [Sun, 17 Oct 2021 14:32:35 +0000 (15:32 +0100)]
LinuxKPI: Support lazy BAR allocation

Linux KPIs like pci_resource_start/len assume that BARs have been
allocated, but FreeBSD lazily allocates BARs if it cannot allocate the
firmware-allocated BARs. Thus using the Linux KPIs must force allocation
of the BARs rather than returning 0 for the start and length, which can
crash drm-kmod drivers that assume the BARs are valid. This is needed
for the AMDGPU driver to be able to attach on SiFive's HiFive Unmatched.

Reviewed by: hselasky, jhb, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32447

2 years agoLinuxKPI: Implement _ioremap_attr for riscv
Jessica Clarke [Sun, 17 Oct 2021 14:32:20 +0000 (15:32 +0100)]
LinuxKPI: Implement _ioremap_attr for riscv

Now that riscv implements pmap_mapdev_attr we can enable the non-stub
implementation for riscv, which is needed for drm-kmod to not fail at
run time for drivers that need to map I/O regions.

Reviewed by: hselasky, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32446

2 years agoriscv: Implement pmap_mapdev_attr
Jessica Clarke [Sun, 17 Oct 2021 14:31:35 +0000 (15:31 +0100)]
riscv: Implement pmap_mapdev_attr

This is needed for LinuxKPI's _ioremap_attr. This reuses the generic
implementation introduced for aarch64, and itself requires implementing
pmap_kenter, which is trivial to do given riscv currently treats all
mapping attributes the same due to the Svpbmt extension not yet being
ratified and in hardware.

Reviewed by: markj, mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32445

2 years agoMake vmdaemon timeout configurable
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:48:50 +0000 (13:48 +0100)]
Make vmdaemon timeout configurable

Make vmdaemon timeout configurable, so that one can adjust
how often it runs.

Here's a trick: set this to 1, then run 'limits -m 0 sh',
then run whatever you want with 'ktrace -it XXX', and observe
how the working set changes over time.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D22038

2 years agoprocfs: Document as deprecated
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:44:19 +0000 (13:44 +0100)]
procfs: Document as deprecated

Update the procfs(5) man page to clarify that it's deprecated.

Reviewed By: bcr, 0mp (earlier version)
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D22275

2 years agolinux: recognize TCP_INFO and ratelimit the warning
Edward Tomasz Napierala [Sun, 17 Oct 2021 12:19:05 +0000 (13:19 +0100)]
linux: recognize TCP_INFO and ratelimit the warning

This ratelimits the "unsupported getsockopt level 6 optname 11"
warnings that happen all the time when watching Netflix.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32454

2 years agolinux: Improve debugging for PTRACE_GETREGSET
Edward Tomasz Napierala [Sun, 17 Oct 2021 11:52:39 +0000 (12:52 +0100)]
linux: Improve debugging for PTRACE_GETREGSET

It's triggered by gdb(1).

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32456

2 years agolinux: Implement some bits of PTRACE_PEEKUSER
Edward Tomasz Napierala [Sun, 17 Oct 2021 11:20:16 +0000 (12:20 +0100)]
linux: Implement some bits of PTRACE_PEEKUSER

This makes Linux gdb from Bionic a little less broken.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32455

2 years agolinux: Adjust PTRACE_GET_SYSCALL_INFO buffer size semantics
Edward Tomasz Napierala [Sun, 17 Oct 2021 10:49:42 +0000 (11:49 +0100)]
linux: Adjust PTRACE_GET_SYSCALL_INFO buffer size semantics

The tests/ptrace_syscall_info test from strace(1) complained
about this.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32368

2 years agolinux: Partially implement TCSBRK
Edward Tomasz Napierala [Sun, 17 Oct 2021 10:19:51 +0000 (11:19 +0100)]
linux: Partially implement TCSBRK

This fixes tcflush(3), unbreaking cheribuild.py under arm64 Focal.

Reviewed By: imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32291

2 years agocache: only assert on flags when dealing with EMPTYPATH
Mateusz Guzik [Sun, 17 Oct 2021 08:40:16 +0000 (10:40 +0200)]
cache: only assert on flags when dealing with EMPTYPATH

Reported by: syzbot+bd48ee0843206a09e6b8@syzkaller.appspotmail.com
Fixes: 7dd419cabc6bb9e0 ("cache: add empty path support")

2 years agomixer.8: Document -h
Mateusz Piotrowski [Sun, 17 Oct 2021 08:02:15 +0000 (10:02 +0200)]
mixer.8: Document -h

2 years agortld: Support DT_RELR relative relocation format
Fangrui Song [Sat, 16 Oct 2021 21:34:37 +0000 (14:34 -0700)]
rtld: Support DT_RELR relative relocation format

PIE and shared objects usually have many relative relocations. In
2017/2018, a compact relative relocation format RELR was proposed on
https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/GxjM0L-PBAAJ
("Proposal for a new section type SHT_RELR") and is a pre-standard.
RELR usually takes 3% or smaller space than R_*_RELATIVE relocations.
The virtual memory size of a mostly statically linked PIE is typically
5~10% smaller.

ld.lld --pack-dyn-relocs=relr emits RELR relocations. DT_RELR has been
adopted by Android bionic, Linux kernel's arm64 port, Chrome OS (patched
glibc).

This patch adds DT_RELR support to FreeBSD rtld-elf.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32524

2 years agosys: Add definitions for RELR relative relocation format
Fangrui Song [Sat, 16 Oct 2021 21:31:42 +0000 (14:31 -0700)]
sys: Add definitions for RELR relative relocation format

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32526

2 years agopf: don't drop packets when redirection information comes from a state
Kristof Provost [Sat, 16 Oct 2021 16:53:39 +0000 (18:53 +0200)]
pf: don't drop packets when redirection information comes from a state

For some traffic there might be no matching rule in the current ruleset,
for example when a state was imported via pfsync from a sytem with a
different ruleset checksum. In this case pf_route uses s->rt_addr for
routing target instead of r->rpool.cur but r->rpool is checked anyway,
resulting in dropped packets.

PR: 259183
Submitted by: Kajetan Staszkiewicz <vegeta tuxpowered.net>
Sponsored by: InnoGames GmbH

2 years agonfscl: Move release of the clientID lock into nfscl_doclose()
Rick Macklem [Sat, 16 Oct 2021 22:49:38 +0000 (15:49 -0700)]
nfscl: Move release of the clientID lock into nfscl_doclose()

This patch moves release of the shared clientID lock from nfsrpc_close()
just after the nfscl_doclose() call to the end of nfscl_doclose() call.
This does make the code cleaner, since the shared lock is acquired at
the beginning of nfscl_doclose().  The only semantics change is that
the code no longer drops and reaquires the NFSCLSTATELOCK() mutex,
which I do not believe will have a negative effect on the NFSv4 client.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after: 2 week

2 years agollvm-readobj: Add missed source file
Dimitry Andric [Sat, 16 Oct 2021 21:16:46 +0000 (23:16 +0200)]
llvm-readobj: Add missed source file

In some configurations (e.g. powerpc64) the llvm-readobj tool also needs
contrib/llvm-project/llvm/BinaryFormat/MsgPackWriter.cpp, so add it to
libllvm.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
Fixes: 1b85b68da0b2

2 years agocache: add empty path support
Mateusz Guzik [Sun, 26 Sep 2021 13:00:24 +0000 (15:00 +0200)]
cache: add empty path support

This avoids spurious drop offs as EMPTY is passed regardless of the
actual path name.

Pushign the work inside the lookup instead of just ignorign the flag
allows avoid checking for empty pathname for all other lookups.

2 years agoAdd userland boot profiling to TSLOG
Colin Percival [Sat, 16 Oct 2021 18:47:34 +0000 (11:47 -0700)]
Add userland boot profiling to TSLOG

On kernels compiled with 'options TSLOG', record for each process ID:
* The timestamp of the fork() which creates it and the parent
process ID,
* The first path passed to execve(), if any,
* The first path resolved by namei, if any, and
* The timestamp of the exit() which terminates the process.

Expose this information via a new sysctl, debug.tslog_user.

On kernels lacking 'options TSLOG' (the default), no information is
recorded and the sysctl does not exist.

Note that recording namei is needed in order to obtain the names of
rc.d scripts being launched, as the rc system sources them in a
subshell rather than execing the scripts.

With this commit it is now possible to generate flamecharts of the
entire boot process from the start of the loader to the end of
/etc/rc.  The code needed to perform this processing is currently
found in github: https://github.com/cperciva/freebsd-boot-profiling

Reviewed by: mhorne
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D32493

2 years agopf: selecting pf_map_addr is not an error
Kristof Provost [Sat, 16 Oct 2021 07:32:15 +0000 (09:32 +0200)]
pf: selecting pf_map_addr is not an error

When a redirection/nat IP address is selected by pf_map_addr it is
logged with PF_DEBUG_MISC level. This one according to the manual means
"Generate debug messages for various errors". Selecting an IP address is
not an error, it's a normal function of pf for route-to, nat and some
other operations. Therefore PF_DEBUG_NOISY level should be choosen which
is means "Generate debug messages for common conditions".

PR: 259184
Submitted by: Kajetan Staszkiewicz <vegeta tuxpowered.net>
Sponsored by: InnoGames GmbH

2 years agomixer(8): Add -h option to show usage.
Hans Petter Selasky [Sat, 16 Oct 2021 08:39:18 +0000 (10:39 +0200)]
mixer(8): Add -h option to show usage.

Differential Revision: https://reviews.freebsd.org/D32508
Submitted by: christos@
Sponsored by: NVIDIA Networking

2 years agoFix two typos in source code comments
Gordon Bergling [Sat, 16 Oct 2021 06:09:31 +0000 (08:09 +0200)]
Fix two typos in source code comments

- s/alocated/allocated/
- s/realocated/reallocated/

MFC after: 3 days

2 years agoFix fragmented UDP packets handling since rev.360967.
Maxim Sobolev [Thu, 7 Oct 2021 20:41:40 +0000 (13:41 -0700)]
Fix fragmented UDP packets handling since rev.360967.

Consider IP_MF flag when checking length of the UDP packet to
match the declared value.

Sponsored by: Sippy Software, Inc.
Differential Revision: https://reviews.freebsd.org/D32363
MFC after: 2 weeks

2 years agontp: Revert "Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV."
Cy Schubert [Mon, 16 Aug 2021 15:05:50 +0000 (08:05 -0700)]
ntp: Revert "Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV."

This reverts commit 55263180628a386ad38b4b6621919220b137f770 because the
underlying problem was fixed by 889b56c8cd84c9a9f2d9e3b019c154d6f14d9021.

MFC after: 1 month

2 years agontp: Revert "Disable stack gap for ntpd during build."
Cy Schubert [Mon, 16 Aug 2021 14:46:31 +0000 (07:46 -0700)]
ntp: Revert "Disable stack gap for ntpd during build."

This reverts commit af949c590bd8a00a5973b5875d7e0fa6832ea64a because
889b56c8cd84c9a9f2d9e3b019c154d6f14d9021 fixes the underlying problem.

MFC after: 1 month

2 years agopf tests: ensure that $nr expansion is correct
Kristof Provost [Sun, 3 Oct 2021 16:07:04 +0000 (18:07 +0200)]
pf tests: ensure that $nr expansion is correct

Test the $nr expansion in labels is correct, even if the optimiser
reduces the rule count.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32489

2 years agopfctl: delay label macro expansion until after rule optimisation
Kristof Provost [Wed, 13 Oct 2021 14:06:47 +0000 (16:06 +0200)]
pfctl: delay label macro expansion until after rule optimisation

We used to expand the $nr macro in labels into the rule number prior to
the optimisation step. This would occasionally produce incorrect rule
numbers in the labels.

Delay all macro expansion until after the optimisation step to ensure
that we expand the correct values.

MFC after: 1 week
Reported by: Özkan KIRIK <ozkan.kirik@gmail.com>
Differential Revision: https://reviews.freebsd.org/D32488

2 years agonfscl: Add an argument to nfscl_tryclose()
Rick Macklem [Fri, 15 Oct 2021 21:25:38 +0000 (14:25 -0700)]
nfscl: Add an argument to nfscl_tryclose()

This patch adds a new argument to nfscl_tryclose() to indicate
whether or not it should loop when a NFSERR_DELAY reply is received
from the NFSv4 server.  Since this new argument is always passed in
as "true" at this time, no semantics change should occur.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after: 2 week

2 years agoAdd libcbor to the build
Ed Maste [Thu, 7 Oct 2021 00:42:40 +0000 (20:42 -0400)]
Add libcbor to the build

From https://github.com/PJK/libcbor:

    libcbor is a C library for parsing and generating CBOR, the general-
    purpose schema-less binary data format.

libcbor will be used by ssh to support FIDO/U2F keys.  It is currently
intended only for use by ssh, and so is installed as a PRIVATELIB and is
placed in the ssh pkgbase package.

cbor_export.h and configuration.h were generated by the upstream CMake
build.  We could create them with bmake rules instead (as NetBSD has
done) but this is a fine start.

This is currently disabled for the 32-bit library build as libfido2 is
not compatible with the COMPAT_32BIT hack in usb_ioctl.h, and there is
no need for libcbor without libfido2.

Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32347

2 years agomixer(8): Print usage to standard error.
Hans Petter Selasky [Fri, 15 Oct 2021 13:56:00 +0000 (15:56 +0200)]
mixer(8): Print usage to standard error.

Differential Revision: https://reviews.freebsd.org/D32507
Submitted by: christos@
Sponsored by: NVIDIA Networking

2 years agomixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices.
Hans Petter Selasky [Fri, 15 Oct 2021 09:11:44 +0000 (11:11 +0200)]
mixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices.

In some cases when passing /dev/dspX.vpY as mixer devices, m->ci.longname and
m->ci.hw_info will be empty. Don't print any brackets and parentheses
in this case.

Differential Revision: https://reviews.freebsd.org/D32500
Submitted by: christos@
Sponsored by: NVIDIA Networking

2 years agolibthr: Use kern.stacktop for thread stack calculation.
Dawid Gorecki [Wed, 13 Oct 2021 19:06:05 +0000 (21:06 +0200)]
libthr: Use kern.stacktop for thread stack calculation.

Use the new kern.stacktop sysctl to retrieve the address of stack top
instead of kern.usrstack. kern.usrstack does not have any knowledge
of the stack gap, so this can cause problems with thread stacks.
Using kern.stacktop sysctl should fix most of those problems.
kern.usrstack is used as a fallback when kern.stacktop cannot be read.

Rename usrstack variables to stacktop to reflect this change.

Fixes problems with firefox and thunderbird not starting with
stack gap enabled.

PR: 239873
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31898

2 years agokern_exec: Add kern.stacktop sysctl.
Dawid Gorecki [Wed, 13 Oct 2021 19:03:37 +0000 (21:03 +0200)]
kern_exec: Add kern.stacktop sysctl.

With stack gap enabled top of the stack is moved down by a random
amount of bytes. Because of that some multithreaded applications
which use kern.usrstack sysctl to calculate address of stacks for
their threads can fail. Add kern.stacktop sysctl, which can be used
to retrieve address of the stack after stack gap is applied to it.
Returns value identical to kern.usrstack for processes which have
no stack gap.

Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31897

2 years agosetrlimit: Take stack gap into account.
Dawid Gorecki [Wed, 13 Oct 2021 19:01:08 +0000 (21:01 +0200)]
setrlimit: Take stack gap into account.

Calling setrlimit with stack gap enabled and with low values of stack
resource limit often caused the program to abort immediately after
exiting the syscall. This happened due to the fact that the resource
limit was calculated assuming that the stack started at sv_usrstack,
while with stack gap enabled the stack is moved by a random number
of bytes.

Save information about stack size in struct vmspace and adjust the
rlim_cur value. If the rlim_cur and stack gap is bigger than rlim_max,
then the value is truncated to rlim_max.

PR: 253208
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31516

2 years agobhyve: ignore low bits of CFGADR
Corvin Köhne [Fri, 15 Oct 2021 07:25:54 +0000 (09:25 +0200)]
bhyve: ignore low bits of CFGADR

Bhyve could emulate wrong PCI registers.
In the best case, the guest reads wrong registers and the device driver would
report some errors.
In the worst case, the guest writes to wrong PCI registers and could brick
hardware when using PCI passthrough.

According to Intels specification, low bits of CFGADR should be
ignored. Some OS like linux may rely on it. Otherwise, bhyve could
emulate a wrong PCI register.

E.g.
If linux would like to read 2 bytes from offset 0x02, following would
happen.
linux:
outl 0x80000002 at CFGADR
inw  at CFGDAT + 2
bhyve:
cfgoff = 0x80000002 & 0xFF = 0x02
coff   = cfgoff + (port - CFGDAT) = 0x02 + 0x02 = 0x04
Bhyve would emulate the register at offset 0x04 not 0x02.

Reviewed By: #bhyve, grehan
Differential Revision: https://reviews.freebsd.org/D31819
Sponsored by:        Beckhoff Automation GmbH & Co. KG

2 years agonfscl: Restructure nfscl_freeopen() slightly
Rick Macklem [Fri, 15 Oct 2021 00:28:01 +0000 (17:28 -0700)]
nfscl: Restructure nfscl_freeopen() slightly

This patch factors the unlinking of the nfsclopen structure out of
nfscl_freeopen() into a separate function called nfscl_unlinkopen().
It also adds a new argument to nfscl_freeopen() to conditionally do
the unlink.  Since this new argument is always passed in as "true"
at this time, no semantics change should occur.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after: 2 week

2 years agoktls: Defer creation of threads and zones until first use.
John Baldwin [Thu, 14 Oct 2021 22:48:34 +0000 (15:48 -0700)]
ktls: Defer creation of threads and zones until first use.

Run ktls_init() when the first KTLS session is created rather than
unconditionally during boot.  This avoids creating unused threads and
allocating unused resources on systems which do not use KTLS.

Reviewed by: gallatin, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32487

2 years agoFix typo in comment
Konstantin Belousov [Thu, 14 Oct 2021 20:03:36 +0000 (23:03 +0300)]
Fix typo in comment

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoStyle
Konstantin Belousov [Thu, 14 Oct 2021 19:30:18 +0000 (22:30 +0300)]
Style

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agocxgbe: Only run ktls_tick when NIC TLS is enabled.
John Baldwin [Thu, 14 Oct 2021 17:59:16 +0000 (10:59 -0700)]
cxgbe: Only run ktls_tick when NIC TLS is enabled.

Previously the body of ktls_tick was a nop when NIC TLS was disabled,
but the callout was still scheduled consuming power on otherwise-idle
systems with Chelsio T6 adapters.  Now the callout only runs while NIC
TLS is enabled on at least one interface of an adapter.

Reported by: mav
Reviewed by: np, mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32491

2 years agoFix a syntax error in 1b85b68da0b2
Alex Richardson [Thu, 14 Oct 2021 16:44:13 +0000 (17:44 +0100)]
Fix a syntax error in 1b85b68da0b2

Reported by: Michael Butler, jenkins

2 years agollvm-readobj: Attach to buildsystem
Cameron Katri [Thu, 14 Oct 2021 16:00:27 +0000 (17:00 +0100)]
llvm-readobj: Attach to buildsystem

Also install it as readelf when MK_LLVM_BINUTILS is set.

Reviewed By: dim, arichardson
Differential Revision: https://reviews.freebsd.org/D32058

2 years agopowerpc64: make radix with superpages default
Leandro Lupori [Thu, 14 Oct 2021 16:13:27 +0000 (13:13 -0300)]
powerpc64: make radix with superpages default

As Radix MMU with superpages enabled is now stable, make it the
default choice on supported hardware (POWER9 and above), since its
performance is greater than that of HPT MMU.

Reviewed by: alfredo, jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30797

2 years agoFix RISC-V build
Li-Wen Hsu [Thu, 14 Oct 2021 15:20:12 +0000 (23:20 +0800)]
Fix RISC-V build

Fixes: d5fd5cdc063

2 years agonvme: Reduce traffic to the doorbell register
Warner Losh [Thu, 14 Oct 2021 14:44:37 +0000 (08:44 -0600)]
nvme: Reduce traffic to the doorbell register

Reduce traffic to doorbell register when processing multiple completion
events at once. Only write it at the end of the loop after we've
processed everything (assuming we found at least one completion,
even if that completion wasn't valid).

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D32470

2 years agopowerpc64: fix OFWFB with Radix MMU
Leandro Lupori [Thu, 14 Oct 2021 13:39:52 +0000 (10:39 -0300)]
powerpc64: fix OFWFB with Radix MMU

Current implementation of Radix MMU doesn't support mapping
arbitrary virtual addresses, such as the ones generated by
"direct mapping" I/O addresses. This caused the system to hang, when
early I/O addresses, such as those used by OpenFirmware Frame Buffer,
were remapped after the MMU was up.

To avoid having to modify mmu_radix_kenter_attr just to support this
use case, this change makes early I/O map use virtual addresses from
KVA area instead (similar to what mmu_radix_mapdev_attr does), as
these can be safely remapped later.

Reviewed by: alfredo (earlier version), jhibbits (in irc)
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31232

2 years agong_ppp(4): Fix a typo in a comment
Gordon Bergling [Thu, 14 Oct 2021 13:30:32 +0000 (15:30 +0200)]
ng_ppp(4): Fix a typo in a comment

- s/delcared/declared/

MFC after: 3 days

2 years agounionfs: Ensure SAVENAME is set for unionfs vnode operations
Jason A. Harmening [Sun, 26 Sep 2021 02:56:04 +0000 (19:56 -0700)]
unionfs: Ensure SAVENAME is set for unionfs vnode operations

"rm-style" system calls such as kern_frmdirat() and kern_funlinkat()
don't supply SAVENAME to preserve the pathname buffer for subsequent
vnode ops.  For unionfs this poses an issue because the pathname may
be needed for a relookup operation in unionfs_remove()/unionfs_rmdir().
Currently unionfs doesn't check for this case, leading to a panic on
DIAGNOSTIC kernels and use-after-free of cn_nameptr otherwise.

The unionfs node's stored buffer would suffice as a replacement for
cnp->cn_nameptr in some (but not all) cases, but it's cleaner to just
ensure that unionfs vnode ops always have a valid cn_nameptr by setting
SAVENAME in unionfs_lookup().

While here, do some light cleanup in unionfs_lookup() and assert that
HASBUF is always present in the relevant relookup calls.

Reported by: pho
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32148

2 years agoselsocket: handle sopoll() errors correctly
Brooks Davis [Wed, 13 Oct 2021 23:43:06 +0000 (00:43 +0100)]
selsocket: handle sopoll() errors correctly

Without this change, unmounting smbfs filesystems with an INVARIANTS
kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb.

Found by: markj
Reviewed by: markj, jhb
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D32492

2 years agobpf(4): Fix a misnamed constant
Felix Johnson [Wed, 13 Oct 2021 23:00:41 +0000 (19:00 -0400)]
bpf(4): Fix a misnamed constant

rarpd.c was modified in r19859 to use REVARP_REQUEST instead of
ARPOP_REVREQUEST.

PR: 183333
MFC after: 3 days
Reported by: pluknet <pluknet@gmail.com>

2 years agonfscl: Make nfscl_getlayout() acquire the correct pNFS layout
Rick Macklem [Wed, 13 Oct 2021 22:48:54 +0000 (15:48 -0700)]
nfscl: Make nfscl_getlayout() acquire the correct pNFS layout

Without this patch, if a pNFS read layout has already been acquired
for a file, writes would be redirected to the Metadata Server (MDS),
because nfscl_getlayout() would not acquire a read/write layout for
the file.  This happened because there was no "mode" argument to
nfscl_getlayout() to indicate whether reading or writing was being done.
Since doing I/O through the Metadata Server is not encouraged for some
pNFS servers, it is preferable to get a read/write layout for writes
instead of redirecting the write to the MDS.

This patch adds a access mode argument to nfscl_getlayout() and
nfsrpc_getlayout(), so that nfscl_getlayout() knows to acquire a read/write
layout for writing, even if a read layout has already been acquired.
This patch only affects NFSv4.1/4.2 client behaviour when pNFS ("pnfs" mount
option against a server that supports pNFS) is in use.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

MFC after: 2 week

2 years agoTemporarily skip sys.netgraph.hub.loop on RISC-V in CI
Li-Wen Hsu [Wed, 13 Oct 2021 21:31:22 +0000 (05:31 +0800)]
Temporarily skip sys.netgraph.hub.loop on RISC-V in CI

This case panics kernel.

PR: 259157
Sponsored by: The FreeBSD Foundation

2 years agorelease: add _LOCATION to the list of required AZURE variables
Glen Barber [Wed, 13 Oct 2021 21:11:48 +0000 (17:11 -0400)]
release: add _LOCATION to the list of required AZURE variables

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agorelease: use tab-delimited variables in AZURE_UPLOAD_CONF
Glen Barber [Wed, 13 Oct 2021 20:39:10 +0000 (16:39 -0400)]
release: use tab-delimited variables in AZURE_UPLOAD_CONF

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoktls: Ensure FIFO encryption order for TLS 1.0.
John Baldwin [Wed, 13 Oct 2021 19:30:15 +0000 (12:30 -0700)]
ktls: Ensure FIFO encryption order for TLS 1.0.

TLS 1.0 records are encrypted as one continuous CBC chain where the
last block of the previous record is used as the IV for the next
record.  As a result, TLS 1.0 records cannot be encrypted out of order
but must be encrypted as a FIFO.

If the later pages of a sendfile(2) request complete before the first
pages, then TLS records can be encrypted out of order.  For TLS 1.1
and later this is fine, but this can break for TLS 1.0.

To cope, add a queue in each TLS session to hold TLS records that
contain valid unencrypted data but are waiting for an earlier TLS
record to be encrypted first.

- In ktls_enqueue(), check if a TLS record being queued is the next
  record expected for a TLS 1.0 session.  If not, it is placed in
  sorted order in the pending_records queue in the TLS session.

  If it is the next expected record, queue it for SW encryption like
  normal.  In addition, check if this new record (really a potential
  batch of records) was holding up any previously queued records in
  the pending_records queue.  Any of those records that are now in
  order are also placed on the queue for SW encryption.

- In ktls_destroy(), free any TLS records on the pending_records
  queue.  These mbufs are marked M_NOTREADY so were not freed when the
  socket buffer was purged in sbdestroy().  Instead, they must be
  freed explicitly.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32381

2 years agoktls: Reject attempts to enable AES-CBC with TLS 1.3.
John Baldwin [Wed, 13 Oct 2021 19:12:58 +0000 (12:12 -0700)]
ktls: Reject attempts to enable AES-CBC with TLS 1.3.

AES-CBC cipher suites are not supported in TLS 1.3.

Reported by: syzbot+ab501c50033ec01d53c6@syzkaller.appspotmail.com
Reviewed by: tuexen, markj
Differential Revision: https://reviews.freebsd.org/D32404

2 years agoRemove in_ifaddr_lock acquisiton to access in_ifaddrhead.
Gleb Smirnoff [Fri, 8 Oct 2021 19:56:24 +0000 (12:56 -0700)]
Remove in_ifaddr_lock acquisiton to access in_ifaddrhead.

An IPv4 address is embedded into an ifaddr which is freed
via epoch. And the in_ifaddrhead is already a CK list. Use
the network epoch to protect against use after free.

Next step would be to CK-ify the in_addr hash and get rid of the...

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D32434

2 years agomount: Check for !VDIR mount points before handling -o emptydir
Mark Johnston [Wed, 13 Oct 2021 00:11:02 +0000 (20:11 -0400)]
mount: Check for !VDIR mount points before handling -o emptydir

To implement -o emptydir, vfs_emptydir() checks that the passed
directory is empty.  This should be done after checking whether the
vnode is of type VDIR, though, or vfs_emptydir() may end up calling
VOP_READDIR on a non-directory.

Reported by: syzbot+4006732c69fb0f792b2c@syzkaller.appspotmail.com
Reviewed by: kib, imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32475

2 years agortld: Do not install libmap.conf when installing the COMPAT32 version
Emmanuel Vadot [Wed, 13 Oct 2021 12:40:26 +0000 (14:40 +0200)]
rtld: Do not install libmap.conf when installing the COMPAT32 version

This has the effect of installing the same file twice at the same location
and confuse pkgbase as we add this file twice in the package config part.

MFC after:  1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agopf: Introduce pf_nvbool()
Kristof Provost [Wed, 13 Oct 2021 09:00:46 +0000 (11:00 +0200)]
pf: Introduce pf_nvbool()

Similar to the existing functions for strings and ints, this lets us
simplify some of the nvlist conversion code.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agonative-xtools: avoid libllvm while populating the sysroot
Kyle Evans [Wed, 13 Oct 2021 09:21:28 +0000 (04:21 -0500)]
native-xtools: avoid libllvm while populating the sysroot

Prior to 021385aba562, MK_CLANG=no was sufficient to avoid descending
into lib/clang, but the referenced change added a couple of other
enabling knobs. Turn those off, too, to continue avoiding libllvm.

With this change, we no longer end up with a libllvm using the wrong
default target triple; `poudriere jail -cx` works once again.

Reported by: bhughes, imp, probably others
Fixes: 021385aba562 ("Add WITH_LLVM_BINUTILS to install LLVM ...")

2 years agoAllow the BPF to be select for write. This is needed for boost:asio
Hartmut Brandt [Sun, 10 Oct 2021 15:03:51 +0000 (17:03 +0200)]
Allow the BPF to be select for write. This is needed for boost:asio
which otherwise fails to handle BPFs.
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D31967

2 years agobhyve: Update usage and synopsis for the -k flag
Mateusz Piotrowski [Tue, 12 Oct 2021 19:49:43 +0000 (21:49 +0200)]
bhyve: Update usage and synopsis for the -k flag

Let's make it clear to users that -k is for configuration files.
Also, point to bhyve_config(5) in the paragraph describing the flag.

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32467

2 years agoacpi(4): Correct outdated sysctl
Felix Johnson [Wed, 13 Oct 2021 00:42:14 +0000 (20:42 -0400)]
acpi(4): Correct outdated sysctl

This changes the location of cx_supported sysctl to dev.cpu.N.

PR: 214370
MFC after: 3 days

2 years agortld direct exec: add -d option
Konstantin Belousov [Mon, 11 Oct 2021 22:26:54 +0000 (01:26 +0300)]
rtld direct exec: add -d option

to ignore lack of execute permission on the binary.  The check is a
bad security theatre anyway.

Reviewed by: arichardson, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

2 years agonfscl: Fix another deadlock related to the NFSv4 clientID lock
Rick Macklem [Wed, 13 Oct 2021 00:21:01 +0000 (17:21 -0700)]
nfscl: Fix another deadlock related to the NFSv4 clientID lock

Without this patch, it is possible to hang the NFSv4 client,
when a rename/remove is being done on a file where the client
holds a delegation, if pNFS is being used.  For a delegation
to be returned, dirty data blocks must be flushed to the NFSv4
server.  When pNFS is in use, a shared lock on the clientID
must be acquired while doing a write to the DS(s).
However, if rename/remove is doing the delegation return
an exclusive lock will be acquired on the clientID, preventing
the write to the DS(s) from acquiring a shared lock on the clientID.

This patch stops rename/remove from doing a delegation return
if pNFS is enabled.  Since doing delegation return in the same
compound as rename/remove is only an optimization, not doing
so should not cause problems.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

MFC after: 1 week

2 years agocrt_malloc: Be more persistent when handling mmap() failure
Konstantin Belousov [Mon, 11 Oct 2021 16:13:31 +0000 (19:13 +0300)]
crt_malloc: Be more persistent when handling mmap() failure

In the situation with limited address space, together with
fragmentation, it is possible for mmap() request in morecore() to fail
when asking for required size + NPOOLPAGES, but succeed without the
addend.  Retry allocation there.

PR: 259076
Reported by: Denis Koreshkov <dynamic-wind@mail.ru>
Reviewed by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32474

2 years agocrt_malloc: use uintptr_t instead of long for arithmetic on addresses
Konstantin Belousov [Tue, 12 Oct 2021 21:39:07 +0000 (00:39 +0300)]
crt_malloc: use uintptr_t instead of long for arithmetic on addresses

and avoid unneeded casts

Reviewed by: arichardson (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32474

2 years agoStop creating socket aio kprocs during boot.
John Baldwin [Tue, 12 Oct 2021 21:03:07 +0000 (14:03 -0700)]
Stop creating socket aio kprocs during boot.

Create the initial pool of kprocs on demand when the first socket AIO
request is submitted instead.  The pool of kprocs used for other AIO
requests is similarly created on first use.

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32468

2 years agonvme: Restore hotplug warning
Warner Losh [Tue, 12 Oct 2021 20:25:16 +0000 (14:25 -0600)]
nvme: Restore hotplug warning

Restore hotplug warning in recovery state machine. No functional change
other than what message gets printed.

Sponsored by: Netflix

2 years agopthread_np.3: Add a manpage summarizing all of the pthread extensions.
Felix Johnson [Thu, 7 Oct 2021 17:45:21 +0000 (10:45 -0700)]
pthread_np.3: Add a manpage summarizing all of the pthread extensions.

PR: 197299
MFC after: 1 week

2 years agoRestore PPS_SYNC in NOTES
Konstantin Belousov [Mon, 11 Oct 2021 22:02:35 +0000 (01:02 +0300)]
Restore PPS_SYNC in NOTES

This partially reverts e81e77c5a055, leaving the option both in
GENERICs on amd64/arm64/arm, and in global NOTES file.  Apparently
this better matches existing practice, where we do not try to hard
to make LINT and GENERIC complimentary.

Requested and reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoPrevent repeated deallocation of a resource.
Ruslan Bukin [Tue, 12 Oct 2021 19:13:44 +0000 (20:13 +0100)]
Prevent repeated deallocation of a resource.
Also deactivate resource if needed.

Discussed with: jrtc27
Differential Revision: https://reviews.freebsd.org/D32458

2 years agobhyve.8: Fix markup of the -G flag
Mateusz Piotrowski [Tue, 12 Oct 2021 14:06:52 +0000 (16:06 +0200)]
bhyve.8: Fix markup of the -G flag

2 years agoStop reading the arm64 domain when it's known
Andrew Turner [Tue, 12 Oct 2021 11:39:14 +0000 (12:39 +0100)]
Stop reading the arm64 domain when it's known

There is no need to read the domain on arm64 when there is only one
in the ACPI tables. This can also happen when the table is missing
as it is unneeded.

Reported by: dch
Sponsored by: The FreeBSD Foundation

2 years agokqueue(9): correct spelling of kn_fop
Kyle Evans [Sun, 3 Oct 2021 15:59:52 +0000 (10:59 -0500)]
kqueue(9): correct spelling of kn_fop

2 years agofifos: delegate unhandled kqueue filters to underlying filesystem
Kyle Evans [Sat, 2 Oct 2021 05:23:03 +0000 (00:23 -0500)]
fifos: delegate unhandled kqueue filters to underlying filesystem

This gives the vfs layer a chance to provide handling for EVFILT_VNODE,
for instance.  Change pipe_specops to use the default vop_kqfilter to
accommodate fifoops that don't specify the method (i.e. all in-tree).

Based on a patch by Jan Kokemüller.

PR: 225934
Reviewed by: kib, markj (both pre-KASSERT)
Differential Revision: https://reviews.freebsd.org/D32271

2 years agostress2: Use two memory disks for this test
Peter Holm [Tue, 12 Oct 2021 06:45:19 +0000 (06:45 +0000)]
stress2: Use two memory disks for this test

2 years agonfscl: Fix a deadlock related to the NFSv4 clientID lock
Rick Macklem [Tue, 12 Oct 2021 04:58:24 +0000 (21:58 -0700)]
nfscl: Fix a deadlock related to the NFSv4 clientID lock

Without this patch, it is possible for a process doing an NFSv4
Open/create of a file to block to allow another process
to acquire the exclusive lock on the clientID when holding
a shared lock on the clientID.  As such, both processes
deadlock, with one wanting the exclusive lock, while the
other holds the shared lock.  This deadlock is unlikely to occur
unless delegations are in use on the NFSv4 mount.

This patch fixes the problem by not deferring to the process
waiting for the exclusive lock when a shared lock (reference cnt)
is already held by the process.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

MFC after: 1 week

2 years agoSkip sys.net.if_lagg_test.status_stress in CI
Li-Wen Hsu [Mon, 11 Oct 2021 21:40:24 +0000 (05:40 +0800)]
Skip sys.net.if_lagg_test.status_stress in CI

This case panics the machine fairly often and we should run
stress tests separately.

Sponsored by: The FreeBSD Foundation

2 years agoforward declare struct thread
Warner Losh [Mon, 11 Oct 2021 18:59:39 +0000 (12:59 -0600)]
forward declare struct thread

sys/sysctl.h moved struct thread forward declaration under #ifdef
_KERNEL and so this header fails when included from userland. Add a
forward declaration here.

Fixes:       99eefc727eba
Sponsored by: Netflix