HardenedBSD/src a8aca62. README.md

HBSD: Document rejection of AI/LLM/etc generated works

HardenedBSD is disinterested in navigating potential copyright issues.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+5-0README.md
+5-01 files

HardenedBSD/src ef81f76sys/conf NOTES, sys/kern uipc_socket.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+152-63tools/tools/git/git-arc.sh
+16-11tools/tools/git/git-arc.1
+15-10sys/netpfil/pf/pf.c
+10-1sys/netpfil/pf/pf_lb.c
+7-0sys/kern/uipc_socket.c
+3-0sys/conf/NOTES
+203-8514 files not shown
+218-8520 files

HardenedBSD/src 5857f48sys/conf NOTES, sys/kern uipc_socket.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+152-63tools/tools/git/git-arc.sh
+16-11tools/tools/git/git-arc.1
+15-10sys/netpfil/pf/pf.c
+10-1sys/netpfil/pf/pf_lb.c
+7-0sys/kern/uipc_socket.c
+3-0sys/conf/NOTES
+203-8514 files not shown
+218-8520 files

HardenedBSD/src f86c3e6tools/tools/git git-arc.1 git-arc.sh

git-arc: Handle -h on subcommands and align usage with the man page

git-sh-setup treats -h as help against an empty USAGE, so
"git arc create -h" prints "usage: git arc". Handle -h before
sourcing it so every subcommand prints the real synopsis.

The create, stage, and update synopses showed optional commit-refs
while git-arc(1) and the code require them. Advertise -p parent on
create; the option was already implemented and documented.

Sort create sub-command option-arguments alphabetically in three
places: (1) synopsis from tool, (2) man-page synopsis, and (3)
man-page description.

Check for jq(1) / arc after checking for usage so -h always works.

While here, fix missing "local o" in gitarc__stage().

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59129
DeltaFile
+149-60tools/tools/git/git-arc.sh
+16-11tools/tools/git/git-arc.1
+165-712 files

HardenedBSD/src 90ed365tools/tools/git git-arc.sh

git-arc: Fix inconsistent whitespace

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59161
DeltaFile
+3-3tools/tools/git/git-arc.sh
+3-31 files

HardenedBSD/src 918fbc9sys/netpfil/pf pf_lb.c pf.c

pf: Re-optimize state key handling

pf states may be looked up using one of two keys: the stack key or the
wire key.  For states involving address translation, these will be
distinct; the stack key describes the addresses seen by the local
network stack, and the wire key has the translated addresses.

Historically, pf would avoid allocating separate keys if both are
identical.  This changed in commit fcdb520c1b4e ("pf: nat64") to always
allocate separate state key structures.  Incidentally, OpenBSD seems to
maintain the optimization, but also has an explicit reference count
embedded in state keys.

The change breaks another optimization: pf_state_key_attach() still uses
state key pointer equality to check whether the stack and wire keys are
equal, so those checks are always false after the aforementioned commit.
Thus we never skip the second key lookup, even when that's possible
(i.e., no address translation is involved).


    [13 lines not shown]
DeltaFile
+15-10sys/netpfil/pf/pf.c
+10-1sys/netpfil/pf/pf_lb.c
+25-112 files

HardenedBSD/src cb70098sys/kern uipc_socket.c, sys/netinet in.h

socket: Restore handling of IPPROTO_DIVERT

Python scripts which use divert sockets no longer work after commit
e967a2a03677; even if one patches socket() calls, getaddrlen() doesn't
work on divert sockets, needed to use recvfrom().

Restore compatibility when COMPAT_FREEBSD15 is defined.

Reviewed by:    kib
Sponsored by:   OPNsense
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D59018
DeltaFile
+7-0sys/kern/uipc_socket.c
+2-0sys/netinet/in.h
+9-02 files

HardenedBSD/src d70e5b3sys/amd64/conf MINIMAL GENERIC, sys/arm/conf std.armv7

conf: Add COMPAT_FREEBSD15

Define it everywhere that wants COMPAT_FREEBSD14.

Reviewed by:    imp, kib, emaste
Sponsored by:   OPNsense
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D59017
DeltaFile
+3-0sys/conf/NOTES
+1-0sys/arm64/conf/std.arm64
+1-0sys/arm/conf/std.armv7
+1-0sys/amd64/conf/MINIMAL
+1-0sys/amd64/conf/GENERIC
+1-0sys/amd64/conf/FIRECRACKER
+8-08 files not shown
+16-014 files

