HardenedBSD/src 761157busr.bin/rpcinfo Makefile

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-5usr.bin/rpcinfo/Makefile
+0-51 files

HardenedBSD/src 5677172sys/kern kern_event.c, sys/net if.c

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

Conflicts:
        usr.bin/rpcinfo/Makefile (unresolved)
DeltaFile
+83-65usr.bin/rpcinfo/rpcinfo.c
+100-0tests/sys/netinet/fib_bind.py
+30-32sys/kern/kern_event.c
+41-0sys/vm/vm_phys.c
+31-0tests/sys/kern/unix_passfd_test.c
+23-6sys/net/if.c
+308-10326 files not shown
+519-13232 files

HardenedBSD/src 9989894sys/arm64/include vm.h

vm: Remove a reference to an undefined memattr

This is a direct commit to stable/15.

Reported by:    jenkins
Fixes:          c4ea6b08e24e ("vm_phys: Add a sysctl to dump registered fictitious memory ranges")
DeltaFile
+0-2sys/arm64/include/vm.h
+0-21 files

HardenedBSD/src 7f1009dsys/net if_var.h if.c

net/if.c: Add fib-aware ifa_ifwithaddr()

Add FIB selection logic by introducing ifa_ifwithaddr_fib() to
support FIB-specific lookups. Then have ifa_ifwithaddr() wrap it
with RT_ALL_FIBS.
Also, do the same for ifa_ifwithaddr_check().

Reviewed by:    glebius, bnovkov
Differential Revision: https://reviews.freebsd.org/D58305

(cherry picked from commit b00d30950cde27eda8f51523a40f2c05a38daac1)
DeltaFile
+23-6sys/net/if.c
+2-0sys/net/if_var.h
+25-62 files

HardenedBSD/src 978b902sys/netinet in_pcb.c raw_ip.c, sys/netinet6 in6_pcb.c raw_ip6.c

bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active

When a protocol-specific 'bind_all_fibs' tunable is set to 0, a
listening socket will only receive traffic originating from the FIB
it was bound to. However, there are no checks to determine whether
an address exists in the target FIB when binding the socket, which can
lead to a situation where a socket and the address it was bound to
belong to different FIBs.

Prevent this footgun by looking up the requested address in the current
FIB if 'bind_all_fibs' is active and returning an error if the address
does not exist.

Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D58281
Reviewed by:    glebius, pouria, markj
MFC after:      2 weeks

(cherry picked from commit 948ad32ae1e0811f45e1d38f26636fefed5051f0)
DeltaFile
+100-0tests/sys/netinet/fib_bind.py
+5-2sys/netinet6/raw_ip6.c
+5-2sys/netinet/raw_ip.c
+1-1sys/netinet6/in6_pcb.c
+1-1sys/netinet/in_pcb.c
+1-0tests/sys/netinet/Makefile
+113-66 files

HardenedBSD/src 096b824sys/amd64/include vm.h, sys/arm/include vm.h

vm: Make sure NULL is defined for vm_memattr_name()

Fixes:  a7e483ee146a ("vm_phys: Add a sysctl to dump registered fictitious memory ranges")
(cherry picked from commit 11edc985cd9c2e1dcceccb7e929c6921b4e20c9b)
DeltaFile
+2-0sys/riscv/include/vm.h
+2-0sys/powerpc/include/vm.h
+2-0sys/i386/include/vm.h
+2-0sys/arm64/include/vm.h
+2-0sys/arm/include/vm.h
+2-0sys/amd64/include/vm.h
+12-06 files

HardenedBSD/src 9cc432dsys/arm64/include vm.h

arm64: Fix the build

Fixes:  a7e483ee146a ("vm_phys: Add a sysctl to dump registered fictitious memory ranges")
(cherry picked from commit 91b419bc7e15f2138cb211c4d7c5be118c377c20)
DeltaFile
+2-0sys/arm64/include/vm.h
+2-01 files

HardenedBSD/src 1ede9ecsys/kern kern_event.c

kqueue: Associate marker knotes with a queue

Otherwise the assertion in KQ_FLUX_SLEEP_WMESG may fail.

kqueue_fork_copy() already handles this.

Fixes:          1f4b0ea4f3eb ("kqueue: Add a helper macro for sleeping on in-flux knotes")
Reported by:    syzkaller
Reported by:    kbowling
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58516

