FreeBSD/src 23216f6usr.sbin/certctl certctl.c

certctl: Enforce 0444 mode on new files

When writing to a file, call fchmod() to ensure the file mode matches
the intended mode, which is 0444.  This was already done when replacing
an existing file, but not when creating a new file, which meant if the
process umask was 077, the resulting certificates and bundle would be
unreadable by unprivileged users.

MFC after:      1 week
Reviewed by:    des
Differential Revision:  https://reviews.freebsd.org/D58304

(cherry picked from commit 02f174179a538f89185d275b4e64277baf3acc50)
DeltaFile
+4-0usr.sbin/certctl/certctl.c
+4-01 files

FreeBSD/src 8710a12cddl/lib/libdtrace siftr.d

libdtrace: Fix up one more translator

Fixes:  d8bcb13b79b4 ("libdtrace: Fix up translators after struct in_conninfo changes")
DeltaFile
+2-2cddl/lib/libdtrace/siftr.d
+2-21 files

FreeBSD/src 815976esys/kern uipc_ktls.c kern_mbuf.c, sys/sys mbuf.h

ktls: Propagate EPG_FLAG_ANON to mapped mbufs

Otherwise ktls_mbuf_crypto_state() will reject mbufs created by
_mb_unmapped_to_ext(), which arises when transmitting packets through an
interface that doesn't support unmapped mbufs, and the loopback
interface in particular.

PR:             296498
Fixes:          3444414cb463 ("ktls: Don't attempt to modify non-anonymous mbufs on the receive path")
Reviewed by:    gallatin, jhb
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57557
DeltaFile
+2-1sys/kern/uipc_ktls.c
+3-0sys/kern/kern_mbuf.c
+1-0sys/sys/mbuf.h
+6-13 files

FreeBSD/src 248d537sys/dev/sdhci sdhci_pci.c sdhci.h

sdhci: don't infer a non-removable slot on Apollo Lake SDXC

Intel Apollo Lake SDXC controller reports a Slot Type of
"Embedded Slot for One Device" in SDHCI_CAPABILITIES bits, even
when the slot is a removable card reader.
This caused 48 timeouts before the boot sequence resumed.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D58467
DeltaFile
+2-1sys/dev/sdhci/sdhci.c
+2-0sys/dev/sdhci/sdhci.h
+1-0sys/dev/sdhci/sdhci_pci.c
+5-13 files

FreeBSD/src 5f74217share/man/man4 coreboot.4, sys/dev/coreboot coreboot_cbmem.c coreboot_console.c

coreboot: Add coreboot firmware table driver

Nexus-attached driver that discovers and parses coreboot's LBIO tables
from physical memory. Exposes firmware metadata (version, build info,
mainboard, serial config, TSC frequency, CBMEM entries) via sysctl
hw.coreboot.*, the firmware console ring buffer via /dev/coreboot_console,
and structured CBMEM entry access via /dev/cbmem ioctl interface.

Tested on:
- Qotom Q535G6 (Kabylake)
- Intel NUC D54250WYK (Haswell)
- Intel NUC D33217GKE (Ivy Bridge)
- Dell 3100 2-in-1 (Gabbiter)
- Dell 3100 (Fleex)
- Lenovo IdeaPad 320s
- Lenovo ThinkPad T480
- HP Chromebook 11 G4
- HP Chromebook 11 G5
- HP Chromebook 11 G6 EE

    [11 lines not shown]
DeltaFile
+1,502-0sys/dev/coreboot/coreboot.c
+632-0sys/dev/coreboot/coreboot.h
+355-0share/man/man4/coreboot.4
+214-0sys/dev/coreboot/coreboot_timestamps.c
+192-0sys/dev/coreboot/coreboot_console.c
+151-0sys/dev/coreboot/coreboot_cbmem.c
+3,046-08 files not shown
+3,198-214 files

FreeBSD/src ea44c37sys/dev/irdma fbsd_kcompat.h irdma_kcompat.c, sys/ofed/drivers/infiniband/core ib_verbs.c

