FreeBSD/src d05d660 — sys/netinet tcp_subr.c

tcp: count only the SACK blocks that fit in tcp_maxseg()

tcp_addoptions() sends only the SACK blocks that fit in TCP_MAXOLEN.
tcp_maxseg() counted every pending block and clamped the total, so
without timestamps and with five or more blocks pending it came out 4
bytes below the segment tcp_output() sends.  Limited transmit after an
RTO then sent one full segment and failed the "sent too much" KASSERT.

Approved by:    re (cperciva)
PR:             282605
Approved by:    adrian (mentor)
Signed-off-by:  Nick Price <nprice at FreeBSD.org>
Reviewed by:    tuexen, glebius, adrian
Differential Revision:  https://reviews.freebsd.org/D60460
(cherry picked from commit d3b02115d4b373c719d9a716da38d94511de3f07)
(cherry picked from commit aacae7b35a22a56e187a0a41db231d63ca9cefb6)
DeltaFile
+6-3sys/netinet/tcp_subr.c
+6-31 files

FreeBSD/src 8d4a8d1 — 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.

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

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

FreeBSD/src c52b45e — sys/netinet tcp_input.c tcp_var.h, sys/netinet/tcp_stacks rack.c bbr.c

tcp: improve consistency

Use an inline function tcp_adapt_iss_check() to perform the check
consistently instead of replicating the code multiple times. These
checks already became inconsistent.
A fix for PR 298560 requires more calls to tcp_adapt_iss_check().

Approved by:    re (cperciva)
Reviewed by:            Peter Lei
Fixes:                  fa2ad70a4511 ("tcp: make ghost ACK handling more conformant")
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61685

(cherry picked from commit e3483dbc91b59b5b2c73a4bc792fbb834c3dc111)
(cherry picked from commit 73929d1dc3b4116ca12cc3fe08fa3a9b66bf3318)
DeltaFile
+10-0sys/netinet/tcp_var.h
+1-4sys/netinet/tcp_stacks/rack.c
+1-4sys/netinet/tcp_stacks/bbr.c
+1-4sys/netinet/tcp_input.c
+13-124 files

FreeBSD/src 202f628 — sys/netinet tcp_input.c

tcp: make ghost ACK handling more conformant

The latest version of draft-ietf-tcpm-tcp-ghost-acks changed
a condition. This should make no substantial difference, but makei
it compliant to the latest version of the specification.

Approved by:    re (cperciva)
Reviewed by:            rscheff, Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D58411

(cherry picked from commit fa2ad70a4511e7b379e81de82c9e51b2e0994295)
(cherry picked from commit a170546cb8d13a67ee3062114228d3df4744bbee)
DeltaFile
+1-1sys/netinet/tcp_input.c
+1-11 files

FreeBSD/src 6a3f0ed — sys/netinet tcp_output.c

tcp: improve sender side SWS avoidance

When checking for a full sized segment, take all TCP options that will
be included into account. This fixes a bug which can trigger the
"sent too much" KASSERT related to limited transmit.

Approved by:    re (cperciva)
Reported by:            olivier
Reviewed by:            rscheff, Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61605

(cherry picked from commit d174085f9f895ed444bd95120da3eff481a58f1a)
(cherry picked from commit 13357c1ee34f9f8655375714c60da8bf4881493a)
DeltaFile
+1-13sys/netinet/tcp_output.c
+1-131 files

FreeBSD/src 480ff19 — sys/netinet/tcp_stacks bbr.c

tcp bbr: improve handling of retransmissions in LAST-ACK

When performing a timer based retransmission, clear the
BBR_RWND_COLLAPSED flag. If it sticks, t_rxtshift is never incremented
resulting in unlimited retransmissions in the LAST-ACK state.

Approved by:    re (cperciva)
Reported by:            Illia Vynohradov
Reviewed by:            Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61586

(cherry picked from commit 3c6fd437b1824caeddb5f0d4570d43cf0c999c14)
(cherry picked from commit cbd17b66e64e9bdf025200c4993b8aeae6a0ebe9)
DeltaFile
+1-1sys/netinet/tcp_stacks/bbr.c
+1-11 files

