FreeBSD/src 59e24c3 — sbin/ipfw ipfw.8

ipfw.8: document the skipto cache

Since 4a77657cbc01 the skipto cache can be turned on and off at run
time with "ipfw enable|disable skipto_cache", and its state is shown
by the read-only net.inet.ip.fw.skipto_cache sysctl.  The manual page
lists the keyword only in the SYNOPSIS, and the skipto action refers
to SYSCTL VARIABLES for details that are not there.

Describe the cache with the skipto action: what it speeds up, that it
is off by default and per VNET, and how much memory it takes.  Add
net.inet.ip.fw.skipto_cache to SYSCTL VARIABLES.

Reviewed by:    ae
Co-authored-by: Claude Opus 5.5
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D62029
DeltaFile
+41-6sbin/ipfw/ipfw.8
+41-61 files

FreeBSD/src 30836df — usr.sbin/bhyve pci_virtio_input.c

bhyve(8): Preserve const qualifier in pci_vtinput_legacy_config()

Signed-off-by: Amir Shakeri <amirmuhammadshk at gmail.com>

Reviewed by:    emaste
Pull request:   https://github.com/freebsd/freebsd-src/pull/2592
DeltaFile
+1-1usr.sbin/bhyve/pci_virtio_input.c
+1-11 files

FreeBSD/src af942da — sys/compat/linuxkpi/common/include/linux compat.h

LinuxKPI: Add in_compat_syscall()

Return true when the current process is a 32-bit process running on a
64-bit kernel, matching the Linux semantics.  On native 32-bit kernels
there is no compat ABI, so always return false.

Reviewed by:    wulf
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61900
DeltaFile
+15-0sys/compat/linuxkpi/common/include/linux/compat.h
+15-01 files

FreeBSD/src d87841f — sys/dev/usb usbdevs, sys/dev/usb/net if_smsc.c if_muge.c

usb: Disentangle SMC and SMSC

In the 1990s Standard Microsystems Corporation used the name SMC and
produced complete NICs like the SMC EtherEZ 8416BTA.  It appears this
part of the business became SMC Networks and was later acquired by
Accton Technology.

By the early 2000s Standard Microsystems Corporation sold network ICs
(not complete NICs) and exclusively used the short name SMSC.  SMSC was
acquired by Microchip in 2012.

We originally obtained usbdevs from NetBSD, and this update matches the
SMC / SMSC IDs currently in NetBSD.

Reviewed by:    bz, adrian
Differential Revision: https://reviews.freebsd.org/D61724
DeltaFile
+29-27sys/dev/usb/usbdevs
+1-1sys/dev/usb/net/if_smsc.c
+1-1sys/dev/usb/net/if_muge.c
+31-293 files

FreeBSD/src a65e23f — lib/libsys modstat.2 kldstat.2, sys/kern kern_linker.c

kern_linker: Fix struct version mismatch

The kldstat(2) syscall supports two different structures, identified by
their size, which the application stores in the version field before the
call.  Since one is a prefix of the other, instead of calling different
functions to fill each one in like modstat(2) does, we fill in the
larger of the two and simply don't copy out the extra fields if the
smaller one was requested.  As a side effect, we failed to fill out the
version field in either case.  This causes application code that sets
the version field once and calls kldstat(2) repeatedly to fail since the
version field is now incorrect for subsequent calls, whereas the same
pattern works fine for modstat(2) because it copies the same version
value back out.  Fix this by setting the version field immediately
before copying the struct out.

While here, amend the manual pages for both kldstat(2) and modstat(2) to
clarify that the version field is unchanged on return and remove bad
advice about rebuilding world if either syscall returns EINVAL.


    [3 lines not shown]
DeltaFile
+3-12lib/libsys/modstat.2
+3-12lib/libsys/kldstat.2
+3-1sys/kern/kern_linker.c
+9-253 files

FreeBSD/src 8b1d5cb — usr.bin/lockf/tests lockf_test.sh

usr.bin/lockf/tests: Add require.progs="kdump"