OFED: Add generic function to extract IB speed from netdev

Reviewed by:    kib
Obtained from:  Linux commit d41861942fc55c14b6280d9568a0d0112037f065
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D57952
DeltaFile
+0-102sys/dev/irdma/irdma_kcompat.c
+48-0sys/ofed/drivers/infiniband/core/ib_verbs.c
+2-0sys/ofed/include/rdma/ib_verbs.h
+0-1sys/dev/irdma/fbsd_kcompat.h
+50-1034 files

FreeBSD/src ee7258ctools/tools/git Makefile

tools/tools/git: Add git-mfc to Makefile similar to git-arc

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D58531
DeltaFile
+2-2tools/tools/git/Makefile
+2-21 files

FreeBSD/src ec73badlibexec/rtld-elf map_object.c

rtld: Remove write-only text_end local variable from map_object

Reviewed by:    kib
Fixes:          561991144e42 ("Remove Obj_Entry textsize member.")
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D58522
DeltaFile
+0-7libexec/rtld-elf/map_object.c
+0-71 files

FreeBSD/src b9ea73ctools/tools/git git-arc.sh

git-arc: Make git arc patch -r smarter

- Make it work even when git arc isn't run from the root of the repo.
- If the patch fails to apply, let git partially apply the patch and
  generate rej files for inspection.

While here, remove the return value from apply_rev(), it's never
actually used.

Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D58532
DeltaFile
+5-5tools/tools/git/git-arc.sh
+5-51 files

FreeBSD/src d8bcb13cddl/lib/libdtrace udplite.d udp.d

libdtrace: Fix up translators after struct in_conninfo changes

Fixes:  698402f4f97c ("inpcb: declare struct in_conninfo as a single declaration")
DeltaFile
+2-2cddl/lib/libdtrace/udplite.d
+2-2cddl/lib/libdtrace/udp.d
+2-2cddl/lib/libdtrace/tcp.d
+6-63 files

FreeBSD/src 88f1161sys/opencrypto crypto.c

OCF: Add a fail point to inject EBADMSG decryption errors

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+16-0sys/opencrypto/crypto.c
+16-01 files

FreeBSD/src 825c6f4etc/mtree BSD.tests.dist, tests/sys/net Makefile

wg(4): Add a test that the driver handles a decryption failure

The test uses a fail point to inject a decryption error in OCF while
sending a ping across the tunnel.  The driver should then fail to
respond to the ping and increment the input error counter on the
interface.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+111-0tests/sys/net/wg/if_wg_nojail.sh
+10-0tests/sys/net/wg/Makefile
+2-0etc/mtree/BSD.tests.dist
+1-0tests/sys/net/Makefile
+124-04 files

FreeBSD/src 89a88e4sys/kern imgact_elf.c

coredump: Don't assume that the number of ELF segments is consistent

In an ELF coredump, each dumped vm_map_entry is represented by a
segment.  __elfN(coredump) first computes the number of segments by
looping over the vm_map entries (in each_dumpable_segment()), then
allocates a buffer to hold the ELF header and program headers, then
loops over the entries again to populate the program headers.

each_dumpable_segment() holds the vm_map read lock, but that lock is
dropped between the two calls.  If the map is shared with another
process, via rfork(), then the map can change.  cb_put_phdr() did not
account for this, and so could write out of bounds.

Add a check to prevent this; simply do not write out excess segments.

Approved by:    so
Security:       FreeBSD-SA-26:55.elf
Security:       CVE-2026-58088
Reported by:    Maik Muench of Secfault Security

    [3 lines not shown]
DeltaFile
+19-3sys/kern/imgact_elf.c
+19-31 files

FreeBSD/src 4cb888csys/dev/wg wg_crypto.c

wg(4): Check for crypto operation errors

In particular, handle authentication errors due to bad MACs when
decrypting packets.

Since the current dispatch code assumes synchronous OCF sessions by
design, explicitly reject any created OCF session that is not
synchronous.  Software sessions are always synchronous in practice, so
this should be a nop.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+10-1sys/dev/wg/wg_crypto.c
+10-11 files

