asmc: code style modernization and minor cleanups
- Allow `ASMC_DEBUG` to be treated as a variadic macro.
- Add ellipses around `sizeof(..)` calls.
- Reindent some of the lines to better follow style(9) with line
wrapping.
A number of other clang-format changes were not taken as they are not
compatible with style(9).
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55394
libfetch: Gracefully skip unsupported protocols
If socket() fails because the address family or protocol is unsupported,
just continue with the next address.
MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D55407
libfetch: Fail hard if interrupted while connecting
This fixes an issue where the first address that DNS returns is blocked
by a packet filter, so we hang for a while, then the user hits Ctrl-C,
interrupting connect(2), whereupon we move on to the next address, get
a connection, request the file, and return to fetch(1), which sees that
SIGINT was caught and bails.
Note that we make no attempt to enforce fetchTimeout in the connection
phase, and never have. It's feasible, but non-trivial, so we'll leave
it as an exercise for future us.
PR: 293312
MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D55406
libfetch: Clean up fetch_info usage
* Provide a wrapper for the common if (verbose) fetch_info(...) idiom.
* Replace remaining instances of fprintf(stderr, ...) with fetch_info().
* Fix a few style nits.
MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D55405
libnetbsd: import `__CTASSERT(..)` macros
These compile-time assert macros are similar to `Static_assert` on FreeBSD.
These macros are in use in newer versions of `contrib/netbsd-tests`.
Obtained from: https://github.com/NetBSD/src (c26cc77b3a0b26b95a2)
MFC after: 1 week
tcp: improve validation of received TCP over UDP packets
Reviewed by: glebius, pouria
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D55410
nvmf: Limit the default I/O queue size to 128 entries
Previously the size defaulted to the maximum supported size reported
by the remote host. The value of 128 matches the default on Linux and
avoids excessive resource usage for I/O queues.
Sponsored by: Chelsio Communications
ctld: Honor the default maximum I/O queue size for NVMeoF controllers
<dev/nvmf.h> exports a constant to set the default maximum I/O queue
size which is used by ctl(4) if an explicit size is not set. This
value was chosen to match Linux's default, but it also avoids
excessive resource usage for I/O queues.
ctld was using the absolute maxium size as the default instead.
Sponsored by: Chelsio Communications
gre tests: Fix gcc warnings on gre netlink tests
Avoid using `snl_add_msg_attr_ip` for now and directly use
`snl_add_msg_attr_ip4` to silence gcc warnings.
Fixes: e1e18cc12e68
Differential Revision: https://reviews.freebsd.org/D54443
libc/arm: use __builtin_trap() instead of abort() in aeabi_unwind stubs
This avoids a dependency on the abort symbol in libsys.
PR: 292539
Reviewed by: mmel
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55255
(cherry picked from commit 1782bc9a0a8da2d6aca31b7790981e1980c9e4b9)
libsys/arm: include ARM EABI unwind bits into libsys
libsys required ARM EABI unwind symbols like __aeabi_unwind_cpp_pr0.
These symbols are normally provided by libc, but if a binary does
not link libc, the symbol ends up not being resolved.
Among other problems, this prevented gcc14 and newer from building
on arm.
Add the relevant symbols as hidden symbols into libsys to avoid this
problem.
(this patch was posted by jrtc27 who has asked me to move it along)
PR: 292539
Tested by: fuz, Mark Millard <marklmi26-fbsd at yahoo.com>
Reviewed by: mmel
Approved by: markj (mentor)
MFC after: 1 week
[3 lines not shown]
i386,amd64: Explicitly set ECX=0 in do_cpuid() to be future-proof
In principle, do_cpuid() should only be used for CPUID leaves without
sub-leaves. Even accessing sub-leaf zero (ECX=0), one must use
cpuid_count(ax, 0) rather than cpuid(ax).
However, one might assume do_cpuid(ax) is equivalent to
cpuid_count(ax, 0), but the old do_cpuid() did not initialize ECX before
executing the CPUID instruction. If ECX contained a non-zero value, the
instruction could return unexpected results, potentially leading to
subtle and hard-to-debug issues, especially in ported code.
To be future-proof and to help port code, adjust do_cpuid(ax) to be
cpuid_count(ax, 0) to explicitly set ECX=0.
It's believed that this change does not fix any real bugs in FreeBSD.
See also the DragonFly commit:
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/0087a1d163488a57787a9a6431dd94070b1988d4
[4 lines not shown]
HBSD: Harden kernel crashdump interface
Previously, anyone on the system (notably a jail's root user) could
successfully call `dumpon -l` and determine which dump device(s) were
configured.
`dumpon -l` uses the sysctl node `kern.shutdown.dumpdevname` as its
comms channel with the kernel for that purpose. (`sysctl kern.shutdown.dumpdevname`
is essentially the same as `dumpon -l` without error handling.)
With this commit we add CTLFLAG_ROOTONLY to that sysctl node, such
that anyone except the root user on the host can access it, ensuring
that `dumpon -l`/`sysctl kern.shutdown.dumpdevname` always fails
inside a jail.
hwpstate_amd(4): Fix punctuation in 'desired_performance' knob's description
To be consistent with that of the others.
No functional change.
Sponsored by: The FreeBSD Foundation
hwpstate_amd(4): CPPC: Allow attaching even if CAPABILITY_1 cannot be read
If that MSR cannot be read, we fallback to defaults specified by the
ACPI specification, as we are already doing when the minimum and maximum
values in there look bogus.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55252