FreeBSD/src 8a62a5fusr.sbin/syslogd syslogd.c syslogd_cap_config.c, usr.sbin/syslogd/tests syslogd_test.sh Makefile

syslogd: Handle connection errors when setting up forwarding sockets

Since syslogd was converted to run in a Capsicum sandbox, it needs to
explicitly connect() its forwarding sockets rather than using sendmsg().
At the time syslogd starts during boot, some of its forwarding
destinations may not be routable, in which case connect() fails.

Fix this by making connect() failures non-fatal, and use cap_net to
lazily connect sockets once something actually tries logging to the
destination.

Add a regression test.

Reported by:    ae
Reviewed by:    ae
Discussed with: jfree
Fixes:          4ecbee2760f7 ("syslogd: Open forwarding socket descriptors")
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D57394
DeltaFile
+111-23usr.sbin/syslogd/syslogd.c
+69-0usr.sbin/syslogd/tests/syslogd_test.sh
+7-0usr.sbin/syslogd/syslogd_cap_config.c
+1-2usr.sbin/syslogd/tests/Makefile
+188-254 files

FreeBSD/src 1361901tools/tools/git git-mfc git-mfc.1

tools: Add git-mfc

This is a utility that effectively wraps git-cherry-pick for performing
MFCs, though it has some other usages.  In addition to actually
cherry-pick the specified commits, it looks at the upstream branch for
fixup commits, denoted by a `Fixes:` tag which references the fixed
commit.

Aside from actually cherry-picking commits, git-mfc can also be used to
list pending MFCs (commits in the upstream branch which are eligible for
MFC based on the `MFC after` tag), and "dangling" MFCs, where a commit
was MFCed to the currently checked out stable branch, and the upstream
branch has one or more fixup commits which have not been merged.

The utility requires python and the gitpython module.

Reviewed by:    des
Differential Revision:  https://reviews.freebsd.org/D57845
DeltaFile
+523-0tools/tools/git/git-mfc
+288-0tools/tools/git/git-mfc.1
+811-02 files

FreeBSD/src 76aa776stand/common gfx_fb.c

stand: Fix shadow buffer offset handling

The shadow buffer is addressed relative to `tg_origin`, which includes
the padding offset, whereas `gfxfb_blt` operates on coordinates without
that offset. To make `gfx_fb_copy_area` emulate the behavior of
`gfxfb_blt`, the source coordinates must include the padding offset,
while the destination coordinates must not. The original implementation
omitted the offset from the source coordinates; this change corrects
that.

Additionally, `gfx_fb_cons_display` already applies the padding offset,
so the redundant adjustment is removed.

PR:             296246
Reported by:    2khramtsov at gmail.com
Reviewed by:    imp
Tested by:      2khramtsov at gmail.com, junchoon at dec.sakura.ne.jp,
naito.yuichiro_ at gmail.com
Fixes:          32da2f23ae4d

    [3 lines not shown]
DeltaFile
+15-11stand/common/gfx_fb.c
+15-111 files

FreeBSD/src eca2680sys/kern kern_sig.c subr_syscall.c, sys/sys sysent.h

kern: syscall_thread_enter() cannot fail

Attempting to handle the error gracefully can easily result in missing
SIGSYS, so this was made to always succeed in
39024a89146 ("syscalls: fix missing SIGSYS for several ENOSYS errors")
and returns the nosys entry on failure.

Drop the pretense of returning an error and clean up a few dead error
paths.

Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D57848
DeltaFile
+2-6sys/kern/kern_sig.c
+1-5sys/kern/subr_syscall.c
+2-3sys/kern/kern_syscalls.c
+1-1sys/sys/sysent.h
+6-154 files

FreeBSD/src 1756d1csys/opencrypto ktls_ocf.c

ktls CBC decrypt: Avoid creating zero length iovec entries

If an mbuf's length in the chain for an encrypted TLS record exactly
matches the remaining length of header bytes to skip, skip the mbuf
entirely rather than adding a zero-length iovec entry.

Sponsored by:   Chelsio Communications
DeltaFile
+1-1sys/opencrypto/ktls_ocf.c
+1-11 files

FreeBSD/src b3041aclib/libiconv_modules/HZ citrus_hz.c, lib/libiconv_modules/UTF7 citrus_utf7.c

iconv(3): Fix problems in various encodings

Fix null pointer dereference with HZ8 encoding.