FreeBSD/src 1b9c494 — sys/netinet/tcp_stacks bbr.c

tcp bbr: improve persits timeout computation

t_srtt and t_rttvar use different lengths of fractions, therefore use
the appropriate shift value.

Approved by:    re (cperciva)
Reviewed by:            Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61600

(cherry picked from commit 751882926dc0bb1f7a4834c4b5e8d951cee61c7c)
(cherry picked from commit 3e74519d5136d4eb0fee56148ff30c66607a3eac)
DeltaFile
+1-1sys/netinet/tcp_stacks/bbr.c
+1-11 files

FreeBSD/src 1180c43 — sys/netinet/tcp_stacks bbr.c

tcp bbr: improve retransmit timout calculation

The retransmission timeout should the srtt + 4 * rttvar.
The srtt is using 5 bits of fractions and rttvar is using 4 bits of
fractions, some specific shifting is required.

Approved by:    re (cperciva)
Reviewed by:            Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61581

(cherry picked from commit 2f98793a13fe3e69cf6b698fa469550b4ba0fea1)
(cherry picked from commit ccf8e3762c3948446263ae3ef0dd98391ef9f97e)
DeltaFile
+1-2sys/netinet/tcp_stacks/bbr.c
+1-21 files

FreeBSD/src 8c4970f — sys/netinet/tcp_stacks bbr.c

tcp bbr: improve invalidating rtt

Invalidate the rtt based on t_rxtshift instead of resetting t_srtt to 0,
because using the latter also affects the retransmission timeout.

Approved by:    re (cperciva)
Reviewed by:            Peter Lei
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D61585

(cherry picked from commit 8018d75601dfe804a8d70f4f08bdb0e4e3a8c5c9)
(cherry picked from commit 158dcb8e415d84caf6ebc30841ed4bfc3148bc32)
DeltaFile
+2-4sys/netinet/tcp_stacks/bbr.c
+2-41 files

FreeBSD/src 476b507 — sys/netinet/tcp_stacks bbr.c

tcp bbr: cleanup

No functional change intended.

Approved by:    re (cperciva)
Sponsored by:   Netflix, Inc.

(cherry picked from commit 34436bb7cf971dba1c0dcdb1d45f22fff1a4b6c1)
(cherry picked from commit c8ca5fa512fbbd04c69438cde86e6e2dd1c4597b)
DeltaFile
+3-4sys/netinet/tcp_stacks/bbr.c
+3-41 files

FreeBSD/src a4875f2 — sys/dev/acpica acpi_pxm.c

acpica: Fix SRAT memory region insertion sort

The SRAT table can list memory regions in any order, but we need them
sorted.  There is an insertion sort to accomplish this when building
the mem_info array, but instead of inserting the new region before
the *first* higher-base-address region, it was inserting the new
region before the *last* higher-base-address region; i.e. if the array
already held "1 3 4" then inserting "2" would produce "1 3 2 4".

Break out of the insertion-location-finding loop when we find the right
spot to insert the new memory region into the list, rather than looking
further.

Approved by:    re (cperciva)
Reviewed by:    jhb
Fixes:  dd540b46236b ("Add a parser for the ACPI SRAT table...")
MFC after:      1 day
Sponsored by:   Amazon
Tested on:      c5n.9xlarge, c6a.24xlarge, c6a.metal, c7a.metal-48xl

    [7 lines not shown]
DeltaFile
+1-0sys/dev/acpica/acpi_pxm.c
+1-01 files

FreeBSD/src c3f47d8 — release/tools ec2.conf

EC2: Set hw.dmar.enable="1"

Large EC2 "bare metal" instances route interrupts to APIC IDs > 255,
and unlike the "virtualized" instances, don't support extended APIC
destination IDs (since that's a hypervisor feature, and bare metal
instances have no hypervisor).

Enable the IOMMU for interrupt remapping; this unbreaks booting on
m8i.metal-96xl and variants thereof (e.g. c8in).

