FreeBSD/src fe96610sys/net pfvar.h, sys/netpfil/pf pf.c pf_lb.c

pf: rework anchor handling to recurse

- percpu anchor stacks
  we actually don't need to pre-allocate per_anchor_stack[], if we use
  a 'natural' recursion, when doing anchor tree traversal.

O.K. mikeb@, mpi@

Extended because FreeBSD pf still has separate NAT rules processing, which also
needed this change.

Obtained from:  OpenBSD, sashan <sashan at openbsd.org>, e236f0fa7b
Obtained from:  OpenBSD, sashan <sashan at openbsd.org>, 5e4ad307dc
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D50579
DeltaFile
+275-282sys/netpfil/pf/pf.c
+105-41sys/netpfil/pf/pf_lb.c
+42-9sys/net/pfvar.h
+422-3323 files

FreeBSD/src 1e4c562sys/net pfvar.h, sys/netpfil/pf pf.c pf_lb.c

pf: remove unused argument from pf_get_translation()

No functional change.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+1-1sys/net/pfvar.h
+1-1sys/netpfil/pf/pf.c
+1-1sys/netpfil/pf/pf_lb.c
+3-33 files

FreeBSD/src 3495832sys/netpfil/pf pf_lb.c

pf: convert NAT rule handling to PF_TEST_ATTRIB as well

We previously made this change in the filter rules, apply it to the NAT rules
as well.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D50580
DeltaFile
+58-50sys/netpfil/pf/pf_lb.c
+58-501 files

FreeBSD/src ab239dfsys/net pfvar.h, sys/netpfil/pf pf.c pf_lb.c

pf: use struct pf_test_ctx as function argument

Use the struct rather than passing individual fields as arguments.
No functional change.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+68-81sys/netpfil/pf/pf.c
+22-24sys/netpfil/pf/pf_lb.c
+4-9sys/net/pfvar.h
+94-1143 files

FreeBSD/src 353cfc4sys/cam cam.c cam.h

cam nvme: Decode NVMe status for NVMe command failures

Similar to ATA and SCSI, log the command status (in this case the
status code from the CQE) on the console for failed NVMe commands.

Reviewed by:    imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D50632
DeltaFile
+28-0sys/cam/cam.c
+5-0sys/cam/cam.h
+33-02 files

FreeBSD/src f2a587bsys/cam/ctl ctl_nvme_all.c, sys/cam/nvme nvme_all.c nvme_all.h

cam nvme: Move opcode and status code tables from CTL to base CAM

This adds support for decoding admin opcodes to the existing opcode
decoding and also removes one of the duplicate NVMe opcode string
tables.

- Add nvme_opcode_sbuf and nvme_cpl_sbuf which are CCB
  type-independent and handle the guts of the CTL-specific routines.

- Use nvme_opcode_sbuf to decode the opcode in nvme_command_sbuf.

- Add nvme_status_sbuf to decode the CPL/CQE in a ccb_nvmeio.

Reviewed by:    imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D50631
DeltaFile
+246-36sys/cam/nvme/nvme_all.c
+5-215sys/cam/ctl/ctl_nvme_all.c
+3-0sys/cam/nvme/nvme_all.h
+254-2513 files

FreeBSD/src 331f2c1lib/libarchive/tests Makefile

libarchive: fix duplicate entry in tests Makefile

Reported by:    des
MFC after:      2 weeks (together with 2e113ef82)
DeltaFile
+0-1lib/libarchive/tests/Makefile
+0-11 files

FreeBSD/src 89bb17esys/arm64/arm64 ptrauth.c

arm64: Mask out the PAC ID fields when disabled

When we disable PAC we need to mask out the ID registers for userspace.
Call update_special_reg to mask them out so userspace gets a correct
view of the registers and hwcaps.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D50573
DeltaFile
+9-3sys/arm64/arm64/ptrauth.c
+9-31 files

FreeBSD/src 2aeac25sys/arm64/arm64 identcpu.c, sys/arm64/include cpu.h

arm64: Add a function to restrict the ID registers

This will be used when we need to restrict the register values, e.g.
when an erratum is present that means we need to disable a feature we
will need to remove some fields from these registers.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D50572
DeltaFile
+91-36sys/arm64/arm64/identcpu.c
+1-0sys/arm64/include/cpu.h
+92-362 files

