sys/cdefs.h: Introduce __maybe_unused attribute
The __maybe_unused attribute should be used for variables which may or
may not be used, such as when their only use is in an assertion. This
attribute is functionally identical to __unused, suppressing compiler
warnings for particular variable if it remains unused.
Reviewed by: Minsoo Choo <minsoo at minsoo.io>, imp
Differential Revision: https://reviews.freebsd.org/D56517
rtadvd(8): Honor pltime/vltime in interface declarations
Currently rtadvd ignores interface pltime/vltime specifications
unless the (static) address range is also included in the config file.
This extends the validity of a pltime and/or vltime stanza in
the config file for an interface to delegated addresses from
an upstream provider.
Signed-off-by: tickerguy <karl at denninger.net>
PR: 288426
Reviewed by: pouria
Pull Request: https://github.com/freebsd/freebsd-src/pull/1863
Makefile.vm: Split error condition
Make it clear which of two possible cases applies.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D56837
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
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)
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)
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)
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]
eventhandler: Fix the NODEBUG build
Reported by: Michael Butler <imb at protected-networks.net>
Fixes: 735b16d490ae ("eventhandler: Fix a race when pruning eventhandlers")
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
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)
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)
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]
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]
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)
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)
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)
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)
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
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