powerpc/altivec: initialize vrsave to all regs active
libunwind uses vrsave to determine which registers to restore, but
vrsave is never actually updated in modern OSs including FreeBSD. This
leads to libunwind not restoring any altivec registers, resulting in
strange behaviors.
With this change gdb can now print a backtrace without crashing.
Patch originally provided by pkubaj.
MFC after: 3 days
bxe: Always return uint64_t from bxe_hilo
The interface counters are always uint64_t, so truncating to a signed
long only results in weird sign-extension errors on 32-bit platforms.
Reported by: llm-postcr
Fixes: df3601781d3e ("- Use if_inc_counter() to increment...")
imgact_binmisc: fix validation of new entries
The magic offset and size are both uint32_t, so their sum may wrap and
pass the IBE_MATCH_MAX check with an offset far outside of the image
header. Any exec that's checked against such an entry will then read
well beyond the header.
The name and interpreter length checks also read the byte following the
string before checking its index, so either one may fill its field
without a terminating NUL as long as the next field starts with one. A
full-length interpreter then overflows the normalization buffer in
imgact_binmisc_populate_interp() by a byte. An unterminated name is
instead truncated, which lets the same name be added more than once
since the duplicate check compares against the truncated copy.
Avoid the wrap and require both strings to be terminated within their
fields, and add regression tests for each. Note that these are only
reachable by root on the host.
[2 lines not shown]
imgact_binmisc: fix matching of magic bytes >= 0x80 without a mask
The image header is a char *, so on platforms with a signed char each
header byte is sign-extended before it's compared against the unsigned
magic. Any magic byte >= 0x80 then fails to match unless IBF_USE_MASK
is set, as the mask happens to strip the sign extension.
Compare the header as uint8_t instead, and add a regression test.
Reviewed by: imp, kib, markj
Differential Revision: https://reviews.freebsd.org/D62130
binmiscctl.8: restructure the 'add' definition, note short options
The previous version just used long prose to describe the different
options available, which makes it hard to work in the short options that
are defined. It's debatably also a less effective way to describe this.
Use a more standard option list and describe each option individually.
While we're here, fix the spelling of 'indent' later on.
Note that the descriptions are largely unchanged.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D62150
imgact_binmisc: enforce IBE_MAX_ENTRIES under the list lock
The sysctl handler checked the entry count without the list lock, but
the handlers are MPSAFE so concurrent adds may push the count past
IBE_MAX_ENTRIES. Once past, the == check never matches again and the
limit stops being enforced at all.
Add a check under the lock in imgact_binmisc_add_entry() and use >=,
drop the stale comment claiming that sysctl serializes us, and add a
test that fills the table. The test can't reliably hit the race, but
it at least covers the limit.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D62129
imgact_binmisc: don't leak the namei buffer with IBF_PRE_OPEN
namei(9) leaves the pathname buffer for the caller to free on success,
so we leak one from the NAMEI zone each time an entry is added with
IBF_PRE_OPEN. Free it once we've grabbed the vnode.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D62128
tests: add some basic tests for imgact_binmisc
These cover managing entries through binmiscctl(8) and exec'ing images
through matching entries, including interpreter argument and macro
expansion, masked magic at an offset, and pre-opened interpreters.
A small helper is included to execve(2) an image directly, so that we
can check for ENOEXEC without sh(1) trying to run the image as a script
instead. This will be expanded in future commits to include other
useful functionality that binmiscctl(8) cannot provide.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D62126
netipsec: Relabel only an outer IPv6 header that a tunnel built
When transport mode requests follow a tunnel mode request in a bundle,
ipsec_process_done() sets the flow label of the outer IPv6 header from
the outermost SA. It checks only that the policy has such a tunnel
request, not that it was applied. A tunnel request at level use
without an SA is skipped, and a transport request after it, unless it
names a destination other than the packet's, is then applied to the
packet's own header. With a policy such as
"esp/tunnel/A-B/use ah/transport//require", an AH SA between the hosts
and no ESP SA, every IPv6 packet leaves with the label of the AH SA. A
forwarded packet loses the label its source chose, which RFC 6437 asks
forwarding nodes to leave alone, and every flow through that SA gets
the same one.
Record in the packet's output history the mode of the request each SA
was applied for, rather than the SA's own, which may be "any", and
relabel only when the history holds a record of one of the policy's
earlier tunnel mode requests. Nothing else reads the mode in the
[11 lines not shown]
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")
devel/aphpunit: Upgrade from 2.3 to 2.42.0
Changelog:
Feature: Add optional legacy JUnit XML reports for CI and test-case management systems
Feature: Add --max-forks option to configure the number of parallel tests
Feature: Display test-case discovery and execution progress
Bugfix: Reap all finished child processes when SIGCHLD signals are combined
Bugfix: Report the test case and message and queue sizes when sending an IPC message fails
Bugfix: Add the missing bin/aphpunit executable for Composer installations
Bugfix: Use a separate IPC queue for each APHPUnit instance to support parallel runs
Taken from: https://gitlab.p.variablis.de/open-source/aphpunit/-/releases/2.42.0
Sponsored by: OTTRIA
(cherry picked from commit beecb1c707e52b0b92b3d7195fb82b3a24b32131)
devel/aphpunit: Upgrade from 2.3 to 2.42.0
Changelog:
Feature: Add optional legacy JUnit XML reports for CI and test-case management systems
Feature: Add --max-forks option to configure the number of parallel tests
Feature: Display test-case discovery and execution progress
Bugfix: Reap all finished child processes when SIGCHLD signals are combined
Bugfix: Report the test case and message and queue sizes when sending an IPC message fails
Bugfix: Add the missing bin/aphpunit executable for Composer installations
Bugfix: Use a separate IPC queue for each APHPUnit instance to support parallel runs
Taken from: https://gitlab.p.variablis.de/open-source/aphpunit/-/releases/2.42.0
Sponsored by: OTTRIA
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