HardenedBSD/src 7aa01f3 — sys/sys libkern.h, tests/sys/libkern Makefile sign_extend_bitfields.c

tests/sys/libkern: Add tests for sign extension and bitfield extraction

In order to avoid name collisions with standard library functions, wrap
everything but the functions to test in a !LIBKERN_TESTING section, so
that when LIBKERN_TESTING is defined, all untested parts are not
defined.  Leave a comment there suggesting selective namespacing when
adding tests to string functions having same name in the standard
library.

Reviewed by:    fuz
MFC with:       a6e81841486a ("libkern: Bitfield extraction: Stick to standard, separate sign extension")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61963
DeltaFile
+202-0tests/sys/libkern/sign_extend_bitfields.c
+22-0sys/sys/libkern.h
+2-0tests/sys/libkern/Makefile
+226-03 files

HardenedBSD/src 1a80570 — tests/sys Makefile, tests/sys/kern Makefile libkern_crc32.c

tests/sys: Move libkern's tests in a separate directory

Use 'sys/libkern', to mimick the source hierarchy.

Reviewed by:    emaste
MFC with:       a6e81841486a ("libkern: Bitfield extraction: Stick to standard, separate sign extension")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61961
DeltaFile
+0-155tests/sys/kern/libkern_crc32.c
+155-0tests/sys/libkern/crc32.c
+23-0tests/sys/libkern/Makefile
+0-13tests/sys/kern/Makefile
+1-0tests/sys/Makefile
+179-1685 files

HardenedBSD/src 5977021 — tests/sys/netlink test_rtnl_ifaddr.py

netlink/tests: Add permanent flag to test_add_6_flags

Now IFA_F_PERMANENT is reported, add test for it and expect
IFA_F_PERMANENT in nl_flags during tests.

Reported by:    llm-postcr
Fixes:          10b94e406444 ("netlink: add support for adding/deleting interface addresses")
MFC after:      3 days
DeltaFile
+4-2tests/sys/netlink/test_rtnl_ifaddr.py
+4-21 files

HardenedBSD/src ce78b5a — sys/netinet tcp_input.c, sys/netinet/tcp_stacks bbr.c rack.c

tcp: improve ISS checking for ghost ACKs

The check in tcp_adapt_iss_check() depends on SND.UNA and therefore
should be performed whenever SND.UNA is incremented.

PR:                     298560
Reviewed by:            Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61749

(cherry picked from commit 9e345ca583f702e7472f836136e766d3346c049d)
DeltaFile
+4-1sys/netinet/tcp_stacks/rack.c
+2-1sys/netinet/tcp_stacks/bbr.c
+2-1sys/netinet/tcp_input.c
+8-33 files

HardenedBSD/src 9961669 — contrib/atf/atf-c macros_test.c, sys/amd64/vmm x86.c vmm_cpuid.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+1,100-0sys/amd64/vmm/vmm_cpuid.c
+775-214sys/contrib/zstd/lib/compress/zstd_compress.c
+713-235sys/contrib/zstd/programs/fileio.c
+0-623sys/amd64/vmm/x86.c
+273-282contrib/atf/atf-c/macros_test.c
+439-105sys/contrib/zstd/programs/util.c
+3,300-1,459221 files not shown
+10,824-6,878227 files

HardenedBSD/src 4aff0bc — sys/netinet6 in6.c

nd6: Keep addresses tentative in in6_if_up

in6_if_up() runs from the IFNET_EVENT_UP handler on every
IFF_UP 0->1 transition, whether or not the interface is ifdisabled.
Ignore state transitions in in6_if_up() for now.

Reported by:    llm-postcr
Fixes:          f0ce2ae67f9f ("nd6: Do not make SLAAC addresses usable with ifdisabled")
DeltaFile
+0-1sys/netinet6/in6.c
+0-11 files

HardenedBSD/src 65355d0 — usr.sbin/sysrc sysrc, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Restore the ability to pin default value

Fix 1 issue identified in post-commit review of eaf7113:

POSTCR-1: "unchanged" short-circuit counts a value that only comes
from RC_DEFAULTS, so `sysrc -f file var=<default>` writes nothing.

Add an ATF test to ensure we preserve this functionality.

Reported by:    llm-postcr
Fixes:          eaf7113bef8f ("sysrc: Add "unchanged" messages")
DeltaFile
+26-0usr.sbin/sysrc/tests/sysrc_test.sh
+3-2usr.sbin/sysrc/sysrc
+29-22 files

