FreeBSD/src 9daf6d6sys/kern uipc_shm.c kern_umtx.c

shm: Handle swap pager allocation failures

shm_alloc() can fail if swap reservation fails (i.e., vm.overcommit is
non-zero) or racct is imposing some limits on swap usage.

PR:             282994
MFC after:      2 weeks
Reviewed by:    olce, kib
Differential Revision:  https://reviews.freebsd.org/D47839

(cherry picked from commit f3b7dbdad53b31492757417fc1336ed74ec80fd8)
DeltaFile
+50-30sys/kern/uipc_shm.c
+7-1sys/kern/kern_umtx.c
+57-312 files

FreeBSD/src 113875fsys/net iflib.c

iflib: Set the NUMA domain in receive packet headers

Reading PR 273559 made me realize that commit 767723ddebe9 is
incomplete.  iflib should set the NUMA domain of received packets before
passing them to protocol layers.

PR:             273559
Reviewed by:    zlei, kbowling, erj
Fixes:          767723ddebe9 ("iflib: Use if_alloc_dev() to allocate the ifnet")
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D47841

(cherry picked from commit 3d642b0f71c501dd9ee7aa0487788f619900d297)
DeltaFile
+3-0sys/net/iflib.c
+3-01 files

FreeBSD/src 0c5701fsys/netipsec key_debug.c

pfkey: Fix some checks in kdebug_sadb()

Besides not doing any sufficient check that the length of a parsed
message is not bigger than the actual allocated buffer, kdebug_sadb()
incorrectly compares ext->sadb_ext_len, the extension payload size in 8
byte chunks, with tlen, which is the full message payload size in bytes.

This should compare PFKEY_UNUNIT64(ext->sadb_ext_len) with tlen instead.

PR:             277456
MFC after:      2 weeks

(cherry picked from commit 0dab21248bc9fab09e92b0c037303c921ebb1b8d)
DeltaFile
+3-3sys/netipsec/key_debug.c
+3-31 files

FreeBSD/src 60786ebusr.bin/sockstat sockstat.c

sockstat: Ensure that there is always a space between columns

PR:             282978
Reviewed by:    asomers
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D47840

(cherry picked from commit fbd3448614fbd7bd92e7d34c3bfd2592a07391e3)
DeltaFile
+33-23usr.bin/sockstat/sockstat.c
+33-231 files

FreeBSD/src 6e423beshare/man/man4 ow_temp.4

ow_temp(4): fix typo

Reviewed by:    mhorne, imp
Differential Revision:  https://reviews.freebsd.org/D48128
DeltaFile
+1-1share/man/man4/ow_temp.4
+1-11 files

FreeBSD/src a2d7871usr.bin/sed sed.1 process.c

sed: The change ("c") command should start a new cycle.

The "c" command should start the next cycle as clarified in POSIX 2024.
This is also consistent with historical and gnu sed behavior.

This patch is from OpenBSD by way of NetBSD with a tweak to the man page
date by me.

Confirmed the test case in the bug now works.

PR:             271817
Obtained from:  NetBSD (1.39 uwe), OpenBSD (1.39 millert)
Sponsored by:   Netflix
DeltaFile
+2-2usr.bin/sed/sed.1
+1-1usr.bin/sed/process.c
+3-32 files

FreeBSD/src c7d1368sys/net if_lagg.c

lagg: do not advertize support for ipsec offload

It is not implemented, and most likely cannot be, in a robust manner.

Reviewed by:    Ariel Ehrenberg <aehrenberg at nvidia.com>, slavash
Sponsored by:   NVidia networking
DeltaFile
+2-0sys/net/if_lagg.c
+2-01 files

FreeBSD/src 22bb70ashare/man/man9 namei.9

namei: add more detail about LOCKSHARED's behavior

[skip ci]

MFC after:      2 weeks
Sponsored by:   ConnectWise
Reviewed by:    markj
Differential Revision: https://reviews.freebsd.org/D48125
DeltaFile
+15-4share/man/man9/namei.9
+15-41 files

FreeBSD/src e1060f6sys/dev/ofw ofw_bus_subr.c

ofw: Fix inverted bcmp in ofw_bus_node_status_okay

Otherwise this matches any two-character status except for ok.

Fixes:          e5e94d2de987 ("Expand OpenFirmware API with ofw_bus_node_status_okay method")
MFC after:      1 week
DeltaFile
+1-1sys/dev/ofw/ofw_bus_subr.c
+1-11 files

FreeBSD/src 01eb126sys/netpfil/pf pf.c

pf: fix double free in pf_state_key_attach()

