rtsock: drop a notification whose sockaddr does not fit
rtsock_msg_mbuf() bounces every sockaddr through a struct
sockaddr_storage on the stack, and only a KASSERT checks that it
fits. Without INVARIANTS, a larger sockaddr overflows the stack.
The callers pass only sockaddrs that the kernel built or checked, so
one that does not fit is a bug in the caller.
Also check at run time, as f3be7df50f0 did for rtsock_msg_buffer():
free the mbuf and return NULL, which every caller already handles
like a failed allocation.
Log the drop at LOG_DEBUG, as rt_xaddrs() does for an oversized
sockaddr from userland. The message is compiled in but off by
default. Setting net.route.debug.rtsock_debug_level to 7 shows which
message and sockaddr were dropped.
Reviewed by: lytboris
[4 lines not shown]
pf: fix displaying expired states
pf_state_expires() returns <= time_uptime for expired states. For such
states we should return a PF_ST_EXPIRE value of 0 to userspace.
We used to return the timestamp at which the state expired, which
resulted in nonsensical expiry times being printed. That in turn caused
the pfsync:expire_underflow test case to intermittently fail.
Adjust the test case to account for expired states now showing 'expires
in 00:00:00'.
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf: extend stricter checking for ICMPv6 packets
Now that we copy in the full MLD/ND packet we can sensibly inspect
their contents, and use them to generate more unique states for their
respective ICMPv6 packets.
Obtained From: OpenBSD, mcbride <mcbride at openbsd.org> 70bf7555ef4c
Sponsored by: Rubicon Communications, LLC ("Netgate")
if_ovpn: defer freeing of struct ovpn_kkey_dir
These keys are used in the data path, but can be freed through control
operations such as OVPN_NEW_KEY and OVPN_DEL_KEY. That might cause us to
use a freed key while processing packets.
Avoid this by using epoch callbacks to free the keys. That means that
the key is guaranteed not to be freed until after we're done with any
packet that could be using it.
Reported by: Kevin Day <kevin at your.org>
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
reaper_abandon_children(): leave no orphans on a reaped reaper
A reaper which exited stays the reaper of its subtree until it is
reaped, and processes can be linked onto its orphan list after its
exit1() emptied it. PT_ATTACH puts there a child which stayed with its
zombie reaper parent. Since 38ab6d47b7cb, reaper_adopt() puts there a
traced process which the zombie gets when a subreaper is reaped. When
the zombie is reaped in turn, reaper_abandon_children() keeps an orphan
holding a zombie reference with it, as is right only for
PROC_REAP_RELEASE. The struct proc is freed with the orphan still
linked to it, and proc_realparent() returns the freed or reused struct
proc on PT_DETACH, on the exit of the debugger, and from wait(2).
When the reaper is reaped, pass every orphan on to the new reaper, as
its children are. Anything linked onto the orphan list of a zombie
reaper is on its reaplist, so this empties the list. Assert that in
proc_reap().
Reported by: llm-postcr
[4 lines not shown]
tests/sys/kern/ptrace_test: reap a reaper which has a traced orphan
Add ptrace__parent_reaper_exits_before_attach, where the parent of the
traced child, also its reaper, exits before the attach. The child stays
with the zombie, and the attach puts it on the orphan list of the
zombie.
Add ptrace__reaper_exits_before_subreaper, where the parent of the
traced child is a subreaper, and the reaper above it exits first.
Reaping the parent while the reaper is a zombie hands the child over to
the zombie, and links it onto the orphan list of the zombie.
In both tests, the test process then reaps the zombie, detaches from
the child, and waits for it. Before the fix, the child stayed on the
orphan list of the freed reaper, and PT_DETACH handed it to the freed
struct proc.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
rtld-elf/i386: assume CPUID is always present
It is on amd64 host.
Reviewed by: jhb, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D60693
libc/csu/i386: assume CPUID is always present
It is on amd64 host.
Reviewed by: jhb, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D60693
i386 lib/msun: SSE2 is always present on amd64 host
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D60703
ipfw: match tcpmss only on the first fragment
08f0a1bdc091 dropped the check that O_TCPMSS has a TCP header to look
at. For a non-first fragment of a TCP datagram ulp is NULL, and
args->f_id._flags is not set for such a packet. ipfw_check_packet()
does not zero its struct ip_fw_args, so the flags may still have
TH_SYN from an earlier packet; a tcpmss rule then reads the TCP
header through the NULL pointer and the kernel panics.
Check offset == 0, as the other TCP header opcodes do: then the TCP
header has been pulled up and the flags belong to this packet.
Document that tcpmss looks only at packets with the SYN flag set and
never matches a fragment with a non-zero offset.
Add tests that send SYNs through a tcpmss rule, alone and each
followed by a non-first TCP fragment, and check the rule counters:
frag4: IPv4; panics without the fix.
frag6: IPv6; panics without the fix.
[8 lines not shown]
tools: Remove the vm86 test tool
This requires an i386 kernel (virtual 8086 mode only works from 32-bit
protected mode, it is not supported by long mode).
Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D60676
isa: Retire the isa_init() MD hook
The implementation was an empty function on all current platforms.
Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D60675
Retire the pnpinfo(8) utility
This was only enabled for i386 and is not relevant on modern hardware.
It was used to enumerate ISA add-on cards with configurable I/O
resources.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D60673
isa: Retire the ISAPNP option and related code
This was only enabled for i386 and is not relevant on modern hardware.
It configured ISA add-on cards with configurable I/O resources.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D60674
sys/modules: Consolidate amd64-only lists
Merge the previous amd64 || i386 list (which itself seemed to be split
into two arbitrary sub-groups) with the other amd64-only list into a
single, alphabetically-sorted list.
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D62017
sys/libkern: Remove [u]divmoddi4 libcalls
These were previously used by i386 but are no longer used.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D61882
Remove the i386 kernel and i386-only device drivers
This does not move any content from sys/x86 back to sys/amd64. A
few machine headers that are now amd64-specific may make sense to
move in the future.
This also removes all references to DEV_APIC which was only optional
on i386 and previously forced on for amd64. Now the #ifdef's are
removed and just assume DEV_APIC is always present.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D60671
amd64: Close gap between the TLB shootdown and bitmap IPIs
Previously this gap was filled by multiple TLB shootdown IPIs on i386.
Suggested by: kib
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D60808
smp.4: Drop COMPATIBILITY section
FreeBSD's kernel is now inherently SMP and it is supported on all
architectures.
Reviewed by: ziaee, kib
Differential Revision: https://reviews.freebsd.org/D61881
padlock: Remove architecture #ifdefs
This used to matter when PC98 was in the tree as this driver was
stubbed out for PC98, but since PC98's removal these #ifdefs are
always true since the driver is only compiled on x86 architectures.
Suggested by: kib
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D60806
vte: Remove the vte(4) driver
While the module for this driver is enabled on all architectures and
it is present in the MI NOTES, this driver supports a Fast Ethernet
MAC included in the 32-bit-only Vortex86 SoC. It is not available as
a standalone part, so is not relevant on any architectures other than
i386.
The companion rdcphy(4) driver is removed as well as it was only used
by the same SoC.
Reported by: imp
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D62016
libkvm: Drop static assertions for the i386 backend
These constants are never going to change but can only be verified
while kernel support remains in the tree. Remove the assertions in
preparation for removing kernel support.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D61351