(cherry picked from commit 9a9349ea1da2d80e979fa87b430551d8f6dac7f4)
DeltaFile
+1-0sys/kern/kern_event.c
+1-01 files

HardenedBSD/src 78dfadausr.sbin/ppp mp.c

ppp: Avoid overflow when formatting endpoint discriminator options

Each byte of the address is represented by a pair of characters, so we
should be multiplying len by 2 when figuring out how much buffer space
we have.  Previously, a sufficiently large option could cause an
overflow of the global "result" buffer.

Reported by:    Joshua Rogers <joshua at joshua.hu>
Tested by:      Décio Brandão (0xDBJ)
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58555

(cherry picked from commit e004ff15f87e6aa8f2aa13cd5600ae13457b95f1)
DeltaFile
+6-6usr.sbin/ppp/mp.c
+6-61 files

HardenedBSD/src 31d9493sys/kern kern_event.c

kqueue: Add a helper macro for sleeping on in-flux knotes

Other in-flux operations are implemented by this set of macros, so we
should do the same for sleeping.

No functional change intended.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58443

(cherry picked from commit 1f4b0ea4f3eb1b8a885eff8bd0d332156f0c3e1f)
DeltaFile
+16-16sys/kern/kern_event.c
+16-161 files

HardenedBSD/src c4ea6b0sys/amd64/include vm.h, sys/arm/include vm.h

vm_phys: Add a sysctl to dump registered fictitious memory ranges

I've wanted this a couple of times in the past.  Save the memattr in
the fictitious memory segment structure so that we can report it from
the sysctl handler, and add conversion routines for each platform.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58283

(cherry picked from commit a7e483ee146a93ac89357676fdb9af62ac58b4bc)
DeltaFile
+41-0sys/vm/vm_phys.c
+23-2sys/arm64/include/vm.h
+25-0sys/powerpc/include/vm.h
+23-0sys/i386/include/vm.h
+23-0sys/amd64/include/vm.h
+19-0sys/arm/include/vm.h
+154-21 files not shown
+171-27 files

HardenedBSD/src 9d2e503sys/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

(cherry picked from commit 815976ee14121bafe8a8ab002459d32f8928f2de)
DeltaFile
+2-1sys/kern/uipc_ktls.c
+3-0sys/kern/kern_mbuf.c
+1-0sys/sys/mbuf.h
+6-13 files

HardenedBSD/src c68c705sys/netipsec ipsec.c

ipsec: Fix a lock leak in ipsec_chkreplay()

Reported by:    Chris Jarrett-Davies of the OpenAI Codex Security Team
Reviewed by:    pouria, kp
Fixes:          0361f165f219 ("ipsec: replace SECASVAR  mtx by rmlock")
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58521

(cherry picked from commit b6823a973737f06ea6cf0ea5a3083383af2ba5a4)
DeltaFile
+3-1sys/netipsec/ipsec.c
+3-11 files

HardenedBSD/src 31765e2usr.bin/rpcinfo Makefile rpcinfo.c

rpcinfo: Fix residual warnings and bump WARNS

Reviewed by:    emaste
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58442

(cherry picked from commit 95a3301ce144aecce5de88fb4e2905c440533fb8)
DeltaFile
+16-15usr.bin/rpcinfo/rpcinfo.c
+0-2usr.bin/rpcinfo/Makefile
+16-172 files

HardenedBSD/src b35a7dbsys/kern kern_event.c

kqueue: Allocate marker knotes on the stack

The scan marker was originally stack-allocated.  In commit
1c0f9af5b5224, it became heap-allocated since the marker is visible to
other threads and a scanning thread's stack may be swapped out.  Now
that kernel stacks can no longer be swapped out, we can avoid these heap
allocations.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58402

(cherry picked from commit bb933b1d1846b3a984670b8cd65450c3333188f6)
DeltaFile
+13-16sys/kern/kern_event.c
+13-161 files

HardenedBSD/src 984a397stand/common load_elf.c

stand: Recognize SHT_INIT_ARRAY sections as constructor sections

Pass such a section to the kernel using modinfo, otherwise link_elf.c
won't execute constructors for the file.  This is required for KASAN,
otherwise redzones for global buffers are not poisoned during boot.

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58244