This test requires kdump to function today. kdump can be omitted from
the system though via the build knob `MK_KDUMP != 0.

Add the require.progs constraint to check for kdump, so catch this
particular scenario and react accordingly.

MFC after:      1 week
Revision URI:   https://reviews.freebsd.org/D62041
DeltaFile
+1-0usr.bin/lockf/tests/lockf_test.sh
+1-01 files

FreeBSD/src e02e3ae — sys/netpfil/ipfw ip_dummynet.c

dummynet: do not log when a listing fills the buffer

When userland lists a range of objects, dummynet_get() sizes the
buffer from the request, and ipfw(8) and dnctl(8) retry with a bigger
one if the reply may be truncated.  copy_obj() and copy_obj_q() still
log every stop as an error, so "ipfw queue N show" with many dynamic
queues prints "copy_obj_q ERROR ... have 16 need 96" although the
listing is complete.

Keep the error for a bad object and log the full buffer only at debug
level 3 and above.

PR:             290420
Reported by:    dimka at dz.dn.ua
Reviewed by:    kp
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D61964
DeltaFile
+14-2sys/netpfil/ipfw/ip_dummynet.c
+14-21 files

FreeBSD/src a38bc03 — sys/netpfil/pf pf_ioctl.c

pf: protect against the ethernet rule going away during DIOCGETETHRULE

We release the rules lock during DIOCGETETHRULE, but wait to clear the
counters until after we've unlocked. This risks the rule being freed at
the point where we reset the counters. Move the counter clearing to be
covered by the lock.

Reported by:    llm-postcr
Fixes:          30087aa2e00a ("pf: Support clearing ether counters")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+7-7sys/netpfil/pf/pf_ioctl.c
+7-71 files

FreeBSD/src 06b4369 — sys/netpfil/pf pf_ruleset.c pf_ioctl.c

pf: hold PF_RULES_xLOCK when calling pf_find_keth_ruleset()

The ethernet rules are protected entirely by the PF_RULES_LOCK, not by
epoch. Update DIOCGETETHRULESETS, DIOCGETETHRULESET, DIOCADDETHRULE and
DIOCGETETHRULES to account for this.

Fixes:          c5131afee39b ("pf: add anchor support for ether rules")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+43-39sys/netpfil/pf/pf_ioctl.c
+2-0sys/netpfil/pf/pf_ruleset.c
+45-392 files

FreeBSD/src fab0d0e — sys/netpfil/pf pf_ioctl.c

pf: don't forget to CURVNET_RESTORE()

Reported by:    llm-postcr
Fixes:          96c545176df7 ("pf: don't allow any ioctl calls until we're fully initialised")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+4-2sys/netpfil/pf/pf_ioctl.c
+4-21 files

FreeBSD/src d9f4536 — sys/dev/bnxt/bnxt_en if_bnxt.c

bnxt: fix an out-of-bounds write in bnxt_copy_maddr()

bnxt_copy_maddr() copies link-layer multicast addresses into the
BNXT_MAX_MC_ADDRS-entry list given to the firmware, but only skips the
copy when cnt == BNXT_MAX_MC_ADDRS.  The callback returns 1 for every
address, so with 18 or more addresses it writes past the end of the
list.  bnxt_multi_set() switches to ALL_MCAST when there are more than
BNXT_MAX_MC_ADDRS addresses, so the extra entries are never used, but
on amd64 the list sits at the start of a 4 KB allocation, and with 683
or more addresses the writes go past it.

Skip the copy for every cnt >= BNXT_MAX_MC_ADDRS.

Fixes:          dbf9bf044c6e ("Convert to if_foreach_llmaddr() KPI.")
MFC after:      2 weeks
Sponsored by:   E-CARD LTD.
Sponsored by:   Klara, Inc.

Reviewed by:    sef, gallatin
Differential Revision:  https://reviews.freebsd.org/D61950
DeltaFile
+1-1sys/dev/bnxt/bnxt_en/if_bnxt.c
+1-11 files

FreeBSD/src b1020d3 — sys/dev/bnxt/bnxt_en if_bnxt.c bnxt_hwrm.c

bnxt: don't fail init when out of VLAN L2 filters

bnxt_hwrm_set_filter() allocates an L2 filter for every configured
VLAN and fails the init if any allocation fails.  A port has a fixed
number of L2 filters (509 on a BCM57416), so with enough VLANs every
init fails with RESOURCE_ALLOC_ERROR and the port stays down until
VLANs are removed.

The port's MAC filter does not match on VLAN, so the per-VLAN filters
are not needed to receive tagged traffic ( VLANs added while the port
is running already work without one until the next init).  Treat
ENOMEM from the VLAN filter allocations as non-fatal (leave the
remaining tags without a filter and log their count, once per init).
Any other error still fails the init.

Append new tags in bnxt_vlan_register() instead of prepending them, so
the oldest VLANs keep their filters and the most recently added ones
beyond the ports capabilities do not get a filter.


    [7 lines not shown]
DeltaFile
+24-0sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+9-1sys/dev/bnxt/bnxt_en/if_bnxt.c
+33-12 files

FreeBSD/src 3e286f0 — sys/dev/bnxt/bnxt_en if_bnxt.c

bnxt: reset VLAN filter IDs in bnxt_clear_ids()

bnxt_clear_ids() resets the firmware IDs the driver caches, including
vnic_info.filter_id, but not the per-VLAN filter IDs added in
91fcacc35597.  On pre-P5 chips, bnxt_init_hw() and bnxt_stop() free
the filters in firmware with HWRM_FUNC_RESET and leave tag->filter_id
set.  Once the VLAN filters have been allocated, the next init (for
example from ifconfig down/up or an MTU change) fails in
bnxt_hwrm_set_filter() with "Attempt to re-allocate l2 ctx filter",
and the port stays down until its VLANs are removed.

Reset tag->filter_id along with vnic_info.filter_id.

Fixes:          91fcacc35597 ("if_bnxt: Add support for VLAN on Thor")
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Sponsored by:   E-CARD LTD.

Reviewed by:    sef
Differential Revision:  https://reviews.freebsd.org/D61945
DeltaFile
+3-0sys/dev/bnxt/bnxt_en/if_bnxt.c
+3-01 files

FreeBSD/src 884e1a0 — 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.

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
DeltaFile
+6-4sys/arm64/arm64/elf_machdep.c
+2-2sys/kern/imgact_elf.c
+2-1sys/sys/sysent.h
+10-73 files

FreeBSD/src 655407e — sys/netipsec ipsec_output.c, tests/sys/netipsec/tunnel bundle.sh

netipsec: Apply the rest of a bundle when the PMTU check finds no SA

ipsec{4,6}_check_pmtu() looks up the SA of the last request of a policy to
learn the path MTU.  When that request is at level "use" and no SA is
found for it, the lookup returns EJUSTRETURN, and ipsec4_common_output1()
and ipsec6_common_output() took that to mean that the packet needs no
IPsec processing.  That holds for a policy with one request.  For a bundle
it also skipped the requests before the last one, for example the ESP
tunnel request of "esp/tunnel/A-B/require ah/transport//use", and the
packet was sent without their transforms.

The lookup finds no SA when none is installed, and also when the last
request is a transport request that follows a tunnel request, as in the
example.  The lookup fills in the empty addresses of a transport request
from the packet as it is before any transform, while the transform applies
the request after the tunnel request, to the outer header, and the SA is
installed for the addresses of the tunnel.  So the bundle above was sent
without its transforms even with an AH SA from A to B in place.


    [21 lines not shown]
DeltaFile
+44-5tests/sys/netipsec/tunnel/bundle.sh
+24-14sys/netipsec/ipsec_output.c
+68-192 files

FreeBSD/src 5775048 — sys/dev/acpica/Osd OsdSchedule.c

acpi: Tasks: Ensure taskqueue is running before allowing to drain

In AcpiOsWaitEventsComplete(), fix the test controlling whether to call
taskqueue_drain_all(): That must happen only if threads to process the
taskqueue have been created.

In the initial code, there is a very small window where
'acpi_boot_tasks_nb' could be 0 but some task was concurrently enqueued
(e.g., by an interrupt), leading to a call to taskqueue_drain_all()
which would wait forever in the absence of threads processing the
taskqueue.

Reported by:    llm-postcr
Sponsored by:   The FreeBSD Foundation
DeltaFile
+5-8sys/dev/acpica/Osd/OsdSchedule.c
+5-81 files

FreeBSD/src b2467ef — sys/dev/acpica/Osd OsdSchedule.c

acpi: Tasks: Always enqueue in the taskqueue right away

There is no need for delaying enqueuing ACPI tasks until the taskqueue's
threads have started.  Taskqueues perfectly support that, as once
taskqueue threads are started, they will pick up enqueued tasks
naturally.

Remove this mechanism, which allows a number of simplifications:
- Remove the now-useless ACPI_TASK_ENQUEUED flag.
- Remove an atomic manipulation to set ACPI_TASK_ENQUEUED on each task
  enqueue in the common case.
- Simplify AcpiOsWaitEventsComplete() by using taskqueue_drain_all()
  directly, and make it print a warning when called before the taskqueue
  threads have started.

While here, use atomic functions to operate on 'acpi_taskq_started'.

Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61548
DeltaFile
+42-49sys/dev/acpica/Osd/OsdSchedule.c
+42-491 files

FreeBSD/src dd960a7 — sys/dev/acpica/Osd OsdSchedule.c

acpi: Tasks: Remove the now-redundant 'acpi_task_count'

That number is used only up to the moment when the ACPI taskqueue's
threads are started to print the number of tasks queued so far.  This is
now redundant with 'acpi_boot_tasks_nb'.  So use the latter and remove
it, with the benefit that no more useless updates are performed at task
creation and end, which could create contention.

Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61547
DeltaFile
+4-8sys/dev/acpica/Osd/OsdSchedule.c
+4-81 files

FreeBSD/src f4abec1 — sys/dev/acpica/Osd OsdSchedule.c

acpi: Tasks: Count task slots used during boot separately

During boot, tasks can be enqueued by drivers before the scheduler is up
and the ACPI taskqueue threads running.  Such tasks pile up in the task
queue until they can actually be processed.  This makes the number
reported by the 'debug.acpi.tasks_hiwater' sysctl(8) knob less useful,
as if it is representative of the maximum amount of storage needed, it
does not allow to understand the degree of task concurrency at run-time,
which itself can be useful to size the queue and/or the number of
processing threads.

Create a separate counter for tasks queued at boot, and update it
instead of the already existing one before the taskqueue starts being
processed.  Export it via the new 'debug.acpi.boot_tasks_nb' sysctl(8)
knob.  The existing counter is now updated only after this phase.

Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61546
DeltaFile
+16-6sys/dev/acpica/Osd/OsdSchedule.c
+16-61 files

FreeBSD/src 99cde78 — sys/dev/iicbus/sensor tmp461.c

TMP461 sensor: Fix temperature reading in extended range mode

In extended range mode, the temperature's integral part is stored as an
unsigned byte offset by 64, not as a signed byte.  Stop treating it as
a signed value in this case, in particular sign extending it.  Doing so
would cause temperatures above 128°C (and in particular nearing the
maximum operating point of 150°C) to be treated as negative ones, as the
sign extension happened after substracting the offset.  In the original
commit introducing the driver, sign extension was done before, in which
case the problem manifested as soon as 64°C.  It may have been noticed
while introducing support for ADT7461, but was not completely fixed at
that time.

While here, fix typos in two comments.

Reported by:    llm-postcr
Reviewed by:    manu
Fixes:          f89f6f9581bd ("TMP461: Add thermal sensor driver")
Fixes:          6665c7a62839 ("TMP461: Add support for ADT7461 sensor")

    [3 lines not shown]
DeltaFile
+13-11sys/dev/iicbus/sensor/tmp461.c
+13-111 files

FreeBSD/src 3ab6dae — sys/dev/iicbus/sensor tmp461.c

TMP461 sensor: Fix UB when reading the temperature

Left shifting a potentially negative number is undefined behavior
according to the C standard (still in C23, although that's probably
a mistake for this one).

Shift left the just-read data first, as it is of an unsigned type
(uint8_t), and then sign-extend the result with the new sign_extend32().

Reviewed by:    manu
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61763
DeltaFile
+5-1sys/dev/iicbus/sensor/tmp461.c
+5-11 files

FreeBSD/src 1c7d92d — sys/dev/ntsync ntsync.c

ntsync(4): do not leak the priv when devfs_set_cdevpriv() fails

(cherry picked from commit d3bfdc5f048773d530e1873f9d4fe7d0481c7324)
DeltaFile
+5-2sys/dev/ntsync/ntsync.c
+5-21 files

FreeBSD/src 74756b1 — sys/dev/ntsync ntsync.c

ntsync(4): fix double free and leak of the per-open priv

(cherry picked from commit 92adb5d4cd22e93e1f6539994e30eca9fdcdb250)
DeltaFile
+23-30sys/dev/ntsync/ntsync.c
+23-301 files

FreeBSD/src 4c4416d — bin/sh parser.c

sh(1): Preserve const qualifier on strchr(3) result

Signed-off-by: Amir Shakeri <amirmuhammadshk at gmail.com>
Reviewed by:    kfv, dteske
Approved by:    dteske (mentor)
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2574
DeltaFile
+1-1bin/sh/parser.c
+1-11 files

FreeBSD/src 24ebe1e — tests/sys/kern procdesc.c

tests/sys/kern/procdesc: test the reaper's own PD_NOWAITPID child

Check that the reaper can waitpid(2) for its PD_NOWAITPID child after
closing the last process descriptor, untraced, detached, or with the
tracing reaper exiting.

Based on reproducers provided by Laam Alif <laamalif at proton.me>.

PR:     301072
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61975
DeltaFile
+177-0tests/sys/kern/procdesc.c
+177-01 files

FreeBSD/src a16f0b2 — sys/kern sys_procdesc.c

procdesc_close(): grant waitpid(2) when the reaper is already the parent

When the process is already a child of its reaper, proc_reparent()
returns early and does not re-enable waitpid(2), so after the last
process descriptor was closed nobody could reap the zombie.  If the
reaper was also tracing the process, it was additionally linked onto
the reaper's own orphan list, and after PT_DETACH it stayed there
untraced, again without a waitpid(2) reference.

PR:     301072
Reviewed by:    kib, markj
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61975
DeltaFile
+15-3sys/kern/sys_procdesc.c
+15-31 files

FreeBSD/src a8bf2ad — lib/libc/powerpc64/gen _setjmp_resolver.c sigsetjmp_resolver.c

libc/powerpc64: save v20-v31 in setjmp

setjmp and its variants save the non-volatile GPRs and FPRs, but not the
non-volatile vector registers v20-v31, so after a longjmp they hold
whatever the code that jumped left in them. Julia runs into this when it
switches tasks with sigsetjmp/siglongjmp: the compiler keeps vector values
in v20-v31 and they come back from another task.

jmp_buf has had room for them all along. Add setjmp entry points that save
them and pick those with ifuncs when the CPU has Altivec, so the same libc
still works on CPUs without it, like the e5500. They note in the buffer
where the registers went, and longjmp loads them back only if the note is
there.

rtld can't use ifuncs, so it builds its own sigsetjmp that checks hwcap
when it's called. It needs the registers saved too: when it restarts a
symbol lookup to upgrade its lock, it longjmps out of functions that use
v31, and a lazily bound call came back with v31 zeroed.


    [3 lines not shown]
DeltaFile
+102-1lib/libc/powerpc64/gen/sigsetjmp.S
+87-4lib/libc/powerpc64/gen/setjmp.S
+87-2lib/libc/powerpc64/gen/_setjmp.S
+20-0lib/libc/powerpc64/gen/_setjmp_resolver.c
+20-0lib/libc/powerpc64/gen/sigsetjmp_resolver.c
+20-0lib/libc/powerpc64/gen/setjmp_resolver.c
+336-72 files not shown
+344-108 files

FreeBSD/src 36b5db4 — usr.sbin/bhyve pci_e82545.c

bhyve: e82545: allow access to the last receive address register

The model exposes 16 receive address register pairs, but both accessors
asserted that the index was below 15.  Use E82545_RAR_MAX as the last
valid index for the register ranges and accessors.  Size the address
array from the same limit and use its length when clearing valid bits.

Signed-off-by: Wanpeng Qian <wanpengqian at gmail.com>
MFC after:      2 weeks
Sponsored by:   keelos.dev
Differential Revision:  https://reviews.freebsd.org/D60219
Co-authored-by: Kevin Bowling <kbowling at FreeBSD.org>
DeltaFile
+7-7usr.sbin/bhyve/pci_e82545.c
+7-71 files

FreeBSD/src 4dc5ef5 — sys/compat/linux linux_xattr.c

linux(4): compare xattr namespace names with strcmp()

xattr_to_extattr() compared each namespace over the length of the
caller's prefix and would read past the end of any shorter name

the values are already null-terminated so we can just use strcmp()
here

Reviewed by:    rmoeller
Differential Revision:  https://reviews.freebsd.org/D60954
DeltaFile
+4-6sys/compat/linux/linux_xattr.c
+4-61 files

FreeBSD/src 2fb3cd9 — sbin/ipfw ipfw.8

ipfw.8: cosmetic nits
DeltaFile
+2-2sbin/ipfw/ipfw.8
+2-21 files