FreeBSD/src 38fd088sys/arm64/arm64 identcpu.c machdep.c

arm64: Move users of sanitised ID registers later

To allow for masking of ID registers in the presence of errata move
the late ifunc resolvers and CPU identification functions until after
the errata detection has run.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D50571
DeltaFile
+6-1sys/arm64/arm64/identcpu.c
+3-1sys/arm64/arm64/machdep.c
+9-22 files

FreeBSD/src 4d7c31blib/libc/tests/gen glob2_test.c glob_blocks_test.c

glob2_test: Add tests for error callback functions and blocks

This change adds tests that check basic callback functionality for
blocks and function pointers. The tests also make sure that GLOB_ERR
overrides the callback's return value.

Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50486
DeltaFile
+59-1lib/libc/tests/gen/glob2_test.c
+49-0lib/libc/tests/gen/glob_blocks_test.c
+4-1lib/libc/tests/gen/Makefile
+112-23 files

FreeBSD/src 1e0743finclude glob.h, lib/libc/gen glob.c glob.3

glob: Add blocks support

This change introduces the `glob_b` function which takes a block instead
of a function pointer.

Relnotes:       yes
Sponsored by:   Klara, Inc.
Inspired by:  https://github.com/apple-oss-distributions/Libc
Differential Revision:  https://reviews.freebsd.org/D50485
DeltaFile
+55-15lib/libc/gen/glob.c
+57-9lib/libc/gen/glob.3
+14-2include/glob.h
+1-0lib/libc/gen/Symbol.map
+1-0lib/libc/gen/Makefile.inc
+128-265 files

FreeBSD/src 61d77e6stand/common commands.c

loader: allow for exceptions to restricted settings.

We restrict what an unverified loader.conf etc can set,
and the same restrictions are applied to interactive input.
We need to allow for exceptions (eg boot_verbose).
It is best if any allowed settings match up to '='.

If we do not allow it to be set, do not allow it to be unset

Reviewed by:    stevek
Sponsored by:   Juniper Networks, Inc.
DeltaFile
+73-22stand/common/commands.c
+73-221 files

FreeBSD/src f989020stand/common install.c

install: must set netproto for tftp://

tftp_open requires netproto is NET_TFTP

Reviewed by:    stevek
DeltaFile
+1-0stand/common/install.c
+1-01 files

FreeBSD/src 2e113efcontrib/libarchive/libarchive archive_parse_date.c archive_getdate.c, contrib/libarchive/libarchive/test test_read_format_7zip_sfx_elf.elf.uu test_read_format_7zip_sfx_pe.exe.uu

libarchive: merge from vendor branch

libarchive 3.8.1

New features:
 #2088 7-zip reader: improve self-extracting archive detection
 #2137 zip writer: added XZ, LZMA, ZSTD and BZIP2 support
 #2403 zip writer: added LZMA + RISCV BCJ filter
 #2601 bsdtar: support --mtime and --clamp-mtime
 #2602 libarchive: mbedtls 3.x compatibility

Security fixes:
 #2422 tar reader: Handle truncation in the middle of a GNU long linkname
       CVE-2024-57970
 #2532 tar reader: fix unchecked return value in list_item_verbose()
       CVE-2025-25724
 #2532 unzip: fix null pointer dereference
       CVE-2025-1632
 #2568 warc: prevent signed integer overflow

    [28 lines not shown]
DeltaFile
+9,442-0contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_elf.elf.uu
+4,751-0contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_pe.exe.uu
+2,107-0contrib/libarchive/libarchive/test/test_write_format_mtree_preset_digests.c
+1,147-0contrib/libarchive/libarchive/archive_parse_date.c
+0-1,100contrib/libarchive/libarchive/archive_getdate.c
+879-105contrib/libarchive/libarchive/archive_write_set_format_zip.c
+18,326-1,205179 files not shown
+26,875-3,633185 files

FreeBSD/src 76141d3libarchive archive_read_support_format_tar.c archive_util.c, libarchive/test test_read_format_tar_mac_metadata_1.tar.uu test_read_format_tar_mac_metadata.c

Update vendor/libarchive to 3.8.1

Notable bugfixes:
 #2634 tar: Support negative time values with pax
 #2637 tar: Keep block alignment after pax error
 #2642 libarchive: fix FILE_skip regression
 #2643 tar: Handle extra bytes after sparse entries
 #2649 compress: Prevent call stack overflow
 #2651 iso9660: always check archive_string_ensure return value