Approved by:    re (cperciva)
MFC after:      1 day
Sponsored by:   Amazon
Tested on:      c5n.9xlarge, c6a.24xlarge, c8in.96xlarge, c5.metal,
                c6in.metal, c6a.metal, c7a.metal-48xl, c7i.metal-24xl,
                c7i.metal-48xl, c8a.metal-24xl, c8a.metal-48xl,
                c8i.metal-48xl, c8i.metal-96xl, c8in.metal-48xl,
                c8in.metal-96xl, m5.metal, m8azn.metal-24xl


    [2 lines not shown]
DeltaFile
+4-0release/tools/ec2.conf
+4-01 files

FreeBSD/src 2b8445d — sys/compat/freebsd32 freebsd32_misc.c

procctl: Zero the output structure for the compat32 syscall

Otherwise the freebsd32 implementation of PROC_REAP_STATUS leaks
uninitialized kernel stack memory.

Approved by:    re (cperciva)
Reviewed by:    kib
Reported by:    Dennys Kaluzny Pereira <dennyskaluzny at gmail.com>
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61510

(cherry picked from commit 5a834ad15f1f09d43a6840c74da194db6f890aa2)
(cherry picked from commit 42e71f0bafc23c0707752381d0b25649d12ae8c4)
DeltaFile
+1-0sys/compat/freebsd32/freebsd32_misc.c
+1-01 files

FreeBSD/src cff4d5d — sys/arm64/arm64 elf_machdep.c, sys/kern imgact_elf.c

imgact_elf: Pass program headers to the sv_protect hook

We handle program headers beyond the first page of the file, but
arm64_exec_protect() wasn't updated to handle this.  Pass the program
header array directly to the sv_protect hook.

Also fix a pre-existing bug: imgp->et_dyn_addr isn't the right base
address to use for the SV_INTERP case.

Approved by:    re (cperciva)
Reported by:    alc
Reviewed by:    alc, kib
Fixes:          804daf166406 ("imgact_elf: read program headers if not contained in the first page")
Fixes:          670af174e27b ("arm64: Enable BTI in the kernel ELF loader")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61999

(cherry picked from commit 884e1a00151d181e5dd1ba9d83c1adcffd25e5e8)
DeltaFile
+6-4sys/arm64/arm64/elf_machdep.c
+2-2sys/kern/imgact_elf.c
+2-1sys/sys/sysent.h
+10-73 files

FreeBSD/src 68d4c95 — usr.sbin/sysrc sysrc sysrc.subr, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Restore alignment with rc(8) boot process

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

POSTCR-d0a167652278ed81d259a1b77620b0c1cb9f72c8-1:
set -f around source_rc_confs stops glob expansion of rc_conf_files,
so sysrc no longer sees files that rc(8) sources

Partially "revert" d0a167652278 with respect to RC_CONFS, `-f file`,
rc_conf_files handling, and source_rc_confs invocation.

Add an ATF test to ensure we maintain rc(8) alignment.

Reported by:    llm-postcr
Fixes:          d0a167652278 ("sysrc: Support special characters in file names")
DeltaFile
+43-0usr.sbin/sysrc/tests/sysrc_test.sh
+19-9usr.sbin/sysrc/sysrc.subr
+7-10usr.sbin/sysrc/sysrc
+69-193 files

FreeBSD/src ecb4794 — contrib/tzcode localtime.c

tzcode: Avoid integer truncation resulting in wrong weekday

From a report[1] on the tz mailing list:

In timesub() the weekday is stored in (int) tm_wday before reduction
modulo seven (DAYSPERWEEK).  Previously this could overflow a 32-bit
int, resulting in an incorrect weekday calculation.

Calculate two additional intermediate terms modulo seven to avoid an
intermediate value that does not fit in 32 bits.

We're committing this patch now so we can have something in place for
FreeBSD 15.2.  If a different change is committed upstream we will
replace this.

[1] https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/O3RZGBKSO5GXBFDZKW2JXO3OQIIGYBF3/

PR:             300977
Requested by:   re (cperciva)

    [2 lines not shown]
DeltaFile
+2-2contrib/tzcode/localtime.c
+2-21 files

FreeBSD/src 329b13f — sys/conf files, sys/modules Makefile

nfsclrdma: Add build glue for nfsclrdma sources

Commit 80bee4d836 added the sources for client side NFS
over RDMA.