HardenedBSD/src b4a4a06crypto/openssl/ssl/record/methods dtls_meth.c, crypto/openssl/test cmp_vfy_test.c rpktest.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+83-0tests/sys/mac/do/regression.c
+66-10crypto/openssl/test/rpktest.c
+12-60sys/dev/hwpmc/hwpmc_mod.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+565-14526 files not shown
+845-23832 files

HardenedBSD/src f111423crypto/openssl/ssl/record/methods dtls_meth.c, crypto/openssl/test cmp_vfy_test.c rpktest.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+83-0tests/sys/mac/do/regression.c
+66-10crypto/openssl/test/rpktest.c
+12-60sys/dev/hwpmc/hwpmc_mod.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+565-14522 files not shown
+822-21528 files

HardenedBSD/src a487660crypto/openssl/ssl/record/methods dtls_meth.c, crypto/openssl/test cmp_vfy_test.c rpktest.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+83-0tests/sys/mac/do/regression.c
+66-10crypto/openssl/test/rpktest.c
+12-60sys/dev/hwpmc/hwpmc_mod.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+565-14526 files not shown
+845-23832 files

HardenedBSD/src 92f10f7crypto/openssl/ssl/record/methods dtls_meth.c, crypto/openssl/test cmp_vfy_test.c rpktest.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+83-0tests/sys/mac/do/regression.c
+66-10crypto/openssl/test/rpktest.c
+12-60sys/dev/hwpmc/hwpmc_mod.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+565-14522 files not shown
+822-21528 files

HardenedBSD/src 336cc04crypto/openssh sshd.8 ssh.1

openssh: Fix shosts.equiv path in manual pages

Change the path for the shosts.equiv file to consistently reflect
/etc/ssh/shosts.equiv across all manual pages.