FreeBSD/src 8b08ee9sys/kern sysv_sem.c

sysvsem: Fix a TOCTOU race in semctl({GET,SET}ALL)

These commands take a snapshot of the size of a semaphore set, then drop
the lock and malloc an appropriately sized array before reacquiring the
lock.  A comment explains why this is (probably) safe.  Unfortunately,
it's wrong; it is indeed possible for a malicious userspace to create
and destroy 2^{15} sets in the window where the lock is dropped.  This
race can lead to out-of-bounds reads and writes, and that can be
exploited to elevate privileges.

Replace the assertions with runtime checks.

Approved by:    so
Security:       FreeBSD-SA-26:54.sysvsem
Security:       CVE-2026-58087
Reported by:    Maik Muench of Secfault Security
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58421
DeltaFile
+16-20sys/kern/sysv_sem.c
+16-201 files

FreeBSD/src 008d3basys/kern imgact_elf.c

coredump: Don't assume that the number of ELF segments is consistent

In an ELF coredump, each dumped vm_map_entry is represented by a
segment.  __elfN(coredump) first computes the number of segments by
looping over the vm_map entries (in each_dumpable_segment()), then
allocates a buffer to hold the ELF header and program headers, then
loops over the entries again to populate the program headers.

each_dumpable_segment() holds the vm_map read lock, but that lock is
dropped between the two calls.  If the map is shared with another
process, via rfork(), then the map can change.  cb_put_phdr() did not
account for this, and so could write out of bounds.

Add a check to prevent this; simply do not write out excess segments.

Approved by:    so
Security:       FreeBSD-SA-26:55.elf
Security:       CVE-2026-58088
Reported by:    Maik Muench of Secfault Security

    [3 lines not shown]
DeltaFile
+19-3sys/kern/imgact_elf.c
+19-31 files

FreeBSD/src cb7cb40sys/kern kern_event.c, sys/sys event.h

kqueue: Avoid enqueuing an already-enqueued knote

knotes with a non-trivial f_copy implementation may be activated before
kqueue_fork_copy_knote() is finished.  In particular, it may be enqueued
at the time that kqueue_fork_copy_knote() calls knote_enqueue().  Guard
against this.

Add a test case which triggers the race.

Fix several other problems with the replication of knote state:
- Make sure only the KN_ACTIVE and KN_DISABLED status flags are
  inherited, the rest should not be copied.
- Ignore marker knotes.
- Ignore knotes for kqueues.  They cannot be safely copied into the
  child without more work, as kqueues are inherently local to a process;
  on fork, we need to ensure that such knotes are patched to reference
  the new kqueue, not the original.
- Try to keep knote state stable by holding the kqueue and knlist locks
  while copying.

    [8 lines not shown]
DeltaFile
+35-8sys/kern/kern_event.c
+36-0tests/sys/kqueue/kqueue_fork.c
+1-0sys/sys/event.h
+72-83 files

FreeBSD/src e258568sys/kern sysv_sem.c

sysvsem: Fix a TOCTOU race in semctl({GET,SET}ALL)

These commands take a snapshot of the size of a semaphore set, then drop
the lock and malloc an appropriately sized array before reacquiring the
lock.  A comment explains why this is (probably) safe.  Unfortunately,
it's wrong; it is indeed possible for a malicious userspace to create
and destroy 2^{15} sets in the window where the lock is dropped.  This
race can lead to out-of-bounds reads and writes, and that can be
exploited to elevate privileges.

Replace the assertions with runtime checks.

Approved by:    so
Security:       FreeBSD-SA-26:54.sysvsem
Security:       CVE-2026-58087
Reported by:    Maik Muench of Secfault Security
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58421
DeltaFile
+16-20sys/kern/sysv_sem.c
+16-201 files

FreeBSD/src dbd5593sys/dev/wg wg_crypto.c

wg(4): Check for crypto operation errors

In particular, handle authentication errors due to bad MACs when
decrypting packets.

