HardenedBSD/src d084082sys/contrib/openzfs/cmd/zstream zstream_selftest_queue.c zstream_queue.c, sys/contrib/openzfs/module/os/linux/zfs zpl_ctldir.c zfs_ctldir.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+1,687-157sys/contrib/openzfs/module/zfs/dmu_recv.c
+892-757sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c
+1,024-236sys/contrib/openzfs/module/zfs/zfs_vnops.c
+925-0sys/contrib/openzfs/cmd/zstream/zstream_queue.c
+436-200sys/contrib/openzfs/module/os/linux/zfs/zpl_ctldir.c
+564-0sys/contrib/openzfs/cmd/zstream/zstream_selftest_queue.c
+5,528-1,3503,393 files not shown
+40,915-47,8723,399 files

HardenedBSD/src 2fc689dcontrib/libarchive/libarchive/test test_read_format_zip_winzip_aes256_large_bzip2.zip.uu test_read_format_zip_winzip_aes256_large_lzma.zip.uu

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+23,307-0contrib/libarchive/libarchive/test/test_read_format_rar_newsub_rr_over_1m.rar.uu
+2,919-0contrib/libarchive/libarchive/test/test_read_format_cpio_symlink_trailer.cpio.uu
+2,053-0contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes256_large_zstd.zip.uu
+1,898-0contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes256_large_xz.zip.uu
+1,893-0contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes256_large_lzma.zip.uu
+1,616-0contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes256_large_bzip2.zip.uu
+33,686-0870 files not shown
+69,661-13,566876 files

HardenedBSD/src de3d256sys/contrib/openzfs/cmd/zstream zstream_selftest_queue.c zstream_queue.c, sys/contrib/openzfs/module/os/linux/zfs zpl_ctldir.c zfs_ctldir.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+1,687-157sys/contrib/openzfs/module/zfs/dmu_recv.c
+892-757sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c
+1,024-236sys/contrib/openzfs/module/zfs/zfs_vnops.c
+925-0sys/contrib/openzfs/cmd/zstream/zstream_queue.c
+436-200sys/contrib/openzfs/module/os/linux/zfs/zpl_ctldir.c
+564-0sys/contrib/openzfs/cmd/zstream/zstream_selftest_queue.c
+5,528-1,3503,393 files not shown
+40,915-47,8723,399 files

HardenedBSD/src d53a1bdlibexec/rc rc.conf, libexec/rc/rc.d zfskeys

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+9-7libexec/rc/rc.d/zfskeys
+8-3usr.sbin/ppp/mp.c
+0-1sys/arm/broadcom/bcm2835/bcm2835_audio.c
+1-0libexec/rc/rc.conf
+18-114 files

HardenedBSD/src 9496457share/mk bsd.init.mk

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
DeltaFile
+1-1share/mk/bsd.init.mk
+1-11 files

HardenedBSD/src b863d38share/man/man4 nvme.4

nvme.4: Canonicalize SYNOPSIS

MFC after: 3 days
DeltaFile
+38-18share/man/man4/nvme.4
+38-181 files

HardenedBSD/src 067ae98tools/tools/git git-arc.1 git-arc.sh

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
DeltaFile
+42-3tools/tools/git/git-arc.sh
+19-1tools/tools/git/git-arc.1
+61-42 files

HardenedBSD/src adf4c33sys/arm/broadcom/bcm2835 bcm2835_audio.c

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)
DeltaFile
+0-1sys/arm/broadcom/bcm2835/bcm2835_audio.c
+0-11 files

HardenedBSD/src 595e665usr.bin/ministat ministat.1 README

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
DeltaFile
+2-5usr.bin/ministat/README
+2-2usr.bin/ministat/ministat.1
+4-72 files

HardenedBSD/src 22649d4sys/contrib/openzfs/cmd/zstream zstream_selftest_queue.c zstream_queue.c, sys/contrib/openzfs/module/os/linux/zfs zpl_ctldir.c zfs_ctldir.c