In 371bd29d4b we fixed a state key leak, but unintentionally introduced a double free.
We pass through the relevant code twice, first for PF_SK_WIRE, then for
PF_SK_STACK. If we fail to attach on the second pass we have a more complex
cleanup job, handled by pf_detach_state(). We must only free the state keys
manually on the first pass, on the second one pf_detach_state() takes care of
everything.

Tested by:      yds <yds at Necessitu.de>
Fixes:          371bd29d4b22257a7e92e1e711cca3d94cfbd00d
MFC after:      2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+6-4sys/netpfil/pf/pf.c
+6-41 files

FreeBSD/src f25d7ffsys/netpfil/pf pf.c

pf: SCTP abort messages fully close the connection

As per RFC (RFC4960 section 3.3.7) an ABORT terminates the connection fully. We
should mode the state to CLOSED rather than CLOSING.

Suggested by:   Oliver Thomas
See also:       https://redmine.pfsense.org/issues/15924
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2sys/netpfil/pf/pf.c
+2-21 files

FreeBSD/src 4f58451sys/riscv/conf std.eswin GENERIC, sys/riscv/eswin files.eswin

riscv: connect eswin to the build.

Connect Eswin IP drivers to the build.

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D48119
DeltaFile
+5-0sys/riscv/conf/std.eswin
+2-0sys/riscv/eswin/files.eswin
+1-0sys/riscv/conf/GENERIC
+8-03 files

FreeBSD/src 92e237esys/arm64/apple apple_wdog.c apple_aic.c

arm64: apple: re-align to recent standards

In the time these have lingered in my tree, we've started to drop the
__FBSDID tags.  Make sure we're using SPDX tags (and the correct one)
as well.

Reported by:    mhorne
DeltaFile
+1-3sys/arm64/apple/apple_wdog.c
+2-0sys/arm64/apple/apple_aic.c
+3-32 files

FreeBSD/src 32c4572share/man/man9 atomic.9

atomic(9): Update manpage after constifying atomic loads

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-2share/man/man9/atomic.9
+2-21 files

FreeBSD/src fa368ccsys/amd64/include atomic.h, sys/i386/include atomic.h

x86 atomics: Remove unused WANT_FUNCTIONS

This macro has not been in use since commit "inline atomics and allow tied
modules to inline locks" (r335873, f4b3640475cec929).

Reviewed by:    markj, kib, emaste, imp
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D48061
DeltaFile
+0-15sys/i386/include/atomic.h
+0-3sys/amd64/include/atomic.h
+0-182 files

FreeBSD/src f1ddb6fsys/security/mac_do mac_do.c

MAC/do: Fix a compilation warning about an unused function

grant_supplementary_group_from_flags() had been used in previous
versions of the recent changes, but recently has not been needed
anymore.  It has been kept around just in case deliberately, by analogy
with grant_primary_group_from_flags() (this one still being used).
DeltaFile
+1-1sys/security/mac_do/mac_do.c
+1-11 files

FreeBSD/src 2eace89sys/arm64/apple apple_wdog.c, sys/conf files.arm64

arm64: add a driver for the Apple watchdog

Ensure it's disarmed upon attach, provide basic reset functionality.

Register definitions/usage obtained from OpenBSD.

Reviewed by:    ray
Differential Revision:  https://reviews.freebsd.org/D39824
DeltaFile
+236-0sys/arm64/apple/apple_wdog.c
+3-0sys/conf/files.arm64
+239-02 files

FreeBSD/src 04160e0sys/arm64/apple apple_aic.c, sys/conf files.arm64

arm64: add a driver for the Apple Interrupt Controller

Some limited support for later multi-die SoC is included, but not at all
tested and not expected to be functional yet.  kevans needs to finish
getting his serial boards constructed, as the beefiest AS machine that
actually has multiple die to support in his fleet is currently a
dedicated serial console.

Reviewed by:    andrew
Co-authored-by: Andrew Turner <andrew at FreeBSD.org>
Co-authored-by: Mike Karels <karels at FreeBSD.org>
Differential Revision:  https://reviews.freebsd.org/D48079
DeltaFile
+779-0sys/arm64/apple/apple_aic.c
+1-0sys/conf/files.arm64
+780-02 files

FreeBSD/src fa5f4c1sys/kern subr_asan.c subr_csan.c, sys/sys atomic_san.h

atomic: Update interceptor function signatures after commit 5e9a82e898d5

Fixes:  5e9a82e898d5 ("atomics: Constify loads")
DeltaFile
+2-2sys/sys/atomic_san.h
+1-1sys/kern/subr_asan.c
+1-1sys/kern/subr_csan.c
+1-1sys/kern/subr_msan.c
+5-54 files