(cherry picked from commit 4b0ae7e001a97e5449835bb8a2e6c2e6f53aac39)
DeltaFile
+2-1stand/common/load_elf.c
+2-11 files

HardenedBSD/src 3101f41usr.bin/rpcinfo rpcinfo.c

rpcinfo: Fix buffer overflows

Several functions were using sprintf() to write RPC server-controlled
data to a stack buffer.  Adopt some minimal changes from NetBSD to avoid
the potential overflows.

Security:       CVE-2026-16277
Security:       CVE-2026-16461
Reviewed by:    khorben
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58441

(cherry picked from commit 152ba2d3c5ff00382260a48653855072d524cfb8)
DeltaFile
+67-50usr.bin/rpcinfo/rpcinfo.c
+67-501 files

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

unix: Preserve FD_RESOLVE_BENEATH when passing an fd

The FD_RESOLVE_BENEATH flag is supposed to be sticky.  It's set when you
receive an fd from a different jail and preserved by openat(<dfd>) etc..
However, if you send the fd to yourself, the flag is stripped since
SCM_RIGHTS message don't preserve file descriptor flags.

Fix this by preserving those flags and checking for UF_RESOLVE_BENEATH
in restrict_rights().

Fixes:          350ba9672a7f ("unix: Set O_RESOLVE_BENEATH on fds transferred between jails")
Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58317

(cherry picked from commit 586e2b3d89d6e70ab7e4a88497b5f36d78719423)
DeltaFile
+31-0tests/sys/kern/unix_passfd_test.c
+19-8sys/kern/uipc_usrreq.c
+50-82 files

HardenedBSD/src fd58b2bsys/netinet6 nd6_rtr.c

netinet6/nd6: Sprinkle missing prefix refcounting

When we drop the prefix lock to call nd6_prefix_offlink() or
nd6_prefix_onlink(), make sure to keep the correpsonding prefix
structure alive.  It is possible for a concurrent nd6_timer() to expire
the prefix while the lock is dropped.

Reported by:    Maik Muench of Secfault Security
Reviewed by:    pouria, zlei
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58423

(cherry picked from commit 76ca489e0f147e9bd90408ea562087e84ed6f479)
DeltaFile
+4-0sys/netinet6/nd6_rtr.c
+4-01 files

HardenedBSD/src ffad042usr.sbin/syslogd syslogd.c

syslogd: Limit rights on procdescs

Reviewed by:    jfree, kib
MFC after:      3 weeks
Differential Revision:  https://reviews.freebsd.org/D58160

(cherry picked from commit 24816abb8740c387ad4aba4ad2fa4c23b191c351)
DeltaFile
+5-0usr.sbin/syslogd/syslogd.c
+5-01 files

HardenedBSD/src 73b576asys/kern kern_kthread.c

kthread: Fix a thread leak

Fixes:          963629923308 ("kthread_add(): do not allow to attach the thread to a dead or dying process")
Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58433

(cherry picked from commit c7917e72fe80e2e168b3812718b5fcd497c0e3b8)
DeltaFile
+1-0sys/kern/kern_kthread.c
+1-01 files

HardenedBSD/src e107014sys/kern link_elf.c

linker: Recognize SHT_INIT_ARRAY sections as constructor sections

We do this already for ET_REL files, but it was missed here.  Note that
this function operates only on dynamically loaded files, not on
preloaded files.

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58245

(cherry picked from commit 83181995593ac61796d7be63dcb241f5d80faa73)
DeltaFile
+3-2sys/kern/link_elf.c
+3-21 files

HardenedBSD/src 7eb4c67stand/efi/loader/arch/amd64 elf64_freebsd.c

loader: Fix error handling after an allocation failure

MFC after:      1 week

(cherry picked from commit 5001af647b3b263aeb3d4fa7a6c2690399265202)
DeltaFile
+1-1stand/efi/loader/arch/amd64/elf64_freebsd.c
+1-11 files

HardenedBSD/src f1cf144sys/vm vm_init.c

exec: Avoid overflow when computing the size of the exec map

On a test system with 1024 cores the size of exec map exceeds 4GB, and
all of the operands in the size calculation are 32-bit integers.

Tested by:      Jim Huang Chen <jim.chen.1827 at gmail.com>
MFC after:      1 week
Sponsored by:   AMD (hardware)