zfs: merge openzfs/zfs at 84aa7e7e0

Notable upstream pull request merges:

 #16761 eb1738bcb FreeBSD: Enable Direct IO by default
 #16747 -multiple On-demand log-spacemap flush
 #18474 0d0eae2ab implement thorough scrub support (zpool scrub -t)
 #18562 6721ab981 Calling thread IO
 #18657 7ed1268d3 Fix race between device removal completion and pool export
 #18707 0d1f3b1c6 RAIDZ: Fix parity regeneration/check condition
 #18713 -multiple libzfs: fix key unload failure when unmounting an
                  encryption root
 #18714 d902eec64 Disconnect metaslab tracing from default builds
 #18716 e78fa488a zstream: multithreading
 #18718 6acb99cb1 Do not return ESTALE for open-unlinked files
 #18720 f607ef7e7 Fix insufficient locking in dedup verify
 #18722 -multiple snapdir: misc cleanups
 #18724 9bf75b4b1 Fix reads for blocks freed after being cloned
 #18725 9b7642df9 Harden recv record validation

    [72 lines not shown]
DeltaFile
+1,687-157sys/contrib/openzfs/module/zfs/dmu_recv.c
+892-757sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c
+1,024-236sys/contrib/openzfs/module/zfs/zfs_vnops.c
+925-0sys/contrib/openzfs/cmd/zstream/zstream_queue.c
+436-200sys/contrib/openzfs/module/os/linux/zfs/zpl_ctldir.c
+564-0sys/contrib/openzfs/cmd/zstream/zstream_selftest_queue.c
+5,528-1,3503,385 files not shown
+40,801-47,8343,391 files

HardenedBSD/src 191dad3sys/netinet tcp_input.c

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
DeltaFile
+5-8sys/netinet/tcp_input.c
+5-81 files

HardenedBSD/src 3f73758libexec/rc rc.conf, libexec/rc/rc.d zfskeys

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)
DeltaFile
+9-7libexec/rc/rc.d/zfskeys
+1-0libexec/rc/rc.conf
+10-72 files

HardenedBSD/src dd2da25usr.sbin/ppp mp.c

ppp: Fix a buffer overflow in the endpoint discriminator set command

Reported by:    Reo Shiseki
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59054

(cherry picked from commit 6cb7e368daab6f166b7c8e26367ea6fee4cdd03a)
DeltaFile
+8-3usr.sbin/ppp/mp.c
+8-31 files

HardenedBSD/src 0ec81f6crypto/openssh FREEBSD-upgrade

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
DeltaFile
+5-0crypto/openssh/FREEBSD-upgrade
+5-01 files

HardenedBSD/src e3671d0sys/kern kern_malloc.c

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-30sys/kern/kern_malloc.c
+0-301 files

HardenedBSD/src 2d232ffsys/dev/netmap netmap_vale.c, sys/kern kern_malloc.c uipc_usrreq.c

Merge remote-tracking branch 'rad/freebsd/15-stable/main' into hardened/15-stable/main

Conflicts:
        sys/kern/kern_malloc.c (unresolved)
DeltaFile
+178-116sys/vm/uma_core.c
+207-0tests/sys/kern/unix_passfd_test.c
+94-85sys/kern/uipc_usrreq.c
+60-62sys/kern/kern_malloc.c
+62-0tests/sys/kern/unix_seqpacket_test.c
+18-6sys/dev/netmap/netmap_vale.c
+619-2697 files not shown
+644-27613 files

HardenedBSD/src f3378bclibexec/rc/rc.d growfs_postboot, share/man/man7 growfs_postboot.7

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+371-0sys/dev/dpaa/fman_keygen.c
+307-61sys/dev/dpaa/dpaa_eth.c
+363-2sys/arm64/arm64/gicv5reg.h
+116-0libexec/rc/rc.d/growfs_postboot
+88-16sys/dev/dpaa/qman.c
+69-0share/man/man7/growfs_postboot.7
+1,314-7940 files not shown
+1,785-17346 files

