FreeBSD/src 76d756erelease Makefile.vm

Makefile.vm: Split error condition

Make it clear which of two possible cases applies.

Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D56837
DeltaFile
+4-3release/Makefile.vm
+4-31 files

FreeBSD/src bc9f667usr.sbin/bhyve pci_virtio_scsi.c

bhyve/virtio-scsi: Don't invoke iov_to_buf() in an assert() expression

If anyone would build bhyve with -DNDEBUG, any code in the expression
in assert() won't be executed.  Instead put the return value in a
temporary variable to assert that it has the expected value.

Reviewed by: emaste, markj (earlier version)
Fixes: 2a514d377b37 ("bhyve/virtio-scsi: Preallocate all I/O requests")
Differential Revision: https://reviews.freebsd.org/D55803
DeltaFile
+4-2usr.sbin/bhyve/pci_virtio_scsi.c
+4-21 files

FreeBSD/src 0ae114fusr.bin/lockf/tests lockf_test.sh

lockf: Test that lockf does not spin on fd

Approved by:    re (cperciva)
PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56723

(cherry picked from commit 0733afdb4dad58cfe7ad7f5994e26bf148d78199)
(cherry picked from commit 8e5f92b6b22c82af1192575781788eb2c8fed448)
DeltaFile
+18-0usr.bin/lockf/tests/lockf_test.sh
+18-01 files

FreeBSD/src d0f618eusr.bin/lockf lockf.c

lockf: Avoid spinning when operating on an fd

When operating on a file descriptor, acquire_lock() would ignore the
flags argument and always operate in non-blocking mode, resulting in
unnecessary busy-looping.

Approved by:    re (cperciva)
PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56722

(cherry picked from commit d90513ea85693da0ca5955173609f4e81e38ae16)
(cherry picked from commit 651b82e64ef4f753d8f4c1793f359de39744526c)
DeltaFile
+5-1usr.bin/lockf/lockf.c
+5-11 files

FreeBSD/src c4be32ausr.bin/tail reverse.c

tail(1): Fix -r (reverse) to work on pseudo filesystems

Pseudo filesystems (e.g., procfs) advertise a zero file size.
Fix reverse() to handle such a case similarly as forward() so
that '-r' works on pseudo filesystems.

Approved by:    re (cperciva)
Signed-off-by:  Aaron LI <aly at aaronly.me>
Reviewed by:    pouria, Ricardo Branco <rbranco at suse.de>, des
Fixes:          1fb3caee7 ("tail: Do not trust st_size if it equals zero.")
Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2080

(cherry picked from commit 4feeca3193c316c18472cd40f215446fda3bd739)
(cherry picked from commit 771a65210018c68198ea413df10225e87a0ea909)
DeltaFile
+1-1usr.bin/tail/reverse.c
+1-11 files

FreeBSD/src 6a3966fsys/dev/vt vt_core.c

vt_core: don't draw the splash if a panic occurred

The shutdown splash draws over all the useful info if ddb(4) is
disabled. Don't draw the splash screen if we're rebooting because of a
panic.

Approved by:    re (cperciva)
MFC after:      3 days

(cherry picked from commit bc83f414583ccaf337ef3b7c019df7727d6a3aae)
(cherry picked from commit 3aabec5c8c6a74a4e50640b399a825d9f7adca9a)
DeltaFile
+3-0sys/dev/vt/vt_core.c
+3-01 files

FreeBSD/src 448b4c3sys/fs/nfsclient nfs_clsubs.c nfsnode.h

nfs_clsubs.c: Fix ncl_getcookie() when "pos" is negative

In ncl_getcookie(), a very large value for "off" for
a directory can result in "pos" being set to a bogus
value (including a negative one), due to truncation.
When "pos" is negative, is can skip past the
while (pos >= NFSNUMCOOKIES) loop and return a
bogus pointer instead of NULL.

This patch changes the type to u_int and also adds
a sanity check for a very large "off" to ensure that
a NULL pointer is returned for this case.

This bug has been in the code for decades and I am
not aware of any report of it causing a problem for
users.

Reviewed by:    markj
Reported by:    Joshua Rogers of AISLE Research Team

    [2 lines not shown]