This patch adds the code to build these sources as a
module called nfsclrdma.ko or in the kernel when
kernel options NFSCL and OFED are specified.

Reviewed by:    markj
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D61926
Fixes:  80bee4d83637 ("nfsclrdma: Add code to support client side NFS over RDMA")
DeltaFile
+16-0sys/modules/nfsclrdma/Makefile
+5-0sys/conf/files
+2-0sys/modules/Makefile
+23-03 files

FreeBSD/src 77e6a5a — sys/fs/nfsclient nfs_clvfsops.c

nfs_clvfsops.c: Don't allow krb5i/krb5p or TLS for RDMA

I don't think it makes any sense to do encryption/decryption via
the cpu for data being RDMA'd.  (The whole point of RDMA is to
move the data fast.)  Disallow the combination of "rdma" and
"krb5i", "krb5p" or "tls".

MFC after:      1 month
Fixes:  884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
DeltaFile
+14-3sys/fs/nfsclient/nfs_clvfsops.c
+14-31 files

FreeBSD/src f129398 — usr.bin/localedef collate.c

localedef: off by one bug drops the highest code point from every collation table

localedef(1) writes one fewer entry than it has into the "large" (code point
above UCHAR_MAX) collation table, and records a count one short.  The table is
built in code point order, so the entry lost is always the character with the
highest code point in the locale.  For that character wcsxfrm(3) returns 0 and
wcscoll(3) gives it no weight: it sorts with the ignorables and compares equal
to unrelated characters.

Reviewed by:    rmoeller, kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D60057
DeltaFile
+1-1usr.bin/localedef/collate.c
+1-11 files

FreeBSD/src 5af4db2 — sys/netlink/route iface_drivers.c

netlink: Do not change interface flags on an empty ifinfomsg

Since f89f82e4042a, _nl_modify_ifp_generic() treats ifi_change == 0
as a request to apply all of ifi_flags.  A RTM_NEWLINK request that
only modifies attributes carries a zeroed ifinfomsg, so it brought
the interface down and cleared its permanent promiscuous mode as a
side effect.

Only apply flags for an empty ifi_change when ifi_flags is set,
which matches the behavior of Linux.

Fixes:  f89f82e4042a ("netlink: Fix IFF_UP flag handling in RTM_NEWLINK's modify_link handler")
Differential Revision:  https://reviews.freebsd.org/D61504
DeltaFile
+3-2sys/netlink/route/iface_drivers.c
+3-21 files

FreeBSD/src 11fe1f9 — sys/netinet6 nd6.c in6.c, tests/sys/netinet6 ndp.sh

nd6: Keep addresses tentative when DAD cannot run

in6_ifa_need_dad() ignored the interface state, making addresses on
down/ifdisabled interfaces optimistic and usable while DAD was deferred.
Guard it like nd6_dad_start() and re-evaluate it in in6_if_up() and
nd6_timer().

Also, reject IN6_IFF_NOTREADY sources in nd6_ns_output_fib() and
GRAND because optimistic DAD can fail while sockets are already using
the address.

While here, add some tests to make sure these never happen.

Reported by:    llm-postcr
Fixes:          c7cd7e7fad57 ("nd6: Add support for Optimistic DAD (RFC 4429)")
Differential Revision:  https://reviews.freebsd.org/D55229
DeltaFile
+409-1tests/sys/netinet6/ndp.sh
+19-5sys/netinet6/nd6_nbr.c
+11-0sys/netinet6/in6.c
+1-0sys/netinet6/nd6.c
+440-64 files

FreeBSD/src b29084a — share/man/man4 tcp_rack.4, sys/netinet/tcp_stacks rack.c

tcp/rack: reject unknown rate_sample_method values

The net.inet.tcp.rack.rate_sample_method sysctl is copied into every
new RACK connection but accepts any integer, while the
TCP_BBR_RACK_RTT_USE socket option only accepts USE_RTT_HIGH (0),
USE_RTT_LOW (1) and USE_RTT_AVG (2). With any other value,
tcp_rack_xmit_timer_commit() panics an INVARIANTS kernel on the first
RTT sample of each new connection ("Unknown rtt variant"). Without
INVARIANTS it returns early on every sample, so the connection never
updates its SRTT, RTTVAR or RTO.

