bsd.init.mk: always define _gid when MK_INSTALL_AS_USER is set
A recent commit started to use _uid and _gid in <bsd.dirs.mk> to
mangle the user and group for newly installed directories when
MK_INSTALL_AS_USER is set. However, _gid was previously only set
when _uid was not 0, causing the group to be set to the empty
string.
Set _uid and _gid together to avoid this problem.
Fixes: 541e6e2d516b6c9d3681b24464e9ef53c1f2579a
PR: 297841
Reviewed by: emaste, imp
Reported by: Ralph Zitz <ralph at zitz.dk>
Differential Revision: https://reviews.freebsd.org/D59150
git-arc: -t tag support for create to set Phabricator project tags
Add -t tag[,...] so a review can be tagged at creation instead of
needing the web UI. Spaces in tag names are written as underscores;
a leading # is optional.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59019
bcm2835_audio: Remove wrong chn_intr()
chn_trigger() calls bcmchan_trigger() with the channel lock held.
However, bcmchan_trigger() calls chn_intr(), which also tries to lock,
which results in a lock recursion panic. chn_intr() is meant to be
called by the interrupt handler and not inside CHANNEL_TRIGGER()
methods. Remove the call altogether, the bcm2835_worker_play_start()
call that comes after is enough.
Fixes: 69cab2d1bfb5 ("Fix locking in bcm2835_audio driver")
Reported by: Marco Devesas Campos <devesas.campos at gmail.com>
Tested by: Marco Devesas Campos <devesas.campos at gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59055
(cherry picked from commit f0778a6f9ba7045239a0055ebfbd7965d1f162c9)
ministat.1: Match actual output
Fix a documentation discrepancy, where the implementation was updated to
use uncertainty propagation for the ratio of means, but the example
output in the manual page was left unchanged.
Update the manual page example from 70.7384% to 102.3% to reflect the
actual output.
While here, also update the example in the README.
Reviewed by: ziaee
Fixes: a304ad90e9ae ("Reduce the bogosity of ministat's % difference calculations.")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D59157
tcp: minor cleanup
Several cleanups in tcp_input_with_port():
* Don't assign m twice.
* Don't reassign pointers without having done pullup().
* While there, change the type of isipv6 to bool, since it is used
that way.
No functional change intended.
Reported by: Hannes Elfert
Reviewed by: pouria, Timo Völker, Nick Banks
MFC after: 1 week
MFC to: stable/15
Differential Revision: https://reviews.freebsd.org/D59142
zfskeys - only prompt if zfskeys and zfskeys_prompt are enabled
By default don't block booting with a prompt if a zpool needs a keyboard
password to unlock it. To enable prompting for keyboard password during
boot require:
zfskeys_enable="YES"
zfskeys_prompt_enable="YES"
to both be enabled. This returns to POLA of prior behaviour.
PR: 296130
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D57750
(cherry picked from commit 276a3dacdb60b65d65301aced5d8443cc5d27ea2)
openssh: Add date bump command to FREEBSD-upgrade instructions
Provide a convenient in-place sed edit command to update the FreeBSD
VersionAddendum dates with today's date.
Sponsored by: The FreeBSD Foundation
Revert "atomic: Implement atomic_{set,clear}_8 in _atomic_subword.h"
This commit fails to compile for powerpc64le. Just revert it as it's
only a cleanup motivated by adding support for KASAN to riscv.
This is a direct commit to stable/15.
This reverts commit 318915568443f1fdb65faab0f559c872f09628c6.
Reported by: jenkins
nvme: limit visible namespaces on Apple S3X
The Apple S3X controller exposes internal namespaces beyond NSID 1
that aren't meant to be visible to the OS. Added QUIRK_APPLE_S3X_NS1_ONLY
and nvme_ctrlr_num_namespaces()/nvme_ctrlr_nsid_visible() helpers, and
route namespace construction, notification, and AER namespace-changed
handling through them instead of a raw cdata.nn count.
MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D58844
nvme: fix Apple S3X controller panic
Serialize S3X I/O and cap dtransfers while keeping namespace handling.
Select 64/128-byte submission queue entries explicitly and set
CC.IOSQES from the same value used for the software queue stride.
When fatal status is set, wait for pending PCIe transactions and then
force FLR so a wedged controller doesn't panic or timeout.
MFC: 1 week
PR: 296946
Fixes: 5e0ba47aa00e
Reviewed by: ngie, imp
Differential Revision: https://reviews.freebsd.org/D58821
unix/stream: fix instant panic w/o INVARIANTS
A stupid microoptimization I made leaving empty STAILQ inconsistent
is a brainfart that is related to much earlier version of this code,
where it was safe to do so.
Pointy hat to: glebius
Fixes: 69f61cee2efb1eec0640ca7de9b2d51599569a5d
(cherry picked from commit 82d8a5029a80a77166dca098b8fedb10d84e4e38)
unix/stream: fix a race with MSG_PEEK on SOCK_SEQPACKET with MSG_EOR
The pr_soreceive method first scans the buffer holding the both I/O sx(9)
and socket buffer mutex(9) and after figuring out how much needs to be
copied out drops the mutex. Since the other side may only append to the
buffer, it is safe to continue the operation holding the sx(9) only.
However, the code had a bug that it used pointer in the very last mbuf as
marker of the place where to stop. This worked both in a case when we
drain a buffer completely (marker points at NULL) and in a case when we
wanted to stop at MSG_EOR (marker points at next mbuf after MSG_EOR).
However, this pointer is not consistent after we dropped the socket buffer
mutex.
Rewrite the logic to use the data length as bounds for the copyout cycle.
Provide a test case that reproduces the race. Note that the race is very
hard to hit, thus test will pass on unmodified kernel as well. In a
virtual machine I needed to add tsleep(9) for 10 nanoseconds into the
middle of function to be able to reproduce.
[7 lines not shown]
uma: Avoid allocating from free buckets when KASAN is enabled
When uma_zalloc_arg() hits an empty alloc bucket in the per-CPU cache,
it tries swapping the alloc and free buckets in the hope that the free
bucket has some items available. If not, it has to lock the zone.
Disable this behaviour when KASAN is configured in order to further
defer reuse of freed items. This forces a free item to go to the
per-domain full bucket cache before it becomes accessible to the
allocator.
Reviewed by: rlibby
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58270
(cherry picked from commit 666eab3afc52bf20d57c24e98a6aa667433fb7c2)
uma: Make an effort to defer reuse of items when KASAN is enabled
When KASAN is configured, make uma_zfree_arg() free items to the per-CPU
free bucket, rather than to the alloc bucket. This means that the item
won't be recycled immediately the next time a thread goes to allocate an
item from that zone on the same CPU. In other words, the item will stay
in a quarantine state longer, which helps make KASAN's use-after-free
detection more reliable.
Reviewed by: rlibby
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58269
(cherry picked from commit 990989c31b4637a23e64598a3d9929079bb9a8de)
uma: Enqueue full buckets in FIFO order when KASAN is configured
We want to defer reuse of free objects, and this is a trivial way to
promote that.
Suggested by: rlibby
Reviewed by: rlibby, alc
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58312
(cherry picked from commit 492cfbe9e2f831fff290e019dae66345146978bd)
netmap: Fix a race in kqueue registration
We need to acquire the netmap global lock earlier, to avoid racing with
the NETMAP_REQ_REGISTER ioctl handler.
Reported by: syzkaller
Reviewed by: vmaffione
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58677
(cherry picked from commit 6de818285f066c6705816674c671761dc09bff90)
unix: Fix mchain handling in uipc_sosend_stream_or_seqpacket()
Empty mchains cannot be copied with simple assignment.
I think this bug is mostly harmless: if mcnext is empty, then it won't
be accessed again before it is reinitialized in the next loop iteration.
So the bug only trips an assertion in INVARIANTS kernels and won't be
visible otherwise.
Add a regression test which triggers this corner case.
Reported by: Jan Bramkamp
Fixes: d15792780760 ("unix: new implementation of unix/stream & unix/seqpacket")
Reviewed by: glebius
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58791
(cherry picked from commit 79e0b69ce8af7d115496991ef66e525a03e9f4fe)