HardenedBSD/src e6bc3b2 — stand/common interp_lua.c

lualoader: don't run a failed command twice from the prompt

interp_run() hands each command line to cli_execute, which runs
builtins through loader.command.  If that returned an error, it then
ran the command again with interp_builtin_cmd(), as a fallback for when
lua couldn't run the command at all.  A command that simply failed thus
ran twice, printing any errors twice and repeating whatever it did
before it failed.

Only fall back when the lua call itself failed, and otherwise take the
command's own result.

Reviewed by:    imp
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61845
DeltaFile
+10-1stand/common/interp_lua.c
+10-11 files

HardenedBSD/src b1e8282 — lib/libsecureboot verify_file.c

libsecureboot: don't remember files accepted unverified

verify_file() caches the result for each file by dev/ino, including
VE_UNVERIFIED_OK.  That status only says that the file was unverified
but acceptable at the severity the caller asked for, but a later
request for the same file takes the cached result as-is: verify_prep()
and vectx_open() both treat it as "not verifying this", even at
VE_MUST.

As a result, anything that could be opened at a lower severity could
then be loaded where it must verify, e.g.:

        include /boot/modules/evil.ko   # VE_WANT, no fingerprint
        load evil                       # VE_MUST, but cached as OK

Stop caching VE_UNVERIFIED_OK so that each request is judged by its own
severity, under whatever policy is in effect at the time.  Files that
would be accepted unverified have no usable fingerprint, so there's
nothing to hash; they're just looked up again (and reported, if verbose)

    [6 lines not shown]
DeltaFile
+7-1lib/libsecureboot/verify_file.c
+7-11 files

HardenedBSD/src 1436c36 — stand/libsa/zfs zfs.c

stand/zfs: leave variables that nvstore doesn't own alone

Setting an nvstore variable also sets it in the loader's environment,
both when we store it and when we import the nvstore at startup.  We
did that with EV_NOHOOK, which is right for our own variables, since
their hook is what stores them.  A variable that something else in the
loader created, e.g., currdev or console, has hooks of its own that
validate it or act on it.  We bypassed those, so a stored value never
really took effect, and we could set or discard a variable whose hooks
would have refused.

Refuse to set or unset such a variable with EPERM before we touch the
pool label, and skip it when we import the nvstore.

Reviewed by:    imp
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61844
DeltaFile
+48-1stand/libsa/zfs/zfs.c
+48-11 files

HardenedBSD/src 096e542 — stand/i386/loader chain.c

loader: i386: fix vectx handling in chain error paths

Once vectx_open() succeeds, the stat, device, root device and read error
paths all returned without freeing the context, leaking it.

We also closed the fd before calling vectx_close(), which may need to
read the remainder of the file to finish hashing it.  This is harmless
as-is because we've always read the whole file by that point, but close
it afterwards so that we aren't relying on that.

Reviewed by:    sjg
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61840
DeltaFile
+14-1stand/i386/loader/chain.c
+14-11 files

HardenedBSD/src d866370 — stand/efi/loader main.c

loader: efi: fix error check on fstat() in chain

fstat() returns -1 on failure, so testing for a return value less than
-1 could never catch an error, and we would carry on with whatever
garbage was in the stat buffer.

Reviewed by:    imp, sjg, tsoome
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61846
DeltaFile
+1-1stand/efi/loader/main.c
+1-11 files

HardenedBSD/src f9d0f90 — stand/common module.c, stand/i386/loader chain.c

loader: fix double free of vectx on verification failure

vectx_close() always frees the context it is handed, but both
file_loadraw() and the i386 chain command would free(vctx) again when
it reported a verification failure.

Reviewed by:    imp, sjg
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61839
DeltaFile
+0-1stand/i386/loader/chain.c
+0-1stand/common/module.c
+0-22 files

HardenedBSD/src 5fb4374 — stand/lua core.lua config.lua

lualoader: match the .lua extension literally

Both config.processFile() and try_include() checked for a .lua
extension with ".lua$", but '.' matches any character, so a name like
foo_lua also matched.

In processFile(), that meant that a config file such as /boot/foo_lua
was run as lua, though it was opened like any other config file.
With veriexec, that file only needs VE_WANT rather than the VE_MUST
that we expect for lua code, so an unverified file could be run as lua.