Validate the sysctl with a handler that accepts only the three values
that the socket option accepts, and document the third value in the
sysctl description and in tcp_rack(4).

Reviewed by:    tuexen
Co-authored-by: Claude Opus 5.5
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D62072
DeltaFile
+26-4sys/netinet/tcp_stacks/rack.c
+3-2share/man/man4/tcp_rack.4
+29-62 files

FreeBSD/src 21acd0c — sys/netinet/tcp_stacks rack.c

tcp/rack: range-check pace_max_seg sysctl and socket option

The net.inet.tcp.rack.pacing.pace_max_seg sysctl is a 32-bit integer,
but rack_init() copies it into each new connection's 7-bit bitfield
rc_user_set_max_segs. Values that do not fit are truncated, and a value
of 128 becomes 0. A connection with rc_user_set_max_segs of 0 ends up
with a pacing max segment size of 0, and rack_setup_fast_output() then
executes rounddown(left_to_send, 0), causing an integer divide fault:

  Fatal trap 18: integer divide fault while in kernel mode
  #5 rack_do_segment_nounlock+0x29eb
  ... (fault in rack_setup_fast_output() inlined into rack_output())

The TCP_RACK_PACE_MAX_SEG socket option clamps values above
MAX_USER_SET_SEG (63), but it accepts 0, which leads to the same
division by zero.

Validate the sysctl with a handler that only accepts 1 to
MAX_USER_SET_SEG, and reject a socket option value of 0 with EINVAL

    [12 lines not shown]
DeltaFile
+35-4sys/netinet/tcp_stacks/rack.c
+35-41 files

FreeBSD/src c31d86d — tests/sys/net/bpf bpf.sh

tests/net/bpf: run the bpf:inject test with RSS again

1abb62867f2a skipped the test on RSS kernels because epair(4) delivered
the injected frames out of order.  The reordering within a flow is fixed
in if_epair, but the test still failed in about one run in seven: the
first capture starts with the ARP request from ping(8), which is not an
IP packet and goes to the first epair queue, while the ICMP flow goes to
the queue its hash selects.  Written back to back by the inject step,
the two may arrive in either order.

Add static ARP entries on both ends so that the captures hold only the
ICMP flow, and remove the skip.  On an 8-CPU RSS kernel the test then
passed 250 of 250 runs with the if_epair fix and failed 26 of 150
without it.

While here, use the -j option of ifconfig(8), netstat(1) and arp(8)
instead of jexec(8).

Reviewed by:            glebius, pouria

    [2 lines not shown]
DeltaFile
+11-8tests/sys/net/bpf/bpf.sh
+11-81 files

FreeBSD/src 61dc82a — usr.sbin/arp Makefile.depend Makefile

arp: Teach arp to attach and run itself in a jail

Add a -j jail option, which makes arp(8) attach to the named jail
before it does its work.  This lets the host display and change the ARP
table of a vnet jail that does not have arp(8) installed, such as a
thin jail or a Linux jail.  For example, `arp -j foo -an` or
`arp -j foo -d -a`.

The file given to -f is opened before attaching and processed inside
the jail, as sysctl(8) and ngctl(8) do.  It must be a regular file or
a pipe, so that no directory or device descriptor is carried into the
jail.  Host names are resolved inside the jail, as route(8) and
netstat(1) do.

Reviewed by:            pouria, zlei, ziaee
MFC after:              1 week
Relnotes:               yes
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61725
DeltaFile
+61-17usr.sbin/arp/arp.c
+30-1usr.sbin/arp/arp.8
+5-0usr.sbin/arp/Makefile
+1-0usr.sbin/arp/Makefile.depend
+97-184 files

FreeBSD/src 4efbfe6 — etc/mtree BSD.tests.dist, share/man/man4 fdescfs.4

fdescfs: descend through /dev/fd/N when mounted linrdlnk

Linux resolves a path below /proc/self/fd/N in the directory the
descriptor names, and linprocfs makes /proc/<pid>/fd a symlink to
/dev/fd.  Under linrdlnk the fdescfs node carries only VV_READLINK,
which namei will not walk through, so such a path fails with ENOTDIR.