Since the current dispatch code assumes synchronous OCF sessions by
design, explicitly reject any created OCF session that is not
synchronous.  Software sessions are always synchronous in practice, so
this should be a nop.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+10-1sys/dev/wg/wg_crypto.c
+10-11 files

FreeBSD/src cd14473sys/opencrypto crypto.c

OCF: Add a fail point to inject EBADMSG decryption errors

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+15-0sys/opencrypto/crypto.c
+15-01 files

FreeBSD/src fb432f5sys/kern kern_jail.c

jail: restore ktrace privileges for jailed root

Commit 4be491e1b9b3 ("jail: Optionally allow audit session state to
be configured in a jail") removed the #if 0 around the audit cases
in prison_priv_check() and added the PR_ALLOW_SETAUDIT check under
them.  This unintentionally captured the preceding case PRIV_KTRACE,
which used to fall through the disabled block into the unconditional
return (0) of the credential cases: since then, jailed root only has
ktrace privileges (tracing processes with changed credentials, see
ktrcanset()) when the unrelated allow.setaudit knob is enabled, and
conversely gains them when that audit knob is turned on.

Give PRIV_KTRACE back its own unconditional return (0), matching its
comment and the pre-4be491e1b9b3 behaviour.

Approved by:    so
Security:       FreeBSD-SA-26:53.ktrace
Security:       CVE-2026-58086
Fixes:          4be491e1b9b3 ("jail: Optionally allow audit session state to be configured in a jail")

    [2 lines not shown]
DeltaFile
+1-0sys/kern/kern_jail.c
+1-01 files

FreeBSD/src 4c40cb6etc/mtree BSD.tests.dist, tests/sys/net Makefile

wg(4): Add a test that the driver handles a decryption failure

The test uses a fail point to inject a decryption error in OCF while
sending a ping across the tunnel.  The driver should then fail to
respond to the ping and increment the input error counter on the
interface.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+111-0tests/sys/net/wg/if_wg_nojail.sh
+10-0tests/sys/net/wg/Makefile
+2-0etc/mtree/BSD.tests.dist
+1-0tests/sys/net/Makefile
+124-04 files

FreeBSD/src 7893a7esys/kern imgact_elf.c

coredump: Don't assume that the number of ELF segments is consistent

In an ELF coredump, each dumped vm_map_entry is represented by a
segment.  __elfN(coredump) first computes the number of segments by
looping over the vm_map entries (in each_dumpable_segment()), then
allocates a buffer to hold the ELF header and program headers, then
loops over the entries again to populate the program headers.

each_dumpable_segment() holds the vm_map read lock, but that lock is
dropped between the two calls.  If the map is shared with another
process, via rfork(), then the map can change.  cb_put_phdr() did not
account for this, and so could write out of bounds.

Add a check to prevent this; simply do not write out excess segments.

Approved by:    so
Security:       FreeBSD-SA-26:55.elf
Security:       CVE-2026-58088
Reported by:    Maik Muench of Secfault Security

    [3 lines not shown]
DeltaFile
+19-3sys/kern/imgact_elf.c
+19-31 files

FreeBSD/src 8c5e2d2sys/kern sysv_sem.c

sysvsem: Fix a TOCTOU race in semctl({GET,SET}ALL)

These commands take a snapshot of the size of a semaphore set, then drop
the lock and malloc an appropriately sized array before reacquiring the
lock.  A comment explains why this is (probably) safe.  Unfortunately,
it's wrong; it is indeed possible for a malicious userspace to create
and destroy 2^{15} sets in the window where the lock is dropped.  This
race can lead to out-of-bounds reads and writes, and that can be
exploited to elevate privileges.

Replace the assertions with runtime checks.

Approved by:    so
Security:       FreeBSD-SA-26:54.sysvsem
Security:       CVE-2026-58087
Reported by:    Maik Muench of Secfault Security
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58421
DeltaFile
+16-20sys/kern/sysv_sem.c
+16-201 files

FreeBSD/src 3427182sys/dev/wg wg_crypto.c

wg(4): Check for crypto operation errors

In particular, handle authentication errors due to bad MACs when
decrypting packets.

Since the current dispatch code assumes synchronous OCF sessions by
design, explicitly reject any created OCF session that is not
synchronous.  Software sessions are always synchronous in practice, so
this should be a nop.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+10-1sys/dev/wg/wg_crypto.c
+10-11 files

FreeBSD/src d8bdcb0sys/kern kern_event.c, sys/sys event.h

kqueue: Avoid enqueuing an already-enqueued knote

knotes with a non-trivial f_copy implementation may be activated before
kqueue_fork_copy_knote() is finished.  In particular, it may be enqueued
at the time that kqueue_fork_copy_knote() calls knote_enqueue().  Guard
against this.

Add a test case which triggers the race.

Fix several other problems with the replication of knote state:
- Make sure only the KN_ACTIVE and KN_DISABLED status flags are
  inherited, the rest should not be copied.
- Ignore marker knotes.
- Ignore knotes for kqueues.  They cannot be safely copied into the
  child without more work, as kqueues are inherently local to a process;
  on fork, we need to ensure that such knotes are patched to reference
  the new kqueue, not the original.
- Try to keep knote state stable by holding the kqueue and knlist locks
  while copying.

    [8 lines not shown]
DeltaFile
+35-8sys/kern/kern_event.c
+36-0tests/sys/kqueue/kqueue_fork.c
+1-0sys/sys/event.h
+72-83 files

FreeBSD/src 490365esys/kern kern_jail.c

jail: restore ktrace privileges for jailed root

Commit 4be491e1b9b3 ("jail: Optionally allow audit session state to
be configured in a jail") removed the #if 0 around the audit cases
in prison_priv_check() and added the PR_ALLOW_SETAUDIT check under
them.  This unintentionally captured the preceding case PRIV_KTRACE,
which used to fall through the disabled block into the unconditional
return (0) of the credential cases: since then, jailed root only has
ktrace privileges (tracing processes with changed credentials, see
ktrcanset()) when the unrelated allow.setaudit knob is enabled, and
conversely gains them when that audit knob is turned on.

Give PRIV_KTRACE back its own unconditional return (0), matching its
comment and the pre-4be491e1b9b3 behaviour.

Approved by:    so
Security:       FreeBSD-SA-26:53.ktrace
Security:       CVE-2026-58086
Fixes:          4be491e1b9b3 ("jail: Optionally allow audit session state to be configured in a jail")

    [2 lines not shown]
DeltaFile
+1-0sys/kern/kern_jail.c
+1-01 files

FreeBSD/src db3afbeetc/mtree BSD.tests.dist, tests/sys/net Makefile

wg(4): Add a test that the driver handles a decryption failure

The test uses a fail point to inject a decryption error in OCF while
sending a ping across the tunnel.  The driver should then fail to
respond to the ping and increment the input error counter on the
interface.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+111-0tests/sys/net/wg/if_wg_nojail.sh
+10-0tests/sys/net/wg/Makefile
+2-0etc/mtree/BSD.tests.dist
+1-0tests/sys/net/Makefile
+124-04 files

FreeBSD/src 98bbfefsys/opencrypto crypto.c

OCF: Add a fail point to inject EBADMSG decryption errors

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+15-0sys/opencrypto/crypto.c
+15-01 files

FreeBSD/src 4007d91usr.sbin/boot0cfg boot0cfg.8 boot0cfg.c

boot0cfg: Also allow a file as a trailing argument

Modify the disk check to allow arbitrary files as the trailing argument
instead of requiring a live GEOM disk provider.

This enables modifying a boot0 binary file in-place before flashing it
to a disk via gpart bootcode, or using it directly as an argument to
mkimg's partition specification, as these tools cannot directly adjust
the parameters of the boot0 boot manager.

Reviewed by:    imp, jhb
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57310
DeltaFile
+34-6usr.sbin/boot0cfg/boot0cfg.c
+26-6usr.sbin/boot0cfg/boot0cfg.8
+60-122 files