Reviewed by:    imp
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61843
DeltaFile
+1-1stand/lua/core.lua
+1-1stand/lua/config.lua
+2-22 files

HardenedBSD/src a35c681 — sbin/zfsbootcfg zfsbootcfg.c

zfsbootcfg: fix some error handling bugs in setting/deleting keys

A few bugs dating back to the original bootenv support:

 - delete_pair() freed an uninitialized nvlist if it couldn't fetch the
   bootenv, e.g., with a nonexistent pool.
 - A missing else meant that "yes" and "no" were always rejected for
   DATA_TYPE_BOOLEAN_VALUE; only "true", "false" and numbers worked.
 - With -p, the result of printing the bootenv replaced the result of
   setting or deleting a key, so a failed set or delete exited 0.
 - errno was never cleared before strto*(), so a stale errno left behind
   by libzfs could make a valid numeric value fail.

Values for the narrower integer types are still silently truncated
(e.g., 300 for DATA_TYPE_UINT8 sets 44).  Rejecting them would also
reject values like -1 for the unsigned types that scripts may rely on,
so I'm punting for now.

Reported by:    llm-postcr

    [6 lines not shown]
DeltaFile
+6-5sbin/zfsbootcfg/zfsbootcfg.c
+6-51 files

HardenedBSD/src aeab7c6 — contrib/expat/gennmtab Makefile.in, contrib/expat/lib xmlparse.c

contrib/expat: import expat 2.11.0

Changes: https://github.com/libexpat/libexpat/blob/R_2_11_0/expat/Changes

Security:       CVE-2026-124317
Security:       CVE-2026-128241
Security:       CVE-2026-134703
MFC after:      3 days
DeltaFile
+1,081-0contrib/expat/tests/fifth_edition_tests.c
+661-224contrib/expat/tests/basic_tests.c
+442-301contrib/expat/lib/xmlparse.c
+740-0contrib/expat/gennmtab/Makefile.in
+300-38contrib/expat/tests/misc_tests.c
+322-1contrib/expat/tests/xmltest.sh
+3,546-56452 files not shown
+5,562-1,14658 files

HardenedBSD/src bedc8bd — sys/amd64/vmm vmm_cpuid.c

HBSD: Reapply commit e76fcb77ba82649bc6aed808af06d6d2184847d8

FreeBSD recently imported the cpuid code from Illumos. In doing so, some
of the code was moved around. The merge conflict resolution in commit
f3164eaaf8d9fc147cafae699603c5dab2802a55 deliberately did not take the
HardenedBSD change into account.

This commit is a follow-up that restores HardenedBSD's disabling of the
Silicon Debug functionality in certain Intel CPUs.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+10-0sys/amd64/vmm/vmm_cpuid.c
+10-01 files

HardenedBSD/src c34a903 — sys/net if_geneve.c

if_geneve: Fix nexthop reference imbalance on output

geneve_encap4() and geneve_encap6() look up the nexthop of the outer
packet without a reference and pass it to ip_output() or ip6_output()
in a route on the stack.  When the output routine drops the nexthop of
that route, because a pfil hook asked for a new lookup or the nexthop
is no longer valid, it releases a reference that was never taken.  It
then stores a referenced nexthop in the route, which the caller never
releases.

Set RT_NH_NOREF on these routes, so that ip_output() and ip6_output()
neither release nor reference a nexthop for them.

Reviewed by:            pouria, zlei
Fixes:                  e44d2e941e8e ("if_geneve: Add Support for Geneve...")
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61952
DeltaFile
+2-0sys/net/if_geneve.c
+2-01 files

HardenedBSD/src 6a31fd2 — sys/net if_vxlan.c

if_vxlan: Fix nexthop reference imbalance on output

When the inner frame asks for checksum offload or TSO, vxlan_encap4()
and vxlan_encap6() look up the nexthop of the outer packet without a
reference, to check the capabilities of the outgoing interface, and
pass it to ip_output() or ip6_output() in a route on the stack.  When
the output routine drops the nexthop of that route, because a pfil
hook asked for a new lookup or the nexthop is no longer valid, it
releases a reference that was never taken.  It then stores a
referenced nexthop in the route, which the caller never releases.

Set RT_NH_NOREF on these routes, so that ip_output() and ip6_output()
neither release nor reference a nexthop for them.

