netstat: update descriptions of two hostcache counters
Remove "on close", as now these counters are updated more often.
Reported by: llm-postcr
Fixes: c72102583a9a7881c5f992408dad6440840a8650
clnt_rdma.c: Add EADDRNOTAVAIL and EHOSTUNREACH error handling
There was a testing report that showed an RDMA connection
attempt replied EADDRNOTAVAIL during a network partitioning.
This error was not being handled as one that required a retry
of the connection attempt.
This patch adds EADDRNOTAVAIL and EHOSTUNREACH errors as ones
that require another reconnect attempt.
I have not been able to reproduce the failure, but think this
patch should correct the problem.
Reported by: Wafa Hamzah <wafah at nvidia.com>
MFC after: 1 month
Fixes: 80bee4d83637 ("nfsclrdma: Add code to support client side NFS over RDMA")
traceroute6: do not print an ECN report for an echo reply
packet_ok() takes the ECN bits from the IPv6 header quoted by an
ICMPv6 error message. The destination answers an ICMPv6 probe (-I)
with an echo reply, which repeats the ICMPv6 data of the probe but not
its IPv6 header, so for that reply the main loop used whatever an
earlier packet had left in ecn.
With -E the ECN report for the destination therefore repeated the
bits quoted by an earlier ICMPv6 error. If no ICMPv6 error had been
received before, because the destination is one hop away, the first
hops are skipped with -f or the routers on the path are silent, ecn
was still uninitialized:
$ traceroute6 -E -I -n -q 1 ::1
traceroute6 to ::1 (::1) from ::1, 64 hops max, 20 byte packets
1 ::1 0.055 ms (ecn=bleached)
Print the ECN report only when there is a quoted header. Document
[9 lines not shown]
traceroute: do not use a stale or NULL quoted header with -E
packet_ok() points the global hip at the IP header quoted by an ICMP
error message and nothing resets it afterwards. The destination
answers an ICMP probe (-I) with an echo reply, which repeats the ICMP
data of the probe but not its IP header, so for that reply the main
loop used whatever an earlier packet had left in hip.
With -E the ECN report for the destination was therefore read from
the payload of the echo reply. If no ICMP error had been received
before, because the destination is one hop away, the first hops are
skipped with -f or the routers on the path are silent, hip was still
NULL and traceroute crashed:
$ traceroute -E -I 127.0.0.1
traceroute to 127.0.0.1 (127.0.0.1), 64 hops max, 48 byte packets
Segmentation fault
With -D the stale quote was compared with the probe.
[12 lines not shown]
mbuf: declare mbuf hash types as distinct types, not flags
This refactors b06db8c9dafb to use language rather then a test case to
enforce correct use mbuf hash types. Also it makes debugger
print readable values, when you look up an mbuf.
Reviewed by: gallatin, kbowling
Differential Revision: https://reviews.freebsd.org/D60987
tcp: update the send/recv pipes in hostcache during connection lifetime
Modern browsers usually open multiple connections to a site and
connections that were created later now can benefit from host cache data
that was gathered by earlier (but still open) connection.
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D60733
sockets: garbage collect soopt_mcopyout()
It came from KAME and was a complement of soopt_mcopyin(), that
copied socket options passed by setsockopt(2) to mbufs. It was
unused since f95d46333db63ce9df4e8a2ca8c5c09bc0edfe72 in 2003
also from KAME.
linux(4): do not give a CLONE_PARENT child to an exiting parent
An exiting process hands its children to their reapers, and the
children it is the reaper of stay with its zombie until it is reaped.
A reaper which stays with the zombie of its reaper parent can call
clone(CLONE_PARENT). The new process then becomes the child of the
zombie, while the calling process, not the zombie, is its reaper. When
the zombie is reaped, reaper_abandon_children() does not see the new
process, which is not on its reaplist, and leaves it with the freed or
reused struct proc as its parent. The exit of the process locks and
signals that struct proc, and PT_ATTACH to it writes through its stale
sibling links.
Give the new process to its reaper instead when the parent of the
calling process is exiting, as the exit1() of the parent would do. The
parent sets P_WEXIT before its exit1() takes proctree_lock to reparent
its children, so a request that misses the flag is handled there.
Reported by: llm-postcr
[3 lines not shown]
ptrace(2): refuse PT_TRACE_ME when the parent is exiting
The child of a reaper stays with the zombie of the reaper until the
zombie is reaped, and PT_TRACE_ME from the child makes the zombie its
debugger. The child then stops at its next signal or execve(2) with no
debugger to continue it. When the zombie is reaped,
reaper_abandon_children() reparents the still traced child to the new
reaper, and proc_reparent() links it onto the orphan list of the zombie
being freed. proc_realparent() then returns the freed or reused struct
proc from wait(2) and on the exit of the new reaper. Since
6a079e1d87f2, INVARIANTS kernels panic on the assertion in proc_reap()
instead.
An exiting process cannot trace, so fail PT_TRACE_ME with EPERM when
the parent has P_WEXIT set, as it is done when the parent is init. The
parent sets P_WEXIT before its exit1() takes proctree_lock to untrace
its children, so a request that misses the flag is undone there.
Reported by: llm-postcr
[3 lines not shown]
proc_reap(): assert that the reaped process has no children left
A zombie keeps only the children it is the reaper of, and
reaper_abandon_children() passes them on when the zombie is reaped.
Assert that no child is left behind with the freed struct proc as its
parent, as was possible with linux(4) clone(CLONE_PARENT).
Suggested by: llm-postcr
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
tests/sys/kern/ptrace_test: reaper parent exits before PT_TRACE_ME
The child of a reaper stays with its zombie until the reaper is reaped.
Check that PT_TRACE_ME fails for it with EPERM, and that reaping the
reaper passes the child on to the test process, the next reaper up.
The result is checked before the reaper is reaped, and the child exits
right after the request, so that a kernel without the fix fails the
test instead of reaping a reaper with a traced child.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
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