Fix output buffer overrun in UTF-7, VIQR, ZW encodings.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58081
Reviewed by:    markj, kevans
Differential Revision:  https://reviews.freebsd.org/D57947
DeltaFile
+15-5lib/libiconv_modules/UTF7/citrus_utf7.c
+5-2lib/libiconv_modules/ZW/citrus_zw.c
+5-1lib/libiconv_modules/VIQR/citrus_viqr.c
+2-0lib/libiconv_modules/HZ/citrus_hz.c
+27-84 files

FreeBSD/src 034e21econtrib/netbsd-tests/lib/libc/locale t_iconv.c, lib/libiconv_modules/ISO2022 citrus_iso2022.c

iconv: Fix a stack buffer overflow in _ISO2022_sputwchar()

In the ISO2022-CN encoding, characters may require at least seven bytes,
and MB_LEN_MAX==6 is insufficient.  From code inspection,
_ISO2022_sputwchar() can emit 10 bytes in the worst case, so use that to
size buffers.

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58082
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D57950
DeltaFile
+20-0contrib/netbsd-tests/lib/libc/locale/t_iconv.c
+4-4lib/libiconv_modules/ISO2022/citrus_iso2022.c
+24-42 files

FreeBSD/src 10a7683contrib/netbsd-tests/lib/libc/locale t_iconv.c, lib/libc/tests/locale Makefile

iconv(3): Draft some automatic tests.

Based on a report by Nick Wellnhofer.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Reviewed by:    markj, kevans
Differential Revision:  https://reviews.freebsd.org/D57948
DeltaFile
+355-0contrib/netbsd-tests/lib/libc/locale/t_iconv.c
+1-0lib/libc/tests/locale/Makefile
+356-02 files

FreeBSD/src e4e6250sys/opencrypto ktls_ocf.c, tests/sys/kern ktls_test.c

ktls CBC decrypt: Only increment iovec index when an entry is used

If an mbuf in the chain was skipped because it only contained bytes
from the header, the iovec index ('i') was incremented even though the
entry was not populated.  Only increment 'i' when an iovec entry is
consumed.

Add a new type of KTLS receive test which writes a single TLS record
via two separate write(2) calls over a TCP_NODELAY socket to trigger
a split in the mbuf chain in the kernel.  Test various split locations
including after the "plain" TLS header (5 bytes), after the full TLS
header, in the middle of the data payload, just before the start of
the trailer, and in the middle of the trailer.  These tests are also
run against all supported ciphers, not just CBC.  The 'header' test
for CBC ciphersuites was able to trigger the bug.

Approved by:    so
Security:       FreeBSD-SA-26:46.ktls
Security:       CVE-2026-49423
Sponsored by:   Chelsio Communications
DeltaFile
+108-2tests/sys/kern/ktls_test.c
+2-1sys/opencrypto/ktls_ocf.c
+110-32 files

FreeBSD/src 5499a34sys/kern uipc_shm.c, tests/sys/posixshm posixshm_test.c

posixshm: Disallow truncation of largepage objects

We correctly handled ftruncate(), but not open(O_TRUNC).

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:44.posixshm
Security:       CVE-2026-49428
Reported by:    Chris Jarrett-Davies <chrisjd at openai.com>
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57831
DeltaFile
+38-0tests/sys/posixshm/posixshm_test.c
+3-5sys/kern/uipc_shm.c
+41-52 files

FreeBSD/src ec19899sys/kern kern_sig.c

kern: fix auditing of ptrace(2) syscall requests

`error` here is the return value of syscall_thread_enter() rather than
the syscall itself, so the committed audit records do not reflect
reality.  This is less harmful than them recording an error when the
operation actually succeeded, but it could still possibly be used to
throw off IDS techniques with things like bsmtrace.

Approved by:    so
Security:       FreeBSD-SA-26:45.audit
Security:       CVE-2026-49426
Reviewed by:    des, kib, markj, csjp
Differential Revision:  https://reviews.freebsd.org/D57847
DeltaFile
+1-1sys/kern/kern_sig.c
+1-11 files

FreeBSD/src 1546794tests/sys/netinet/libalias smedia.c Makefile

tests/libalias: Add a regression test for an alias_smedia bug

Approved by:    so
Security:       FreeBSD-SA-26:41.libalias
Security:       CVE-2026-49420
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57747
DeltaFile
+74-0tests/sys/netinet/libalias/smedia.c
+4-0tests/sys/netinet/libalias/Makefile
+78-02 files

