vfs offset: fix assertion failure in face of racing ffofset and setfl locking
Both use the same 16 bit var to store their locked and waiters bits,
then this in file_v_unlock:
state = atomic_load_16(flagsp);
if ((state & lock_wait_bit) == 0 &&
atomic_cmpset_rel_16(flagsp, state, state & ~lock_bit))
return;
can fail if for example foffset is being unlocked while setfl is getting
locked.
Afterwards the code assumes there are blocked waiters on foffset.
Reviewed by: kib, markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D52915
vfs offset: fix assertion failure in face of racing ffofset and setfl locking
Both use the same 16 bit var to store their locked and waiters bits,
then this in file_v_unlock:
state = atomic_load_16(flagsp);
if ((state & lock_wait_bit) == 0 &&
atomic_cmpset_rel_16(flagsp, state, state & ~lock_bit))
return;
can fail if for example foffset is being unlocked while setfl is getting
locked.
Afterwards the code assumes there are blocked waiters on foffset.
Reviewed by: kib, markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D52915
Cirrus-CI: Use nproc instead of sysctl -n hw.ncpu
It is available on all supproted FreeBSD versions.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 5bba547a678beb280bf4080375f45b04ceb44fc5)
Cirrus-CI: Switch back to tzst packages, but use level 1
We previously used `PKG_FORMAT: tar` to avoid spending a lot of time in
zstd compression. Instead just set PKG_LEVEL to compression level 1,
which still produces packages that are much smaller than uncompressed
tarballs with only a small penalty in build time.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52858
(cherry picked from commit ae5914c0e4478fd35ef9db3f32665b60e04d5a6f)
unix/stream: repair SO_SNDTIMEO
The send operations are waiting on the peer's socket buffer, but we shall
use our timeout value. Provide a test for that.
Reported by: phk
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D53081
Fixes: d15792780760ef94647af9b377b5f0a80e1826bc
tests/multicast: fix test flakyness
The receiver is run as a background job, so we need a wait loop to
make sure it has been fully functional before launching sender.
Reported by: Siva Mahadevan <me svmhdvn.name>
PR: 290210
conf: enable TCP_HPTS_KTEST on debug builds
Enable the kernel build option TCP_HPTS_KTEST on debug builds and
disable it on non-debug builds.
PR: 290234
Reviewed by: Nick Banks, glebius
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D53108
unionfs: fix NULL deref on closing an fd passed through SCM_RIGHTS
If the last reference to an open file is contained in an SCM_RIGHTS
message in a UNIX domain socket, and that message is discarded without
being read out by the receiver, VOP_CLOSE will ultimately be called
with ap->a_td == NULL.
Change unionfs_close() to check for this condition instead of blindly
passing the thread to unionfs_find_node_status() which will try to
dereference it. Also add relevant asserts on the node status lookup
paths.
PR: 289700
Reported by: asomers
Reviewed by: asomers, olce
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53079
socket(2): refactor the manual page
Create a chapter on every important socket type: stream, datagram,
seqpacket. Always list what protocol families do support what kinds of
sockets. Improve some statements possessing language from the
specification [1]. Reduce some statements that are mostly specific to
TCP. Provide more external links and references to various important
syscalls that can be used on sockets.
Add a paragrph on non-blocking mode.
The big factual change is documentation of SOCK_SEQPACKET. In FreeBSD 15
this socket now fully follows the specification and is a stream socket
with record boundaries.
[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_10_06
Differential Revision: https://reviews.freebsd.org/D52771
bsdinstall: Tweak pkgbase/dist set labels
Have the button labels refer to the artifact type directly (distribution
sets / packages), and use "Tech Preview" as packaged base is no longer
experimental.
Reviewed by: ivy, cperciva
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52999
(cherry picked from commit abd9424590ba37ac10e92723ad6428f0448024c1)
fusefs: fix intermittency in the BadServer.ShortWrite test
This test implicitly depended on the order in which two threads
completed. If the test thread finished first, the test would pass. But
if the mock file system thread did, it would attempt to read from an
unmounted file system, and fail. As a result, the test would randomly
fail once out of every several thousand executions. Fix it by telling
the mock file system's event loop to exit without attempting to read any
more events.
Reported by: Siva Mahadevan <me at svmhdvn.name>
MFC after: 1 week
Reviewed by: Siva Mahadevan <me at svmhdvn.name>
Differential Revision: https://reviews.freebsd.org/D53080
libm: remainder: make sure x is zero
Make sure the entirety of x is zero before flipping the sign bit.
Otherwise the sign would be wrong for small values of x when x is
negative and |n*y| > |x|
Reported by: alfredo
PR: 251091
Reviewed by: kargl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53023
(cherry picked from commit 25cca51ed294890d20a3c0290814cd26875db686)
libm: remainder: make sure x is zero
Make sure the entirety of x is zero before flipping the sign bit.
Otherwise the sign would be wrong for small values of x when x is
negative and |n*y| > |x|
Reported by: alfredo
PR: 251091
Reviewed by: kargl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53023
(cherry picked from commit 25cca51ed294890d20a3c0290814cd26875db686)
libm: remainder: make sure x is zero
Make sure the entirety of x is zero before flipping the sign bit.
Otherwise the sign would be wrong for small values of x when x is
negative and |n*y| > |x|
Reported by: alfredo
PR: 251091
Reviewed by: kargl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53023
(cherry picked from commit 25cca51ed294890d20a3c0290814cd26875db686)
exec: Check for errors when mapping the shared object
In the non-ASLR case, there is no check for an error from
vm_map_fixed(). Restore it, it was dropped in commit 939f0b6323e0a.
This bug could result in a refcount leak of the object used to map the
VDSO page.
Reviewed by: kib
Reported by: Ilja Van Sprundel <ivansprundel at ioactive.com>
MFC after: 1 week
Fixes: 939f0b6323e0 ("Implement shared page address randomization")
Differential Revision: https://reviews.freebsd.org/D53065
ipfw: Check for errors from sooptcopyin() and sooptcopyout()
Note, it looks like this code may be unused since commit 4a77657cbc01
("ipfw: migrate ipfw to 32-bit size rule numbers"). In particular, it
looks like the ipfw_nat_*_ptr pointers are unused now.
Reviewed by: ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53068
certctl.8: Update documentation of BUNDLE
- Fix a typo.
- Provide the default path.
Reviewed by: des
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53001
sys/rpc: UNIX auth: Do not log on bogus AUTH_SYS messages
Remove the printf() stances added in commit d4cc791f3b2e ("sys/rpc: UNIX
auth: Fix OOB reads on too short message").
Even if it can be helpful to know why an authentication message is
rejected, printing explanatory messages on each request attempt is
a remote log filler that could be triggered by accident, and the generic
RPC code generally does not do that. These printf() calls should be
restored only after some limiting or configuration mechanism is devised.
MFC with: d4cc791f3b2e ("sys/rpc: UNIX auth: Fix OOB reads on too short message")
Sponsored by: The FreeBSD Foundation
sys/rpc: UNIX auth: Support XDR_FREE
xdr_authunix_parms() does not allocate any auxiliary memory, so we can
simply support XDR_FREE by just returning TRUE.
Although there are currently no callers passing XDR_FREE, this makes us
immune to such a change in a way that doesn't cost more but is more
constructive than a mere KASSERT().
Suggested by: rmacklem
MFC after: 2 days
Sponsored by: The FreeBSD Foundation
sys/rpc: UNIX auth: Fix OOB reads on too short message
In the inline version (_svcauth_unix()), fix multiple possible OOB reads
when the credentials part of a request is too short to contain mandatory
fields or with respect to the hostname length or number of groups it
advertises. The previously existing check was arriving too late and
relied on possibly wrong data coming from earlier OOB reads.
While here, use 'uint32_t' as the length/size type, as it is more than
enough and removes the need for conversions, explicit or implicit.
While here, factor out setting 'stat' to AUTH_BADCRED and then jumping
to 'done' on error, through the new 'badcred' label. While here,
through comments, refer to what the non-inline version is doing
(xdr_authunix_parms() in 'authunix_prot.c') and the reasons.
Reviewed by: rmacklem
Fixes: dfdcada31e79 ("Add the new kernel-mode NFS Lock Manager.")
MFC after: 2 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52964
sys/rpc: UNIX auth: Use AUTH_SYS_MAX_{GROUPS,HOSTNAME} as limits (2/2)
Remove local defines from 'svc_auth_unix.c' and use the new limit
macros instead.
Reviewed by: rmacklem
MFC after: 2 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52963
sys/rpc: UNIX auth: Fix OOB accesses, notably writes on decode
When the received authentication message had more than XU_NGROUPS, we
would write group IDs beyond the end of cr_groups[] in the 'struct
xucred' being filled (as 'ngroups_max' is always greater than
XU_NGROUPS).
For robustness, prevent various OOB accesses that would result from
a change of value of XU_NGROUPS or a 'struct xucred' with an invalid
'cr_ngroups' field, even if these cases are unlikely.
Reviewed by: rmacklem
Fixes: dfdcada31e79 ("Add the new kernel-mode NFS Lock Manager.")
MFC after: 2 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52960