Obtained from:  libarchive
Vendor commit:  9525f90ca4bd14c7b335e2f8c84a4607b0af6bdf
DeltaFile
+231-0libarchive/test/test_read_format_tar_mac_metadata_1.tar.uu
+84-60libarchive/archive_read_support_format_tar.c
+85-0libarchive/test/test_read_format_tar_mac_metadata.c
+16-60libarchive/archive_util.c
+68-0libarchive/test/test_read_format_tar_pax_negative_time.c
+65-0libarchive/test/test_read_pax_empty_val_no_nl.c
+549-12032 files not shown
+933-29338 files

FreeBSD/src cbcfc2bsys/amd64/conf GENERIC-KASAN GENERIC-KCSAN, sys/arm64/conf GENERIC-KASAN

conf: Make sanitizer configs include the debug config

This is a direct commit to stable/14.
DeltaFile
+1-1sys/amd64/conf/GENERIC-KASAN
+1-1sys/amd64/conf/GENERIC-KCSAN
+1-1sys/amd64/conf/GENERIC-KMSAN
+1-1sys/arm64/conf/GENERIC-KASAN
+4-44 files

FreeBSD/src f7d9af3usr.bin/du/tests du_test.sh

du: Add regression tests

Reviewed by:    markj
MFC after:      1 month
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1648

(cherry picked from commit 3e5550d25c6d614f422506373f7068c6c366fa85)
DeltaFile
+129-1usr.bin/du/tests/du_test.sh
+129-11 files

FreeBSD/src 226076asys/netinet6 icmp6.c ip6_forward.c

netinet6: Do not forward or send ICMPv6 messages to the unspec address