DeltaFile
+9-1sys/fs/nfsclient/nfs_clsubs.c
+1-1sys/fs/nfsclient/nfsnode.h
+10-22 files

FreeBSD/src e3e5b86. README.md

README.md: Add packages/ directory

Fixes:  bb75b0d581f7 ("packages: Convert world to a subdir build")
MFC after:      2 weeks
Reviewed by:    des, emaste
Differential Revision:  https://reviews.freebsd.org/D56839
DeltaFile
+1-0README.md
+1-01 files

FreeBSD/src 3d89281sys/kern subr_eventhandler.c

eventhandler: Fix the NODEBUG build

Reported by:    Michael Butler <imb at protected-networks.net>
Fixes:          735b16d490ae ("eventhandler: Fix a race when pruning eventhandlers")
DeltaFile
+3-1sys/kern/subr_eventhandler.c
+3-11 files

FreeBSD/src 748402esbin/devmatch devmatch.c

devmatch: read linker.hints from all module paths

Previously, devmatch would stop at the first linker.hints file
found in kern.module_path. This meant modules installed in
/boot/modules/ were invisible to devmatch if /boot/kernel/
contained a linker.hints file (which it always does).

Merge hints from all directories in kern.module_path.
This allows third-party or out-of-tree kernel modules in
/boot/modules/ to be auto-loaded by devmatch just like
built-in modules.

Reviewed by:            imp
Differential Revivion:  https://reviews.freebsd.org/D56847
DeltaFile
+33-4sbin/devmatch/devmatch.c
+33-41 files

FreeBSD/src 55709c8. ObsoleteFiles.inc, usr.sbin/apm Makefile

man: Kill off MANSUBDIRs

Three architecture dependent manuals are installed to MANSUBDIRs,
creating at least two empty manual page directories on everyone's
boxxen. Move those manuals to their canonical area, enhancing clarity,
grepability, removing useless inodes, and increasing consistency with
the rest of the architecture dependent manuals which are unconditionally
installed, and noted at the top of the rendered manual.

MFC after: 3 days

(cherry picked from commit 809504f331fd3588e36b54255196379bdb59890a)
DeltaFile
+9-0ObsoleteFiles.inc
+0-1usr.sbin/apm/Makefile
+0-1usr.sbin/apmd/Makefile
+0-1usr.sbin/nvram/Makefile
+9-34 files

FreeBSD/src 4da464bshare/man/man4 ocs_fc.4

ocs_fc.4: Cleanup

+ more consistent document description
+ enumerate available options in synopsis in vt.4 style
+ tag spdx
+ tweak list rendering
+ cleanup HARDWARE
+ reflow excessively long lines silencing linter warnings
+ fix link macros

MFC after:              3 days
Reported by:            michaelo (hardware notes)
Differential Revision:  https://reviews.freebsd.org/D56753

(cherry picked from commit dd97c3d83f9a92bbeb9740ceff4c1c74c451293e)
DeltaFile
+55-38share/man/man4/ocs_fc.4
+55-381 files

FreeBSD/src 8318c2fusr.sbin/nvram nvram.8

nvram.8: Align option list and tag SPDX

MFC after:      3 days

(cherry picked from commit 33fbfceeb4d9daf1145089a10ce7b25110d8840f)
DeltaFile
+4-2usr.sbin/nvram/nvram.8
+4-21 files

FreeBSD/src aa519edshare/man/man7 ports.7

ports.7/FILES: Expand and refactor into 3 tables

Add make.conf, CHANGES, CONTRIBUTING.Md, UPDATING, and Tools/scripts.
Refactor the FILES section of the ports reference manual into a bigger
table with three sections separated by root directory. Remove preceeding
article from all but "the big Kahuna", and root dirs where reasonable.

MFC after:              3 days
Relnotes:               yes
Reported by:            adamw, arrowd, linimon
Differential Revision:  https://reviews.freebsd.org/D55441

(cherry picked from commit 28deec9b7e2b08b00160eb39de84ade6f27eb125)
DeltaFile
+29-18share/man/man7/ports.7
+29-181 files

FreeBSD/src 486c2dfsys/net if_vlan.c

if_vlan: Use the exclusive lock everywhere

Running sys/net tests in parallel reveals some panics which look like
the one below:

```
shared lock of (sx) vlan_sx @ /home/markj/sb/main/src/sys/net/if_vlan.c:2395
while exclusively locked from /home/markj/sb/main/src/sys/net/if_vlan.c:1850
panic: excl->share
cpuid = 9
time = 1776467219
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d84e0780
vpanic() at vpanic+0x136/frame 0xfffffe00d84e08b0
panic() at panic+0x43/frame 0xfffffe00d84e0910
witness_checkorder() at witness_checkorder+0xdb1/frame 0xfffffe00d84e0ad0
_sx_slock_int() at _sx_slock_int+0x64/frame 0xfffffe00d84e0b10
vlan_ioctl() at vlan_ioctl+0x25c/frame 0xfffffe00d84e0b70
if_setflag() at if_setflag+0xdc/frame 0xfffffe00d84e0be0

    [27 lines not shown]
DeltaFile
+58-68sys/net/if_vlan.c
+58-681 files

FreeBSD/src 735b16dsys/kern subr_eventhandler.c, sys/sys eventhandler.h

eventhandler: Fix a race when pruning eventhandlers

By default, eventhandler_deregister() blocks until it reaches some point
where no threads are invoking the event.  At this point, it knows that
1) no threads are currently executing the handler,
2) some thread has freed the eventhandler structure by virtue of having
   called eventhandler_prune_list(),
so it is safe to return.

Suppose a thread is trying to deregister an event handler.  A different
thread prunes it, and wakes up the first thread.  Before the first
thread runs, a third thread grabs the event handler lock, and starts
executing handlers.  The first thread observes el_runcount > 0, and goes
back to sleep.  The third thread sees no event handlers to prune, and
doesn't wake up the first thread, which sleeps forever.

This change fixes the race and tries to make eventhandler_invoke() more
efficient: keep a count of the number of dead list entries and only
prune the list if there is at least one dead entry.  Also, in

    [7 lines not shown]
DeltaFile
+14-4sys/kern/subr_eventhandler.c
+2-2sys/sys/eventhandler.h
+16-62 files

FreeBSD/src 3aabec5sys/dev/vt vt_core.c

vt_core: don't draw the splash if a panic occurred

The shutdown splash draws over all the useful info if ddb(4) is
disabled. Don't draw the splash screen if we're rebooting because of a
panic.

MFC after:      3 days

(cherry picked from commit bc83f414583ccaf337ef3b7c019df7727d6a3aae)
DeltaFile
+3-0sys/dev/vt/vt_core.c
+3-01 files

FreeBSD/src 8223661sys/conf kern.pre.mk

Revert "zstd: disable weak-symbol tracing hooks in the kernel"

This reverts commit de2ea5423cc63b62e7e42d11b667aa634109fc28 which is
no longer needed after 1dddb580f950 .

Tested by:      mmel
DeltaFile
+2-4sys/conf/kern.pre.mk
+2-41 files

FreeBSD/src bafb055usr.bin/lockf/tests lockf_test.sh

lockf: Test that lockf does not spin on fd

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56723

(cherry picked from commit 0733afdb4dad58cfe7ad7f5994e26bf148d78199)
DeltaFile
+18-0usr.bin/lockf/tests/lockf_test.sh
+18-01 files

FreeBSD/src 2052d09usr.bin/lockf lockf.c

lockf: Avoid spinning when operating on an fd

When operating on a file descriptor, acquire_lock() would ignore the
flags argument and always operate in non-blocking mode, resulting in
unnecessary busy-looping.

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56722

(cherry picked from commit d90513ea85693da0ca5955173609f4e81e38ae16)
DeltaFile
+5-1usr.bin/lockf/lockf.c
+5-11 files

FreeBSD/src 5158575usr.bin/lockf/tests lockf_test.sh

lockf: Test that lockf does not spin on fd

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56723

(cherry picked from commit 0733afdb4dad58cfe7ad7f5994e26bf148d78199)
DeltaFile
+18-0usr.bin/lockf/tests/lockf_test.sh
+18-01 files

FreeBSD/src 4a6c4f0usr.bin/lockf lockf.c

lockf: Avoid spinning when operating on an fd

When operating on a file descriptor, acquire_lock() would ignore the
flags argument and always operate in non-blocking mode, resulting in
unnecessary busy-looping.

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56722

(cherry picked from commit d90513ea85693da0ca5955173609f4e81e38ae16)
DeltaFile
+5-1usr.bin/lockf/lockf.c
+5-11 files

FreeBSD/src 8e5f92busr.bin/lockf/tests lockf_test.sh

lockf: Test that lockf does not spin on fd

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56723

(cherry picked from commit 0733afdb4dad58cfe7ad7f5994e26bf148d78199)
DeltaFile
+18-0usr.bin/lockf/tests/lockf_test.sh
+18-01 files

FreeBSD/src 651b82eusr.bin/lockf lockf.c

lockf: Avoid spinning when operating on an fd

When operating on a file descriptor, acquire_lock() would ignore the
flags argument and always operate in non-blocking mode, resulting in
unnecessary busy-looping.

PR:             294832
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D56722

(cherry picked from commit d90513ea85693da0ca5955173609f4e81e38ae16)
DeltaFile
+5-1usr.bin/lockf/lockf.c
+5-11 files

FreeBSD/src 081d3absys/dev/ichsmb ichsmb_pci.c

ichsmb: add Ice Lake-LP (0x34a3) and Ice Lake-N (0x38a3) SMBus device IDs

Add PCI device IDs for two Ice Lake PCH SMBus controller variants:
- 0x34a3 (Ice Lake-LP), previously listed as the generic "Ice Lake" entry (ID_ICELAKE), renamed to ID_ICELAKELP for clarity.
- 0x38a3 (Ice Lake-N), a separate PCH variant not previously supported.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D56732
DeltaFile
+6-3sys/dev/ichsmb/ichsmb_pci.c
+6-31 files

FreeBSD/src 0979bfbsys/dev/usb/net if_smsc.c

smsc: Add missing newline to PHY timeout error printf
DeltaFile
+1-1sys/dev/usb/net/if_smsc.c
+1-11 files

FreeBSD/src 2fef18fusr.sbin/certctl certctl.c certctl.8, usr.sbin/certctl/tests certctl_test.sh

certctl: Unstickify (un)trusted certificates

Ever since certctl was rewritten in C, the rehash command has reingested
TRUSTDESTDIR / UNTRUSTDESTDIR in addition to TRUSTPATH / UNTRUSTPATH.
This seemed like a good idea at the time but was, in retrospect, a
mistake, as it means a (un)trusted certificate remains (un)trusted
forever (or at least until it expires) even if it is removed from
(UN)TRUSTPATH.  Among other issues, it causes ports QA to fail for any
port that either installs certificates or depends on a port that does.

Although this behavior was undocumented, the change may surprise users
who have added certificates manually, so update the manual page to point
it out and add prominent warnings to the trust and untrust commands.

PR:             290078
MFC after:      1 week
Reviewed by:    kevans, bcr
Differential Revision:  https://reviews.freebsd.org/D56617
DeltaFile
+52-29usr.sbin/certctl/certctl.c
+13-2usr.sbin/certctl/certctl.8
+2-1usr.sbin/certctl/tests/certctl_test.sh
+67-323 files

FreeBSD/src c24b1d9lib/libpfctl libpfctl.c, sbin/pfctl pfctl.c

pfctl: handle errors from PFNL_CMD_GETSTATES

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+3-2sbin/pfctl/pfctl.c
+1-1lib/libpfctl/libpfctl.c
+4-32 files

FreeBSD/src a0e4c65sys/netpfil/pf pf_ioctl.c, tests/sys/netpfil/pf match.sh

pf: do not reject rules with colliding hashes

We insert rules in pf_krule_global solely for the benefit of the
'keepcounters' feature. Failing to insert (beause the rule hash
collides, or an identical rule already exists) would be worse than
restoring counts to the wrong rule (or failing to restore them at all).

PR:             282863, 294860, 294859, 294858
MFC after:      3 days
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D56745
DeltaFile
+36-0tests/sys/netpfil/pf/match.sh
+8-16sys/netpfil/pf/pf_ioctl.c
+44-162 files

FreeBSD/src 8334d46sys/kern sys_process.c

Fix typo in curthread
DeltaFile
+1-1sys/kern/sys_process.c
+1-11 files