FreeBSD/src 56816e6sys/riscv/eswin eswin_reset.c

riscv: Eswin hwreset support added.

Add reset controller driver for Eswin EIC7700.

This one has two reset cells in FDT, which is unusual, so provide a
custom hwreset_map method.

Tested on SiFive Premier P550.

Reviewed by: mhorne, jrtc27
Differential Revision: https://reviews.freebsd.org/D47853
DeltaFile
+190-0sys/riscv/eswin/eswin_reset.c
+190-01 files

FreeBSD/src 6766e8csys/riscv/sifive sifive_ccache.c

riscv: Add SiFive CCache driver.

Eswin EIC7700 has non-coherent DMAs but predate the standard RISC-V Zicbom
extension, so we need to use the SiFive CCache controller for non-standard
cache management operations.

Tested on SiFive Premier P550.

Reviewed by: mhorne, jrtc27
Differential Revision: https://reviews.freebsd.org/D47831
DeltaFile
+177-0sys/riscv/sifive/sifive_ccache.c
+177-01 files

FreeBSD/src a7bf553lib/libvmmapi/riscv vmmapi_machdep.c, sys/riscv/include vmm.h

riscv vmm: add SSTC extension check.

Check if RISC-V SSTC is available and advertise to the guest.

This is needed for Eswin EIC7700 that does not include SSTC.

As we don't have a mechanism for reporting extension presence
from the kernel to userspace, then use vm_cap_type for now.

Reviewed by: mhorne, markj
Differential Revision: https://reviews.freebsd.org/D48058
DeltaFile
+9-8usr.sbin/bhyve/riscv/fdt.c
+8-1usr.sbin/bhyve/riscv/bhyverun_machdep.c
+4-0sys/riscv/vmm/vmm_riscv.c
+1-1usr.sbin/bhyve/riscv/fdt.h
+1-0lib/libvmmapi/riscv/vmmapi_machdep.c
+1-0sys/riscv/include/vmm.h
+24-106 files

FreeBSD/src 5d12193sys/netpfil/pf pf.c, tests/sys/netpfil/pf nat64.py

pf: teach nat64 to handle 0 UDP checksums

For IPv4 it's valid for a UDP checksum to be 0 (i.e. no checksum). This isn't
the case for IPv6, so if we translate a UDP packet from IPv4 to IPv6 we need to
ensure that the checksum is calculated.

Add a test case to verify this. Rework the server jail so it can listen for TCP
and UDP packets at the same time.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+60-1tests/sys/netpfil/pf/nat64.py
+12-0sys/netpfil/pf/pf.c
+72-12 files

FreeBSD/src 32cac60tests/sys/netpfil/pf nat64.sh

pf tests: test dummynet on nat64 rules

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+55-0tests/sys/netpfil/pf/nat64.sh
+55-01 files

FreeBSD/src 706b42csys/netpfil/pf pf.c

pf: give the correct address family to dummynet after nat64

Pass the new address family rather than the incoming one. In most (i.e. all but
nat64) that's the same, but for nat64 we want the new address family instead.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2sys/netpfil/pf/pf.c
+2-21 files

FreeBSD/src 08a5120sys/netpfil/pf pf.c

pf: fix dummynet + route-to for IPv6

Apply the fixes from c6f1116357904 and b8ef285f6cc6a to IPv6 as well.

Ensure that when dummynet re-injects it does so in the correct direction, and
uses the correct dummynet pipes.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+22-0sys/netpfil/pf/pf.c
+22-01 files

FreeBSD/src 7f3d159tests/sys/netpfil/pf nat64.sh

pf tests: test using an address range inside a table for nat64

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+63-0tests/sys/netpfil/pf/nat64.sh
+63-01 files

FreeBSD/src bdb583atests/sys/netpfil/pf nat64.sh

pf tests: test address range as nat64 from address

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+65-0tests/sys/netpfil/pf/nat64.sh
+65-01 files

FreeBSD/src 27fca15tests/sys/netpfil/pf nat64.sh

pf tests: validate ToS translation with nat64

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+33-0tests/sys/netpfil/pf/nat64.sh
+33-01 files

FreeBSD/src b0e3fb7sys/netpfil/pf pf_lb.c, tests/sys/netpfil/pf nat64.sh

pf: fix nat64 round-robin addresses from a table

We do multiple lookups during the nat64 process, some of which will fail due
to address family mismatches. Do not reset the lookup offset so we actually use
different addresses from the table.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+67-0tests/sys/netpfil/pf/nat64.sh
+0-1sys/netpfil/pf/pf_lb.c
+67-12 files