As in f7174eb2b4c4 ("netinet: Do not forward or ICMP response to
INADDR_ANY"), the IPv6 stack should avoid sending packets to the
unspecified address.  In particular:
- Make sure that we do not forward received packets to the unspecified
  address; the check in ip6_input() catches this in the common case, but
  after commit 40faf87894ff it's possible for a pfil hook to bypass this
  check and pass the packet to ip6_forward() using the
  PACKET_TAG_IPFORWARD tag.
- Make sure that we do not reflect packets back to the unspecified
  address; RFC 4443 section 2.4 states that we must not generate error
  messages in response to packets from the unspecified address.

Reviewed by:    zlei, glebius
Reported by:    Franco Fichtner <franco at opnsense.org>
MFC after:      1 month
Sponsored by:   Klara, Inc.
Sponsored by:   OPNsense

    [3 lines not shown]
DeltaFile
+6-0sys/netinet6/icmp6.c
+2-1sys/netinet6/ip6_forward.c
+8-12 files

FreeBSD/src 1a03846sys/kern vfs_cache.c

vfs cache: Simplify cache_enter_time() a bit

The condition `flag == NFC_ISDOTDOT && vp != NULL && vp->v_type != VDIR`
is never true at this point in the function.  This is asserted slightly
earlier.  So, remove some dead code and simplify control flow.

N.B. we set v_cache_dd for all vnode types, not just VDIR.  This seems
to be intentional, see commit ce575cd0e2f9069.  For regular files it
appears to effectively represent the most recently entered cache entry
for the vnode.

No functional change intended.

Reviewed by:    olce, kib
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50107

(cherry picked from commit 01435e28211220f985c66569f60939e440f0887f)
DeltaFile
+13-21sys/kern/vfs_cache.c
+13-211 files

FreeBSD/src ea8b5e7etc/mtree BSD.tests.dist, usr.sbin/sysrc Makefile

sysrc: Add some regressions tests

Reviewed by:    markj
MFC after:      1 month
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1664

(cherry picked from commit eeb2d4ffe95b4332811c14b56cfdf5fc6ea821b0)
DeltaFile
+351-0usr.sbin/sysrc/tests/sysrc_test.sh
+4-0usr.sbin/sysrc/Makefile
+3-0usr.sbin/sysrc/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+360-04 files

FreeBSD/src 8ba7ac5usr.sbin/makefs/ffs mkfs.c

makefs: Ensure that FFS superblocks are reproducible

The superblock structure has space reserved for a pointer to an
in-memory structure that gets created at mount time.  makefs populates
it since that simplifies code elsewhere.  However, the pointer value
ends up in the output file, which breaks reproducibility.

Zero the field when writing the superblock instead, as its on-disk value
is ignored.

Reviewed by:    emaste
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50196

(cherry picked from commit 764ccf410c3c5453c4656113d75cd81fcf01828d)
DeltaFile
+10-2usr.sbin/makefs/ffs/mkfs.c
+10-21 files

FreeBSD/src cdf6e2dsys/kgssapi/krb5 kcrypto_aes.c

krb5: Fix handling of transient crypto request failures

- Instead of using CRYPTO_F_DONE to decide whether a request has
  completed, use a custom protocol of setting crp_opaque = NULL in the
  callback and checking that instead.  CRYPTO_F_DONE is set independent
  of whether an error occurred, but for transient errors signaled by
  EAGAIN, we want to simply retry the request.
- Clear CRYPTO_F_DONE before retrying the request.
- Panic if the request truly failed, as we currently have no way to
  pass hard errors back up.

Reviewed by:    jhb
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D50238

(cherry picked from commit 04421fda140b92eb0d22bc4c0f81b6de05f21225)
DeltaFile
+19-11sys/kgssapi/krb5/kcrypto_aes.c
+19-111 files

FreeBSD/src 001fc46sys/kern kern_descrip.c

file: Simplify an INVARIANTS check in _fdrop()

No functional change intended.

MFC after:      1 week
Sponsored by:   Klara, Inc.

(cherry picked from commit a2e22ed3420d92d9d98a1e9681b5c9b1fbe40fca)
DeltaFile
+3-6sys/kern/kern_descrip.c
+3-61 files

FreeBSD/src 5ea5220usr.bin/du du.c

du: Fix threshold on non-directory files

PR:             265200
Reviewed by:    markj
MFC after:      1 month
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1648

(cherry picked from commit 0ae2b9e866d3aea1e9141841488561f12603f879)
DeltaFile
+3-1usr.bin/du/du.c
+3-11 files

FreeBSD/src f00a7fausr.sbin/sysrc sysrc

sysrc: Fix check flag logic for append and subtract

When using sysrc with the check flag (-c), the append (+=) and subtract
(-=) operations result in incorrect return values because on the check
path the necessary union/difference calculation logic is not performed.

However, the correct union/difference calculation is already performed
when running without the check flag. We fix the issue on the check path
by using the results from the existing union/difference calculation in
the check logic to get the correct return values.

PR:             279200
Reviewed by:    markj
MFC after:      1 month
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1664

(cherry picked from commit c97460c4d97db1bd46dab9f2bdbc90cd1ed7757f)
DeltaFile
+25-27usr.sbin/sysrc/sysrc
+25-271 files

FreeBSD/src 12effd9sys/kern vfs_cache.c, sys/sys vnode.h

vfs cache: Move hash row lookup loops into a subroutine

No functional change intended.

Reviewed by:    olce, kib
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50106

(cherry picked from commit cc25864d4568079cadef46291ddf7d501c81d60a)
DeltaFile
+64-65sys/kern/vfs_cache.c
+1-0sys/sys/vnode.h
+65-652 files

FreeBSD/src b080a04sys/kern vfs_cache.c

vfs cache: Add a predicate for testing cache entries

No functional change intended.

Reviewed by:    olce, kib
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50105

(cherry picked from commit 029ed5f574f61443fd12e0e70c7ab4dc296b81e5)
DeltaFile
+20-20sys/kern/vfs_cache.c
+20-201 files

FreeBSD/src ad5eecbsys/net if.c

ifnet: Integrate if_unroute() into if_down()

if_unroute() is static since 2004 and is not used anywhere except for
if_down().

This also makes it easier to grep by the pattern `if_flags &= ~IFF_UP`.

No functional change intended.

Reviewed by:    glebius
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D49356

(cherry picked from commit 0693c3f7cb3d9e5389863a0c131ddef799c77091)
DeltaFile
+8-21sys/net/if.c
+8-211 files

FreeBSD/src c20e7ebsys/net if.c

ifnet: Fix a typo in a source code comment

- s/possiable/possible

MFC after:      3 days

(cherry picked from commit ad2d7e594f6d519be6e9674c8048a406a453fef9)
DeltaFile
+1-1sys/net/if.c
+1-11 files