Return the underlying vnode from fdesc_lookup for a non-final component,
or a trailing slash, reusing the machinery the nodup option already
uses.  The last component is untouched, so open("/dev/fd/N") keeps its
dup(2) semantic; a descriptor with no vnode behind it, such as a pipe,
yields ENOTDIR.

Add ATF coverage for traversal, descriptor reuse, and preservation of
last-component and mount-option semantics.

Approved by:    adrian (mentor)
Reviewed by:    kib, adrian
Differential Revision:  https://reviews.freebsd.org/D59393

    [2 lines not shown]
DeltaFile
+302-0tests/sys/fs/fdescfs/fdescfs_test.c
+16-1sys/fs/fdescfs/fdesc_vnops.c
+6-1share/man/man4/fdescfs.4
+2-0etc/mtree/BSD.tests.dist
+326-24 files

FreeBSD/src 01111ef — sys/dev/pci pcireg.h pci.c

pci: restore resizable BAR sizes in pci_cfg_restore()

After a device reset, resizable BARs return to their default sizes.
Restore them to the sizes they had prior to reset.

Reviewed by:    imp, adrian
Differential Revision:  https://reviews.freebsd.org/D61110
Approved by:    adrian (mentor)
(cherry picked from commit 665afd2a9d6469ce692de4018c7c015a194c201d)
DeltaFile
+49-0sys/dev/pci/pci.c
+9-0sys/dev/pci/pcireg.h
+58-02 files

FreeBSD/src aacae7b — sys/netinet tcp_subr.c

tcp: count only the SACK blocks that fit in tcp_maxseg()

tcp_addoptions() sends only the SACK blocks that fit in TCP_MAXOLEN.
tcp_maxseg() counted every pending block and clamped the total, so
without timestamps and with five or more blocks pending it came out 4
bytes below the segment tcp_output() sends.  Limited transmit after an
RTO then sent one full segment and failed the "sent too much" KASSERT.

PR:             282605

Approved by:    adrian (mentor)
Signed-off-by:  Nick Price <nprice at FreeBSD.org>
Reviewed by:    tuexen, glebius, adrian
Differential Revision:  https://reviews.freebsd.org/D60460
(cherry picked from commit d3b02115d4b373c719d9a716da38d94511de3f07)
DeltaFile
+6-3sys/netinet/tcp_subr.c
+6-31 files

FreeBSD/src 3f42750 — sys/netipsec ipsec_input.c

netipsec: Do not unlock the sahtree twice in ipsec6_common_input_cb()

For transport mode, ipsec6_common_input_cb() releases the sahtree read
lock before it walks the remaining header chain.  The error exits of
that walk jumped to the bad label, which released the lock a second
time.  A packet that exceeds net.inet6.ip6.hdrnestlimit, is truncated,
or fails the inbound policy check on its last header is enough to get
there.

The second rm_runlock() panics kernels with INVARIANTS.  Without
INVARIANTS it unbalances td_pinned and removes a tracker that is no
longer queued, which may corrupt the per-CPU tracker list.

Give the header chain walk its own exit label that skips the unlock.

Reported by:            llm-postcr
Reviewed by:            markj, kib
Fixes:                  183513d15f22 ("sys/netipsec: ensure sah stability...")
MFC after:              1 week

    [2 lines not shown]
DeltaFile
+5-4sys/netipsec/ipsec_input.c
+5-41 files

FreeBSD/src f0692bc — usr.sbin/sysrc sysrc, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Fix unlikely and rare edge-case

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

POSTCR-1.1: with -F, the "unchanged" check compares a file path
against the new value, so a value equal to the path is silently
not written

Add an ATF test to ensure we catch the edge-case possibility.

Special note: To replicate this misbehavior you'd have to do
something like: sysrc -f /etc/rc.conf foo=1 and then execute
sysrc -F -f /etc/rc.conf foo=/etc/rc.conf

Reported by:    llm-postcr
Fixes:          eaf7113bef8f ("sysrc: Add "unchanged" messages")
DeltaFile
+38-0usr.sbin/sysrc/tests/sysrc_test.sh
+11-19usr.sbin/sysrc/sysrc
+49-192 files