HardenedBSD/src 4783d9esys/arm64/arm64 gicv5reg.h, sys/dev/nvme nvme_pci.c nvme_qpair.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+363-2sys/arm64/arm64/gicv5reg.h
+50-5sys/dev/nvme/nvme_ctrlr.c
+28-2sys/dev/nvme/nvme_private.h
+6-7sys/dev/nvme/nvme_qpair.c
+8-3usr.sbin/ppp/mp.c
+5-2sys/dev/nvme/nvme_pci.c
+460-219 files not shown
+479-3715 files

HardenedBSD/src 1bb1d38sys/sys _atomic_subword.h, sys/vm vm_page.c

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
DeltaFile
+67-9sys/vm/vm_page.c
+15-39sys/sys/_atomic_subword.h
+82-482 files

HardenedBSD/src 417d647sys/dev/nvme nvme_pci.c nvme_sim.c

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
DeltaFile
+18-0sys/dev/nvme/nvme_private.h
+11-3sys/dev/nvme/nvme_ctrlr.c
+3-3sys/dev/nvme/nvme_sim.c
+2-2sys/dev/nvme/nvme_pci.c
+34-84 files

HardenedBSD/src 68323f0sys/dev/nvme nvme_pci.c nvme_private.h

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
DeltaFile
+39-2sys/dev/nvme/nvme_ctrlr.c
+6-7sys/dev/nvme/nvme_qpair.c
+10-2sys/dev/nvme/nvme_private.h
+5-2sys/dev/nvme/nvme_pci.c
+60-134 files

HardenedBSD/src 6961a9crelease/tools ec2-small.conf ec2-base.conf

HBSD: Resolve merge conflicts

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-8release/tools/ec2-base.conf
+0-7release/tools/ec2-small.conf
+0-152 files

HardenedBSD/src b6acc81libexec/rc/rc.d growfs_postboot, share/man/man7 growfs_postboot.7

Merge remote-tracking branch 'rad/freebsd/current/main' into hardened/current/master

Conflicts:
        release/tools/ec2-base.conf (unresolved)
        release/tools/ec2-small.conf (unresolved)
DeltaFile
+371-0sys/dev/dpaa/fman_keygen.c
+307-61sys/dev/dpaa/dpaa_eth.c
+116-0libexec/rc/rc.d/growfs_postboot
+88-16sys/dev/dpaa/qman.c
+69-0share/man/man7/growfs_postboot.7
+60-0sys/dev/e1000/e1000_osdep.c
+1,011-7726 files not shown
+1,318-13332 files

HardenedBSD/src 0f9fda8sys/kern uipc_usrreq.c

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)
DeltaFile
+2-3sys/kern/uipc_usrreq.c
+2-31 files

HardenedBSD/src bf22e0dsys/kern uipc_usrreq.c, tests/sys/kern unix_seqpacket_test.c

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]
DeltaFile
+41-46sys/kern/uipc_usrreq.c
+62-0tests/sys/kern/unix_seqpacket_test.c
+103-462 files

HardenedBSD/src 646a9f2sys/vm uma_core.c

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)
DeltaFile
+11-6sys/vm/uma_core.c
+11-61 files

HardenedBSD/src 01f6dffsys/vm uma_core.c

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)
DeltaFile
+23-9sys/vm/uma_core.c
+23-91 files

HardenedBSD/src 6edbfb4sys/vm uma_core.c

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)
DeltaFile
+9-1sys/vm/uma_core.c
+9-11 files

HardenedBSD/src be37b1esys/dev/netmap netmap_freebsd.c

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)
DeltaFile
+6-6sys/dev/netmap/netmap_freebsd.c
+6-61 files

HardenedBSD/src bc23286sys/kern uipc_usrreq.c, tests/sys/kern unix_passfd_test.c

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)
DeltaFile
+87-0tests/sys/kern/unix_passfd_test.c
+2-2sys/kern/uipc_usrreq.c
+89-22 files