Reviewed by:            pouria, zlei
Fixes:                  b092fd6c973d ("if_vxlan(4): add support for...")
MFC after:              2 weeks
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61958
DeltaFile
+2-0sys/net/if_vxlan.c
+2-01 files

HardenedBSD/src f2ff4b5 — sys/netinet ip_input.c

ip_forward: Do not reference the nexthop

ip_forward() looked the route up with NHR_REF and released the nexthop
on every exit.  The function runs in the network epoch, and nexthops are
destroyed through NET_EPOCH_CALL(), so the nexthop stays valid until
ip_forward() returns without a reference, as ip_tryforward() already
relies on.  The reference costs two atomic operations per packet on a
counter that every CPU forwarding to that nexthop shares.

Look the nexthop up without NHR_REF, and set RT_NH_NOREF on the
on-stack route, so that ip_output() neither releases that nexthop nor
references one it looks up itself.

On a four-core router that encrypts what it forwards into one ESP
tunnel, this takes 60-byte packets from 913 to 970 kpps, and the CPU
time for packets dropped by a blackhole route goes down by 18 %.

No functional change intended.


    [4 lines not shown]
DeltaFile
+9-5sys/netinet/ip_input.c
+9-51 files

HardenedBSD/src 7c11494 — sys/net route.h, sys/netinet ip_output.c

routing: Add RT_NH_NOREF for routes that do not reference the nexthop

A route that is used within one network epoch section does not need a
reference on its nexthop: nexthops are destroyed through
NET_EPOCH_CALL(), so a nexthop looked up in the section stays valid
until the section ends.  ip_output() and ip6_output() have no way to
know that a route is used like this.  When they drop the nexthop of the
route they are given, because it is no longer valid or a pfil hook
asked for a new lookup, they release it, and they store a referenced
nexthop in its place.

Add a route flag, RT_NH_NOREF, which the owner of a route sets to say
that the nexthop of the route is not to be referenced.  The flag is set
before the route is first used and is never cleared.  RO_NHFREE() and
RO_INVALIDATE_CACHE() drop the nexthop of such a route without
releasing it.  ip_output(), and cache_route(), which looks up the
nexthop for ip6_output(), look up a new one without NHR_REF.

The flag must not be set on a route that outlives the epoch section it

    [7 lines not shown]
DeltaFile
+14-6sys/net/route.h
+5-0sys/netinet/ip_output.c
+3-1sys/netinet6/in6_src.c
+4-0sys/netinet6/ip6_output.c
+26-74 files

HardenedBSD/src 4012db4 — usr.sbin/bsdconfig/include messages.subr, usr.sbin/bsdconfig/share strings.subr

bsdconfig: finish wlanconfig SSID join and wpa_supplicant(5) editing

Complete the wireless network menu, which since its 2013 introduction
stopped just short of usefulness: it could scan the airwaves and list
networks configured in wpa_supplicant.conf(5), but selecting a scanned
network did nothing, the configuration editor displayed values it could
not change, and nothing was ever written back to disk.  All three
XXXDT-unfinished paths are now implemented.

Selecting an unmarked ([ ]) entry joins that network.  The security
type is derived from the wpa_cli(8) scan_results flags (PSK, SAE, EAP,
WEP, or open) and the user is prompted accordingly: passphrases and
keys through an obscured password box with validation (8-63 character
passphrase or 64-digit hex pre-shared key; 5/13 character ASCII or
10/26 digit hex WEP key), EAP through identity and password prompts.
The resulting network block is appended to wpa_supplicant.conf(5) with
priority=5 and wpa_supplicant(8) is reloaded via wpa_cli(8)
reconfigure, so the join both takes effect immediately and survives a
reboot.  Manually Connect, which previously dead-ended in the editor

    [44 lines not shown]
DeltaFile
+631-29usr.sbin/bsdconfig/share/media/wlan.subr
+19-1usr.sbin/bsdconfig/include/messages.subr
+19-0usr.sbin/bsdconfig/share/strings.subr
+669-303 files

HardenedBSD/src f3164ea — sys/amd64/vmm x86.c

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-625sys/amd64/vmm/x86.c
+0-6251 files

HardenedBSD/src b0f70e3 — contrib/atf/atf-c tc.c macros_test.c, sys/amd64/vmm vmm_cpuid.c

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

Conflicts:
        sys/amd64/vmm/x86.c (unresolved)
