kern/kern_exit.c: fix decision to give back to real parent in proc_reap()
p_oppid records the reaper by pid only, and nothing updates p_oppid when
the reaper changes. When p_oppid no longer matches, proc_realparent()
falls back to p_reaper. In proc_reap(), the test p_oppid !=
p_pptr->p_pid is then still true, so proc_reap() "gives back" the child
to proc_realparent(). That resolves to the new reaper, which is already
p_pptr. proc_reparent() returns early, the reaper gets a spurious
SIGCHLD, and proc_reap() returns without reaping.
Another problem with p_oppid check is that a parked zombie is leaked
permanently under the new reaper if the reaper changes before the
debugger waits, because p_oppid keeps the old reaper's pid.
In proc_reap(), base the give-back decision on the resolved parent
instead of the pid comparison.
Reported by: llm-postcr
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
contrib/lutok: update generated headers/build glue
lutok and kyua have both been updated for the new tests and the adjusted
header layout.
MFC after: 1 week
MFC with: 5e4c3200cdc7 ("contrib/lutok: update to 0.7.1")
contrib/lutok: update to 0.7.1
This is a bugfix release. Users are encouraged to take this version.
MFC after: 1 week
Merge commit 'dac7d818e3cef52d724592c6b349dbd8ad9a049a'
contrib/lutok: compile/run tests from the project
This change adds the necessary glue to build and run the tests
distributed with each release, sans the examples tests. liblutok is
an "internal" library, so the headers and library aren't distributed
with installworld, et al, and thus the examples tests--which require the
headers/library to build tests on the fly--fail when the tests are run,
due to this difference with the upstream project.
MFC after: 1 week
iflib: remove the legacy interrupt before freeing the queues
iflib_device_deregister() and the iflib_device_register() failure path
freed the queue structures and ran IFDI_DETACH before tearing down an
INTx or MSI handler. A shared INTx line can run the driver filter and
iflib_fast_intr_rxtx() at any time, so another device's interrupt in
that window used freed queues and driver state. Tear the handler down
before anything is freed.
Reported by: llm-postcr
Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D62040
iflib: clear an interrupt after freeing it
em(4) and several other drivers free their MSI-X vectors when
IFDI_MSIX_INTR_ASSIGN fails, then free them again from IFDI_DETACH,
which iflib's attach failure path runs next. The second
iflib_irq_free() tears down a stale tag and releases a stale resource.
Clear both so it is a no-op.
Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D62039
lutok: import lutok-0.7.1
This change adds lutok lutok-0.7.1 from upstream [1].
The lutok-0.7.1 artifact was been verified by SHA256 checksum [2].
This is a bugfix release.
The core issues addressed in this release relate to memory handling in edge
cases and a handful of build-related bugfixes found when enabling ASAN in CI.
A huge shoutout goes to @holmuk for the findings and fixes made in the library.
Users are encouraged to upgrade to this release.
More information about the release (from a high level) can be found in
the release notes [3].
Updated with [4] like: `update_lutok.sh 0.7.1 lutok-0.7.1`.
[5 lines not shown]
linuxkpi: set M_AMPDU for NICs that require host reordering
Set the M_AMPDU flag on RX packets for NICs that require host
reordering.
The reporter (Denis) sees a traffic increase from ~ 100Mbit/sec
to ~365Mbit/sec and a decrease in dropped frames due to RX
sequence / RX CCMP PN reordering.
PR: 300862
Obtained from: Denis Lemire <denis at lemire.name>
MFC after: 1 month
ipfw: Destroy global state after the vnets on unload
A module's MOD_UNLOAD handler runs before any of its SYSUNINITs. Since
ipfw_destroy() moved into MOD_UNLOAD, vnet_ipfw_uninit() runs after it
and takes locks that ipfw_destroy() has already destroyed: the sockopt
handler lock, and vnet_mtx in a vnet that tracks interfaces. kldunload
ipfw panics with INVARIANTS:
panic: mtx_lock() of destroyed mutex @ sys/netpfil/ipfw/ip_fw_sockopt.c:3038
ipfw_del_sopt_handler() <- ipfw_destroy_tables() <- vnet_ipfw_uninit()
<- vnet_deregister_sysuninit() <- linker_file_sysuninit()
<- linker_file_unload()
Call ipfw_destroy() from a SYSUNINIT at SI_ORDER_FIRST instead, which
runs after the SI_ORDER_SECOND vnet teardown, as before 9bcc1e97dda8
and as pf does for pf_unload().
Reviewed by: glebius
Fixes: 9bcc1e97dda8 ("ipfw: cleanup SYSINIT(9)s")
[2 lines not shown]
ipfw: Run the vnet hooks of ipfw_nat, nat64 and nptv6 after ipfw's
9bcc1e97dda8 put the SYSINITs of ipfw_nat, ipfw_nat64 and ipfw_nptv6
at SI_ORDER_SECOND, the order of ipfw's own vnet hooks; before, they
ran after them.
In ipfw_nat, the module-wide hooks and the vnet hooks now share that
order too, which leaves their relative order to the sort. As built,
kldunload ipfw_nat runs ipfw_nat_destroy() first: it clears
ipfw_nat_ptr and lookup_nat_ptr while every vnet still has
V_ipfw_nat_ready set, and a packet that hits a nat rule in between
calls a NULL pointer:
(null)() at 0 <- ipfw_check_packet <- pfil_mbuf_in <- ip_input
Loading can open the same window the other way around.
The vnet hooks of all three modules also tie with ipfw's, and run after
them on vnet creation and before them on destruction only because ipfw
[10 lines not shown]
ipfw: Drain the state expiry task before taking the upper half lock
vnet_ipfw_uninit() takes the upper half lock and then drains the task
that expires dynamic states. Since 331333ba0186 that task, dyn_tick(),
takes the same lock, so when it fires while a vnet is being destroyed
the two wait for each other and jail -r hangs:
jail: taskqueue_drain_timeout <- vnet_ipfw_uninit <- vnet_destroy
swi6: _sx_xlock <- dyn_tick <- taskqueue_run_locked
Drain the task first. The pfil hooks and the sockopt handler are
detached by then, and dyn_tick() takes the lock itself.
Reviewed by: glebius
Fixes: 331333ba0186 ("ipfw: hold sleepable "upper half...")
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D62245