(cherry picked from commit 2efe148a2a321d4c9ed46bdb166f710b2cb21529)
DeltaFile
+1-1sys/vm/vm_init.c
+1-11 files

HardenedBSD/src 3d34995sys/dev/gpio/intel intelgpio.h adlngpio.c, sys/dev/ixgbe if_sriov.c if_ix.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+415-0sys/dev/gpio/intel/intelgpio.c
+106-0sys/dev/gpio/intel/tglhgpio.c
+94-0sys/dev/gpio/intel/adlngpio.c
+77-8sys/dev/ixgbe/if_ix.c
+64-0sys/dev/gpio/intel/intelgpio.h
+23-22sys/dev/ixgbe/if_sriov.c
+779-308 files not shown
+856-3314 files

HardenedBSD/src 77e244asys/dev/gpio/intel intelgpio.h adlngpio.c, sys/dev/ixgbe if_sriov.c if_ix.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+415-0sys/dev/gpio/intel/intelgpio.c
+106-0sys/dev/gpio/intel/tglhgpio.c
+94-0sys/dev/gpio/intel/adlngpio.c
+77-8sys/dev/ixgbe/if_ix.c
+64-0sys/dev/gpio/intel/intelgpio.h
+23-22sys/dev/ixgbe/if_sriov.c
+779-308 files not shown
+856-3314 files

HardenedBSD/src 8e18fc3sys/dev/e1000 if_em.c, sys/dev/virtio/pci virtio_pci_modern.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+30-44sys/netinet/tcp_syncache.c
+11-42sys/net/if_loop.c
+36-2sys/kern/kern_exec.c
+18-14tests/sys/netinet/ip_reass_test.c
+22-6sys/dev/e1000/if_em.c
+10-17sys/dev/virtio/pci/virtio_pci_modern.c
+127-1256 files not shown
+172-15612 files

HardenedBSD/src 1a180b4sys/dev/ixgbe ixgbe_sriov.h ixgbe.h

ixgbe: rebuild the shared multicast table

The MTA is shared by the PF and all VFs. The VF mailbox handler only
ORs new bits, so hashes survive list removal and VF reset. Conversely,
PF multicast updates replace the whole table with PF-only state and
discard live VF filters.

Rebuild the table from the PF list and every active VF whenever either
changes. Clear VF multicast state during reset and PF reinitialization,
and remove all VF hashes on SR-IOV teardown. Keep the software shadow
and multicast control state synchronized, and avoid writes to unchanged
MTA registers.

Adapt the aggregate desired-state rebuild introduced for igb(4) in
a2ed165f0049 and its write-elision scheme from 350211ab1782 to ixgbe's
shared MTA.

MFC after:      1 week
DeltaFile
+77-8sys/dev/ixgbe/if_ix.c
+23-22sys/dev/ixgbe/if_sriov.c
+1-0sys/dev/ixgbe/ixgbe_sriov.h
+1-0sys/dev/ixgbe/ixgbe.h
+102-304 files

HardenedBSD/src 4c03feasys/dev/ixgbe if_ixv.c

ixv: reconcile the PF-approved MAC address

The shared VF set-RAR helper restores hw.mac.addr when the PF rejects a
requested address, but ixv ignores the error and leaves the interface
link-layer address unchanged. Subsequent initialization repeats the
rejected request while the interface appears to use an address the PF
will not deliver.

Refresh the permanent address returned by the PF after every successful
reset handshake. Copy the resulting PF-approved address back to the
interface and emit the normal link-layer address notification without
re-entering the driver initialization path. This also recovers from a
prior mailbox transport failure or a PF-side reassignment.

Adapt the igb VF address reconciliation added in a6bb3850e7c6.

MFC after:      1 week
DeltaFile
+26-0sys/dev/ixgbe/if_ixv.c
+26-01 files

HardenedBSD/src 5e05c40sys/dev/ixgbe if_ixv.c

ixv: defer every admin-vector interrupt

The VF admin vector carries both link and PF mailbox causes, but the
filter schedules the admin task only for link-status changes. Defer
administration for every interrupt so reset and control notifications
are serviced promptly.

MFC after:      1 week
DeltaFile
+2-3sys/dev/ixgbe/if_ixv.c
+2-31 files