DeltaFile
+1,090-0sys/amd64/vmm/vmm_cpuid.c
+775-214sys/contrib/zstd/lib/compress/zstd_compress.c
+713-235sys/contrib/zstd/programs/fileio.c
+273-282contrib/atf/atf-c/macros_test.c
+439-105sys/contrib/zstd/programs/util.c
+250-222contrib/atf/atf-c/tc.c
+3,540-1,058221 files not shown
+10,817-6,256227 files

HardenedBSD/src 0412a40 — sys/contrib/zstd/lib zstd.h, sys/contrib/zstd/lib/compress zstd_compress.c

MFV: zstd 1.6.0

Security:       CVE-2026-124851
MFC after:      3 days
DeltaFile
+775-214sys/contrib/zstd/lib/compress/zstd_compress.c
+713-235sys/contrib/zstd/programs/fileio.c
+439-105sys/contrib/zstd/programs/util.c
+5-364sys/contrib/zstd/lib/legacy/zstd_v02.c
+209-112sys/contrib/zstd/lib/zstd.h
+253-65sys/contrib/zstd/programs/zstd.1
+2,394-1,09577 files not shown
+4,703-2,09683 files

HardenedBSD/src f0ce2ae — sys/netinet6 in6.c nd6.c

nd6: Do not make SLAAC addresses usable with ifdisabled

Setting TENTATIVE was what made these addresses unusable, because
TENTATIVE is part of IN6_IFF_NOTREADY.
keep setting TENTATIVE in nd6_timer() and nd6_ioctl() to not making
them usable.

Reported by:    llm-postcr
Fixes:          c7cd7e7fad57 ("nd6: Add support for Optimistic DAD (RFC 4429)")
Differential Revision:  https://reviews.freebsd.org/D55229
DeltaFile
+3-4sys/netinet6/nd6.c
+1-0sys/netinet6/in6.c
+4-42 files

HardenedBSD/src 2008a5d — sys/netlink/route iface.c

rtnetlink: Fix IFA_F_PERMANENT and IFA_F_DADFAILED flags

in6_flags_to_nl() sets IFA_F_PERMANENT/IFA_F_DADFAILED flags on
the function argument, not nl_flags, so netlink never reports them.

Reported by:    llm-postcr
Fixes:          30d0fc6f3391 ("netlink: export more IPv6 ifa info")
MFC after:      3 days
DeltaFile
+2-2sys/netlink/route/iface.c
+2-21 files

HardenedBSD/src eaf7113 — usr.sbin/sysrc sysrc, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Add "unchanged" messages

When a value would not change, emit a message indicating such. This
aligns with sysconf which does the same thing.

While here, add missing loop hygiene; unset loop variables after loop
to avoid potential later misuse.

Reviewed by:    kfv
Differential Revision:  https://reviews.freebsd.org/D61742
DeltaFile
+40-1usr.sbin/sysrc/sysrc
+17-5usr.sbin/sysrc/tests/sysrc_test.sh
+57-62 files

HardenedBSD/src 3df9c52 — usr.sbin/sysrc sysrc, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Send -c output to stderr instead of stdout

This aligns with sysconf's `-c' while also adding a default output of
`value differs' (suppressed with `-q').

While here, replace f_err with warn() where appropriate.

Reviewed by:    kfv
Differential Revision:  https://reviews.freebsd.org/D61741
DeltaFile
+34-24usr.sbin/sysrc/tests/sysrc_test.sh
+14-12usr.sbin/sysrc/sysrc
+48-362 files

HardenedBSD/src 0b1de27 — usr.sbin/sysrc sysrc sysrc.8, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Accept values that contain a newline

awk -v rejects a newline in the value, and the old writer treated that
failure as an empty edit. The temporary file then held only the new
assignment, so the rest of the configuration was lost.

Pass the value in the environment and replace the last assignment by
joining that line through end of file. A quoted newline stays with the
value, and the text after it stays after the closer. If awk exits
above 1, leave the file alone. sh -n still refuses a value that would
break the quotes.

PR:             283729
MFC after:      2 weeks
Reviewed by:    kfv
Differential Revision:  https://reviews.freebsd.org/D61743
DeltaFile
+53-28usr.sbin/sysrc/sysrc.subr
+67-0usr.sbin/sysrc/tests/sysrc_test.sh
+2-3usr.sbin/sysrc/sysrc.8
+1-1usr.sbin/sysrc/sysrc
+123-324 files