This change stems from 35d4ccfb5576 ("Document FreeBSD defaults and
paths.")

Reviewed by:    bcr, emaste
Differential Revision:  https://reviews.freebsd.org/D52203
DeltaFile
+2-2crypto/openssh/ssh.1
+1-1crypto/openssh/sshd.8
+3-32 files

HardenedBSD/src 5990860sys/kern uipc_shm.c, sys/sys mman.h

posixshm: Fix a TOCTOU race in the FIOSSHMLPGCNF handler

The check for whether shm_lp_psind was assigned was unlocked.  This race
can be exploited to create an object with psind==2 but with only
pagesizes[1] worth of pages populated.  This in turn can be used to
escalate privileges.

Fix this by acquiring the rangelock earlier.  In shm_mmap_large(),
assert that we hold the rangelock.  In shm_write(), annotate an unlocked
load of shm_lp_psind.

Approved by:    so
Security:       FreeBSD-SA-26:63.posixshm
Security:       CVE-2026-58094
Reported by:    tsune of GMO Cybersecurity by Ierae, Inc. working with TrendAI Zero Day Initiative
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59104
DeltaFile
+17-10sys/kern/uipc_shm.c
+1-1sys/sys/mman.h
+18-112 files

HardenedBSD/src c7cec6fsys/kern tty.c

tty: Revalidate after dropping the tty lock in ioctl handlers

The TIOCSCTTY ioctl handler drops the tty lock in order to acquire the
proctree relock.  After relocking the tty, it did not revalidate the
tty state, and it could end up linking a doomed tty to the calling
process' session.  This race can be exploited to escalate privileges.

TIOCSPGRP has a similar race, fix that too.

Approved by:    so
Security:       FreeBSD-SA-26:62.tty
Security:       CVE-2026-58093
Reported by:    tsune of GMO Cybersecurity by Ierae, Inc. working with TrendAI Zero Day Initiative
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59126
DeltaFile
+12-2sys/kern/tty.c
+12-21 files

HardenedBSD/src 87bb4aasys/dev/hwpmc hwpmc_mod.c, sys/kern kern_exec.c

hwpmc: Fix the execve handler

When a process execve()s, pmc_process_exec() is supposed to evaluate
whether the new image is setuid/setgid and if so, whether to detach
PMCs.  This was handled by pmc_can_attach(), which is effectively an
open-coded copy of cr_xids_subset().

Unfortunately, the test of the result of this function was inverted,
with the result that we'd detach PMCs only if the predicate said it was
okay to do so.  It appears the bug has always been there; it seems the
intent was to return 0 on "success", i.e., it is okay to attach the
PMCs, much like p_candebug().  Commits 1c3c698ba4c4 and 1c40b15971f0
obscured this a bit.

I think this check is trying to be too clever.  Let's make it simpler:
simply do not attach PMCs unless the owner is privileged.  This is how,
e.g., ktrace works.  I do not think it's worth trying to be more
sophisticated than this unless we can generalize the policy in a way
that's applicable to other subsystems.

    [11 lines not shown]
DeltaFile
+12-60sys/dev/hwpmc/hwpmc_mod.c
+1-1sys/kern/kern_exec.c
+13-612 files

HardenedBSD/src c5ad29ccrypto/openssl/ssl/quic quic_port.c quic_txp.c, crypto/openssl/ssl/record/methods dtls_meth.c

openssl: Fix multiple vulnerabilities

This is a rollup commit from upstream to fix:
  Handle signature_algorithms_cert extension in key-only context
  Avoid double free of qrx in port_default_packet_handler()
  Avoid full read buffer allocation when buffering DTLS next-epoch records
  ssl/record/methods/dtls_meth.c: lower the unprocessed_rcds queue limit
  ssl/record: remove dead DTLS processed_rcds record queue
  Fix heap buffer overflow (8-byte OOB write) in AES-WRAP-PAD unwrap
  CMP unexpected sender DN used as format string in ERR_raise_data()
  Add test for CVE-2026-63073
  Add a test for restricting growth in cmp cert cache
  Fix unbounded cert cache growth in cmp
  Don't store ACK-only frames in TX history for QUIC.
  Add test for CVE-2026-63076
  Fix Remote NULL deref in ossl_cmp_calc_protection() via crafted protectionAlg

Approved by:    so
Obtained from:  OpenSSL

    [8 lines not shown]
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+66-10crypto/openssl/test/rpktest.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+34-12crypto/openssl/ssl/quic/quic_txp.c
+28-12crypto/openssl/ssl/quic/quic_port.c
+532-10912 files not shown
+682-12518 files

HardenedBSD/src ae27dffsys/sys ucred.h, tests/sys/mac/do Makefile regression.c

cred: Fix group_is_primary()

This helper wasn't updated in commit be1f7435ef21, so in reality it was
testing whether "gid" is the first supplemental group.  If a user
doesn't belong to a supplementary group, then it's testing an
uninitialized slot; since ucreds are allocated with M_ZERO, this
typically means that we're testing gid == 0.

group_is_primary() has exactly one use, in mac_do.  There, it's used to
determine whether to keep the caller's current primary groups.  This
means that a rule such as gid=0>uid=0 will permit any credential with no
supplementary groups.

I believe this is mostly exploitable by daemons which have explicitly
dropped privileges and called setgroups(0, NULL); logged in users will
have a non-empty supplementary group list by virtue of having gone
through initgroups(3).

Fix group_is_primary(), and add a regression test.

    [9 lines not shown]
DeltaFile
+83-0tests/sys/mac/do/regression.c
+1-1sys/sys/ucred.h
+2-0tests/sys/mac/do/Makefile
+86-13 files

HardenedBSD/src edff72esys/dev/sound/pcm channel.h dsp.c

dsp: Fix a potential use-after-free in dsp_oss_syncstart()

This function has a loop where it attempts to lock all channels in a
group.  If doing so would block, it releases all locks, sleeps for a
bit, and tries again.  However, once the syncgroup lock is dropped,
nothing prevents the syncgroup structure from being freed.

Fix the inner loop: after waking up, break out of it unconditionally and
start everything again.  I think the old code was also buggy and not
well-exercised: after waking up we'd continue to try and continue
locking channels.  Then we'd try again from the beginning and fail to
lock the channels we had already locked.

Approved by:    so
Security:       FreeBSD-SA-26:58.sound
Security:       CVE-2026-58091
Reported by:    Hazley Samsudin of GovTech CSG
Reviewed by:    christos
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58912
DeltaFile
+6-11sys/dev/sound/pcm/dsp.c
+5-4sys/dev/sound/pcm/channel.h
+11-152 files

HardenedBSD/src b207f75sys/kern tty.c

tty: Revalidate after dropping the tty lock in ioctl handlers

The TIOCSCTTY ioctl handler drops the tty lock in order to acquire the
proctree relock.  After relocking the tty, it did not revalidate the
tty state, and it could end up linking a doomed tty to the calling
process' session.  This race can be exploited to escalate privileges.

TIOCSPGRP has a similar race, fix that too.

Approved by:    so
Security:       FreeBSD-SA-26:62.tty
Security:       CVE-2026-58093
Reported by:    tsune of GMO Cybersecurity by Ierae, Inc. working with TrendAI Zero Day Initiative
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59126
DeltaFile
+12-2sys/kern/tty.c
+12-21 files

HardenedBSD/src 62c4afcsys/dev/sound/pcm channel.h dsp.c

dsp: Fix a potential use-after-free in dsp_oss_syncstart()

This function has a loop where it attempts to lock all channels in a
group.  If doing so would block, it releases all locks, sleeps for a
bit, and tries again.  However, once the syncgroup lock is dropped,
nothing prevents the syncgroup structure from being freed.

Fix the inner loop: after waking up, break out of it unconditionally and
start everything again.  I think the old code was also buggy and not
well-exercised: after waking up we'd continue to try and continue
locking channels.  Then we'd try again from the beginning and fail to
lock the channels we had already locked.

Approved by:    so
Security:       FreeBSD-SA-26:58.sound
Security:       CVE-2026-58091
Reported by:    Hazley Samsudin of GovTech CSG
Reviewed by:    christos
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58912
DeltaFile
+6-11sys/dev/sound/pcm/dsp.c
+5-4sys/dev/sound/pcm/channel.h
+11-152 files

HardenedBSD/src b13a700sys/kern uipc_shm.c, sys/sys mman.h

posixshm: Fix a TOCTOU race in the FIOSSHMLPGCNF handler

The check for whether shm_lp_psind was assigned was unlocked.  This race
can be exploited to create an object with psind==2 but with only
pagesizes[1] worth of pages populated.  This in turn can be used to
escalate privileges.

Fix this by acquiring the rangelock earlier.  In shm_mmap_large(),
assert that we hold the rangelock.  In shm_write(), annotate an unlocked
load of shm_lp_psind.

Approved by:    so
Security:       FreeBSD-SA-26:63.posixshm
Security:       CVE-2026-58094
Reported by:    tsune of GMO Cybersecurity by Ierae, Inc. working with TrendAI Zero Day Initiative
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59104
DeltaFile
+17-10sys/kern/uipc_shm.c
+1-1sys/sys/mman.h
+18-112 files

HardenedBSD/src 96bf349sys/sys ucred.h, tests/sys/mac/do Makefile regression.c

cred: Fix group_is_primary()

This helper wasn't updated in commit be1f7435ef21, so in reality it was
testing whether "gid" is the first supplemental group.  If a user
doesn't belong to a supplementary group, then it's testing an
uninitialized slot; since ucreds are allocated with M_ZERO, this
typically means that we're testing gid == 0.

group_is_primary() has exactly one use, in mac_do.  There, it's used to
determine whether the requested primary GID can be used in a setcred(2)
call when the ruleset does not explicitly specify a target primary GID.

I believe this is mostly exploitable by daemons which have explicitly
dropped privileges and called setgroups(0, NULL); logged in users will
have a non-empty supplementary group list by virtue of having gone
through initgroups(3).

Fix group_is_primary(), and add a regression test.


    [8 lines not shown]
DeltaFile
+83-0tests/sys/mac/do/regression.c
+1-1sys/sys/ucred.h
+2-0tests/sys/mac/do/Makefile
+86-13 files

HardenedBSD/src fad7f65crypto/openssl/ssl/quic quic_port.c quic_txp.c, crypto/openssl/ssl/record/methods dtls_meth.c

openssl: Fix multiple vulnerabilities

This is a rollup commit from upstream to fix:
  Handle signature_algorithms_cert extension in key-only context
  Avoid double free of qrx in port_default_packet_handler()
  Avoid full read buffer allocation when buffering DTLS next-epoch records
  ssl/record/methods/dtls_meth.c: lower the unprocessed_rcds queue limit
  ssl/record: remove dead DTLS processed_rcds record queue
  Fix heap buffer overflow (8-byte OOB write) in AES-WRAP-PAD unwrap
  CMP unexpected sender DN used as format string in ERR_raise_data()
  Add test for CVE-2026-63073
  Add a test for restricting growth in cmp cert cache
  Fix unbounded cert cache growth in cmp
  Don't store ACK-only frames in TX history for QUIC.
  Add test for CVE-2026-63076
  Fix Remote NULL deref in ossl_cmp_calc_protection() via crafted protectionAlg

Approved by:    so
Obtained from:  OpenSSL

    [8 lines not shown]
DeltaFile
+338-0crypto/openssl/test/cmp_extracerts_dos_test.c
+16-75crypto/openssl/ssl/record/methods/dtls_meth.c
+66-10crypto/openssl/test/rpktest.c
+50-0crypto/openssl/test/cmp_vfy_test.c
+34-12crypto/openssl/ssl/quic/quic_txp.c
+28-12crypto/openssl/ssl/quic/quic_port.c
+532-10912 files not shown
+682-12518 files

HardenedBSD/src cbf3fe8sys/dev/hwpmc hwpmc_mod.c, sys/kern kern_exec.c

hwpmc: Fix the execve handler

When a process execve()s, pmc_process_exec() is supposed to evaluate
whether the new image is setuid/setgid and if so, whether to detach
PMCs.  This was handled by pmc_can_attach(), which is effectively an
open-coded copy of cr_xids_subset().

Unfortunately, the test of the result of this function was inverted,
with the result that we'd detach PMCs only if the predicate said it was
okay to do so.  It appears the bug has always been there; it seems the
intent was to return 0 on "success", i.e., it is okay to attach the
PMCs, much like p_candebug().  Commits 1c3c698ba4c4 and 1c40b15971f0
obscured this a bit.

I think this check is trying to be too clever.  Let's make it simpler:
simply do not attach PMCs unless the owner is privileged.  This is how,
e.g., ktrace works.  I do not think it's worth trying to be more
sophisticated than this unless we can generalize the policy in a way
that's applicable to other subsystems.

    [11 lines not shown]
DeltaFile
+12-60sys/dev/hwpmc/hwpmc_mod.c
+1-1sys/kern/kern_exec.c
+13-612 files

HardenedBSD/src 5db5c82sys/arm/arm machdep.c

arm: Quote diagnostic message

The C standard does not require diagnostic messages to be quoted, but
some tools get confused by unbalanced quotes such as the apostrophe in
“don't”.  Wrap this message in double quotes to resolve the confusion.

Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
DeltaFile
+1-1sys/arm/arm/machdep.c
+1-11 files

HardenedBSD/src 9186704sys/arm64/include armreg.h

arm64: Fix the indentation of ID_AA64ISAR2_EL1

Some ID_AA64ISAR2_EL1 fields values are incorrectly indented. Values
have an extra space before the macro to make scanning for them easier.

Add this extra space to the two fields that were missing it.

Sponsored by:   Arm Ltd
DeltaFile
+4-4sys/arm64/include/armreg.h
+4-41 files

HardenedBSD/src 137ce1esys/arm64/include armreg.h

arm64: Use decimal values for op and CR macros

Using hex here breaks the instruction generated by MRS_REG_ALT_NAME.
Switch to a decimal value.

Sponsored by:   Arm Ltd
DeltaFile
+15-15sys/arm64/include/armreg.h
+15-151 files

HardenedBSD/src 2b386basys/contrib/openzfs/cmd zhack.c, sys/contrib/openzfs/module/os/linux/zfs abd_os.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+305-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_zhack_reclaim.ksh
+178-0sys/contrib/openzfs/cmd/zhack.c
+159-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_degraded_import.ksh
+0-150sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user/zfs_send_usertest.ksh
+0-148sys/contrib/openzfs/module/os/linux/zfs/abd_os.c
+144-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_split_large_block.ksh
+786-298171 files not shown
+4,345-1,416177 files

HardenedBSD/src dd73fbasys/contrib/openzfs/cmd zhack.c, sys/contrib/openzfs/module/os/linux/zfs abd_os.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+305-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_zhack_reclaim.ksh
+178-0sys/contrib/openzfs/cmd/zhack.c
+159-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_degraded_import.ksh
+0-150sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user/zfs_send_usertest.ksh
+0-148sys/contrib/openzfs/module/os/linux/zfs/abd_os.c
+144-0sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_split_large_block.ksh
+786-298171 files not shown
+4,345-1,416177 files