FreeBSD/src 45f1fcbsys/kern vfs_syscalls.c, tests/sys/kern resolve_beneath_test.c Makefile

unlinkat: Pass flags down to the work functions

The unlinkat(2) and funlinkat(2) system calls were ignoring
AT_RESOLVE_BENEATH.

Also pass pathseg through instead of assuming it's UIO_USERSPACE.

Add some tests which make sure that AT_RESOLVE_BENEATH is handled
properly by various system calls.

Approved by:    so
Security:       FreeBSD-SA-26:42.unlinkat
Security:       CVE-2026-49421
Reported by:    Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57790
DeltaFile
+220-0tests/sys/kern/resolve_beneath_test.c
+6-5sys/kern/vfs_syscalls.c
+1-0tests/sys/kern/Makefile
+227-53 files

FreeBSD/src 21929fbsys/vm device_pager.c vm_page.c, tests/sys/vm mmap_test.c

device_pager: Avoid double-insertion of pages into the pager list

Unmanaged device pager objects maintain a linked list of pages that were
returned from the fault handler.  Initially, such pages are valid, but
msync(MS_INVALIDATE) can mark them invalid (and clean).  They are not
removed from page tables (since they are unmanaged), but a subsequent
mlock() call can trigger a page fault that is handled by the pager.
dev_pager_getpages() then re-inserts the page into the linked list even
though it's already present there.

This patch fixes the problem by removing the linked list.  OBJ_PG_DTOR
is set, so vm_object_terminate_pages() does nothing, and
dev_pager_dealloc() instead handles cleanup of the object.

Add a regression test case which triggers a queue.h assertion failure in
unpatched kernels.

Note, in stable branches we should avoid changing the layout of struct
vm_object.

    [8 lines not shown]
DeltaFile
+20-16sys/vm/device_pager.c
+30-0tests/sys/vm/mmap_test.c
+4-2sys/vm/vm_page.c
+1-1sys/vm/vm_object.h
+55-194 files

FreeBSD/src cb5f47asys/netinet/libalias alias_smedia.c

libalias: Fix buffer overflow in RTSP aliasing

In alias_rtsp_out(), we construct a new packet in a fixed-length buffer
before copying it back into the original buffer.  We never checked if
the data we were writing to this temporary buffer fit in it, nor if the
result fit in the original buffer.

* Use a dynamically sized allocated buffer instead of a fixed-length
  stack buffer.

* Check for overflow before appending to our temporary buffer.

* Check for overflow before copying the data back to the packet buffer.

* While here, use size_t for sizes and bool for booleans.

Approved by:    so
Security:       FreeBSD-SA-26:41.libalias
Security:       CVE-2026-49420

    [3 lines not shown]
DeltaFile
+89-67sys/netinet/libalias/alias_smedia.c
+89-671 files

FreeBSD/src aed4c4dsys/netinet/tcp_stacks rack.c

rack: Reload the TCP stack PCB after reacquiring the inpcb lock

Malicious userspace might switch TCP stacks twice while the inpcb lock
is dropped.  If it does so, the validation of tp->t_fb might succeed,
but the saved pointer to the stack PCB might be invalid.  Reload it to
avoid this problem, as BBR already does.

Approved by:    so
Security:       FreeBSD-SA-26:43.tcp
Security:       CVE-2026-49422
Reported by:    Maik Münch
Reviewed by:    tuexen
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57791
DeltaFile
+1-0sys/netinet/tcp_stacks/rack.c
+1-01 files

FreeBSD/src 57e7054sys/kern uipc_shm.c, tests/sys/posixshm posixshm_test.c

posixshm: Disallow fspacectl() on largepage objects

As with truncation, the operation isn't supported, but nothing prevented
it.

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:44.posixshm
Security:       CVE-2026-49428
Reported by:    Chris Jarrett-Davies <chrisjd at openai.com>
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57830
DeltaFile
+22-0tests/sys/posixshm/posixshm_test.c
+4-1sys/kern/uipc_shm.c
+26-12 files

FreeBSD/src abcc988lib/libiconv_modules/HZ citrus_hz.c

iconv: Fix a buffer overflow in the HZ encoding

wcrtomb may store up to 2 2-byte escape sequences to the state buffer in
addition to the character itself.  In the worst case, a 3-byte heap
overflow is possible.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58081
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D57949
DeltaFile
+1-1lib/libiconv_modules/HZ/citrus_hz.c
+1-11 files

FreeBSD/src 702f4c8sys/kern uipc_shm.c, sys/vm vm_page.c

posixshm: Fix handling of sendfile() with largepage objects

sendfile(2) can transmit POSIX shared memory objects.  Typically it will
look up and wire each page before sending it to a socket; once
transmission is complete, the page is unwired and typically released
back into the page queues.  sendfile() has an advisory flag, SF_NOCACHE,
which means, "try to free the page once transmission is complete."  This
is implemented in vm_page_release(), which expects to operate on managed
pages.

Pages belonging a largepage object are de-facto wired not explicitly so.
Thus, vm_page_release() will unwire and, having found no additional
references, free the page.  Because mappings of largepage objects are
unmanaged, userspace can still access the now freed page.

Fix the problem by explicitly wiring largepage pages.  Make the VM
object destructor responsible for unwiring and freeing them.

Add a regression test.

    [8 lines not shown]
DeltaFile
+89-0tests/sys/posixshm/posixshm_test.c
+13-10sys/vm/vm_page.c
+19-3sys/kern/uipc_shm.c
+121-133 files

FreeBSD/src a9d3259lib/libiconv_modules/HZ citrus_hz.c, lib/libiconv_modules/UTF7 citrus_utf7.c

iconv(3): Fix problems in various encodings

Fix null pointer dereference with HZ8 encoding.

Fix output buffer overrun in UTF-7, VIQR, ZW encodings.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58081
Reviewed by:    markj, kevans
Differential Revision:  https://reviews.freebsd.org/D57947
DeltaFile
+15-5lib/libiconv_modules/UTF7/citrus_utf7.c
+5-2lib/libiconv_modules/ZW/citrus_zw.c
+5-1lib/libiconv_modules/VIQR/citrus_viqr.c
+2-0lib/libiconv_modules/HZ/citrus_hz.c
+27-84 files

FreeBSD/src ba4c8ccsys/opencrypto ktls_ocf.c, tests/sys/kern ktls_test.c

ktls CBC decrypt: Only increment iovec index when an entry is used

If an mbuf in the chain was skipped because it only contained bytes
from the header, the iovec index ('i') was incremented even though the
entry was not populated.  Only increment 'i' when an iovec entry is
consumed.

Add a new type of KTLS receive test which writes a single TLS record
via two separate write(2) calls over a TCP_NODELAY socket to trigger
a split in the mbuf chain in the kernel.  Test various split locations
including after the "plain" TLS header (5 bytes), after the full TLS
header, in the middle of the data payload, just before the start of
the trailer, and in the middle of the trailer.  These tests are also
run against all supported ciphers, not just CBC.  The 'header' test
for CBC ciphersuites was able to trigger the bug.

Approved by:    so
Security:       FreeBSD-SA-26:46.ktls
Security:       CVE-2026-49423
Sponsored by:   Chelsio Communications
DeltaFile
+108-2tests/sys/kern/ktls_test.c
+2-1sys/opencrypto/ktls_ocf.c
+110-32 files

FreeBSD/src 5c7a97atests/sys/netinet/libalias smedia.c Makefile

tests/libalias: Add a regression test for an alias_smedia bug

Approved by:    so
Security:       FreeBSD-SA-26:41.libalias
Security:       CVE-2026-49420
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57747
DeltaFile
+74-0tests/sys/netinet/libalias/smedia.c
+4-0tests/sys/netinet/libalias/Makefile
+78-02 files

FreeBSD/src 1bad1d8sys/kern uipc_shm.c, sys/vm vm_page.c

posixshm: Fix handling of sendfile() with largepage objects

sendfile(2) can transmit POSIX shared memory objects.  Typically it will
look up and wire each page before sending it to a socket; once
transmission is complete, the page is unwired and typically released
back into the page queues.  sendfile() has an advisory flag, SF_NOCACHE,
which means, "try to free the page once transmission is complete."  This
is implemented in vm_page_release(), which expects to operate on managed
pages.

Pages belonging a largepage object are de-facto wired not explicitly so.
Thus, vm_page_release() will unwire and, having found no additional
references, free the page.  Because mappings of largepage objects are
unmanaged, userspace can still access the now freed page.

Fix the problem by explicitly wiring largepage pages.  Make the VM
object destructor responsible for unwiring and freeing them.

Add a regression test.

    [8 lines not shown]
DeltaFile
+89-0tests/sys/posixshm/posixshm_test.c
+13-10sys/vm/vm_page.c
+19-3sys/kern/uipc_shm.c
+121-133 files

FreeBSD/src 150df70contrib/netbsd-tests/lib/libc/locale t_iconv.c, lib/libiconv_modules/ISO2022 citrus_iso2022.c

iconv: Fix a stack buffer overflow in _ISO2022_sputwchar()

In the ISO2022-CN encoding, characters may require at least seven bytes,
and MB_LEN_MAX==6 is insufficient.  From code inspection,
_ISO2022_sputwchar() can emit 10 bytes in the worst case, so use that to
size buffers.

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58082
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D57950
DeltaFile
+20-0contrib/netbsd-tests/lib/libc/locale/t_iconv.c
+4-4lib/libiconv_modules/ISO2022/citrus_iso2022.c
+24-42 files

FreeBSD/src 713747fsys/kern uipc_shm.c, tests/sys/posixshm posixshm_test.c

posixshm: Disallow fspacectl() on largepage objects

As with truncation, the operation isn't supported, but nothing prevented
it.

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:44.posixshm
Security:       CVE-2026-49428
Reported by:    Chris Jarrett-Davies <chrisjd at openai.com>
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57830
DeltaFile
+22-0tests/sys/posixshm/posixshm_test.c
+4-1sys/kern/uipc_shm.c
+26-12 files

FreeBSD/src 8b24b19sys/kern vfs_syscalls.c, tests/sys/kern resolve_beneath_test.c Makefile

unlinkat: Pass flags down to the work functions

The unlinkat(2) and funlinkat(2) system calls were ignoring
AT_RESOLVE_BENEATH.

Also pass pathseg through instead of assuming it's UIO_USERSPACE.

Add some tests which make sure that AT_RESOLVE_BENEATH is handled
properly by various system calls.

Approved by:    so
Security:       FreeBSD-SA-26:42.unlinkat
Security:       CVE-2026-49421
Reported by:    Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57790
DeltaFile
+220-0tests/sys/kern/resolve_beneath_test.c
+6-5sys/kern/vfs_syscalls.c
+1-0tests/sys/kern/Makefile
+227-53 files

FreeBSD/src 8bc3abblib/libiconv_modules/HZ citrus_hz.c

iconv: Fix a buffer overflow in the HZ encoding

wcrtomb may store up to 2 2-byte escape sequences to the state buffer in
addition to the character itself.  In the worst case, a 3-byte heap
overflow is possible.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Security:       CVE-2026-58081
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D57949
DeltaFile
+1-1lib/libiconv_modules/HZ/citrus_hz.c
+1-11 files

FreeBSD/src 2ee2274contrib/netbsd-tests/lib/libc/locale t_iconv.c, lib/libc/tests/locale Makefile

iconv(3): Draft some automatic tests.

Based on a report by Nick Wellnhofer.

Approved by:    so
Security:       FreeBSD-SA-26:49.iconv
Reviewed by:    markj, kevans
Differential Revision:  https://reviews.freebsd.org/D57948
DeltaFile
+352-0contrib/netbsd-tests/lib/libc/locale/t_iconv.c
+1-0lib/libc/tests/locale/Makefile
+353-02 files

FreeBSD/src bcbbee8sys/kern kern_sig.c

kern: fix auditing of ptrace(2) syscall requests

`error` here is the return value of syscall_thread_enter() rather than
the syscall itself, so the committed audit records do not reflect
reality.  This is less harmful than them recording an error when the
operation actually succeeded, but it could still possibly be used to
throw off IDS techniques with things like bsmtrace.

Approved by:    so
Security:       FreeBSD-SA-26:45.audit
Security:       CVE-2026-49426
Reviewed by:    des, kib, markj, csjp
Differential Revision:  https://reviews.freebsd.org/D57847
DeltaFile
+1-1sys/kern/kern_sig.c
+1-11 files

FreeBSD/src 1491decsys/kern uipc_shm.c, tests/sys/posixshm posixshm_test.c

posixshm: Disallow truncation of largepage objects

We correctly handled ftruncate(), but not open(O_TRUNC).

Add a regression test.

Approved by:    so
Security:       FreeBSD-SA-26:44.posixshm
Security:       CVE-2026-49428
Reported by:    Chris Jarrett-Davies <chrisjd at openai.com>
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57831
DeltaFile
+38-0tests/sys/posixshm/posixshm_test.c
+3-5sys/kern/uipc_shm.c
+41-52 files