zzz: Rewrite to use new power device
Previous script called acpiconf(8) (or apm(8) if ACPI wasn't supported,
although this was anyway redundant because APMIO just uses ACPI now).
Since a new generic power management interface was introduced, this isn't
sufficient, as this would only work for ACPI systems and for ACPI S3 suspend
(so no way to select suspend-to-idle). Rewrite in C to take advantage of the
new power interface.
We may want to add a switch to manually override the kern.power.suspend sysctl,
which is otherwise what the power device uses to decide which suspend type to
switch to (suspend-to-idle or firmware suspend), but this will require us to
amend the power interface.
Reviewed by: olce, imp, mhorne, ziaee
Tested by: mhorne
Approved by: olce, imp, mhorne, ziaee
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56918
padlock: Restore padlock_rng to the amd64 build
Revert 88a53301e19 and d1ca01059d5 . They removed padlock_rng from the
amd64 build under the mistaken belief that this device was available on
32-bit processors only. But it's also available on the 64-bit Via Nano,
Nano X2, and some Zhaoxin CPUs.
PR: 295517
Fixes: 88a53301e19 ("padlock.4: only install on i386")
Fixes: d1ca01059d5 ("padlock(4)/nehemiah: move i386-only entropy")
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D57215
syslogd: fix memory leak in casper_ttymsg()
nvlist_take_string_array(9) takes ownership of the array and its
strings. casper_ttymsg() freed neither, leaking memory on every
F_CONSOLE and F_TTY message. On long-running systems with high
error-rate syslog traffic routed to /dev/console, syslogd.casper grew
to hundreds of MB.
Use nvlist_get_string_array(9) to borrow the array instead. Update
casper_wallmsg() similarly.
Approved by: src (des)
Closes: https://github.com/freebsd/freebsd-src/pull/2222
Fixes: 61a29eca550b ("syslogd: Log messages using libcasper")
MFC after: 3 days
MFC to: stable/15
PR: 295488
Reported by: Pat Maddox <pat at patmaddox.com>
Reviewed by: markj
[3 lines not shown]
Fix building with LLVM_BINUTILS_BOOSTRAP but without CLANG_BOOTSTRAP
Without this change I get various undefined symbol errors when trying to
link llvm-nm and llvm-objcopy during the cross-tools stage.
Test Plan: builds now
Reviewed by: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56873
p9fs: Implement msize mount option and bump default to 128 KiB
QEMU warns when msize is <= 8192 due to degraded performance.
This change bumps our default msize to 128 KiB, matching the
Linux Kernel v5.15 and newer default. Linux supports even larger values,
but 128 KiB is a sensible default.
We also add a new 'msize' mount option to allow users to override
this value, and we validate it against our maximum supported MTU
(currently fixed by the UMA zone size).
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56496
p9fs: Refactor buffer allocations to avoid zeroing large payloads
Allocating large buffers with M_ZERO adds unnecessary overhead since
the data is immediately overwritten. This change embeds the tc and rc
p9_buffer structs directly into p9_req_t so we only zero the small
metadata headers. The actual data payload is allocated with M_NOWAIT.
Embedding the metadata headers by value also allows the p9fs_buf_zone
UMA items to be sized exactly to P9FS_MTU, ensuring they are nicely
aligned.
This also adds proper error handling to p9_get_request() to handle
UMA allocation failures.
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56495
bsd.sys.mk: suppress some clang warnings for C++ for >= 19
I just tried building with system clang on one of my Linux systems which
happens to be version 19, and these warning suppressions are needed for
that version too: same errors as in the original commit.
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56874
sigqueue: In capability mode, only allow signalling self
This is copied from the check in kern_kill.
Reviewed by: markj, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57244
divert: Avoid using atomic_(load|store)_(acq|rel)_16
It's not implemented on some arches. Use a plain int to count the
number of sockets in a divert lbgroup.
Reported by: Jenkins
Fixes: 895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets")
amd64: Drop segment descriptor details from trap messsages
Segment descriptor contents are fixed on amd64 and not very interesting
compared to the other values that are displayed.
While here, include both the thread and process details of the current
thread and drop redundant output of the trap number.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D56989
nlist.3: Replace a.out(5) Xref with elf(5)
ELF support was added to nlist() in 1997, and a.out support was removed
in 2020. The man page was not updated for either of these changes.
Fixes: 77909f597881 ("Initial elf nlist support, ...")
Fixes: 86cfa7e70b2b ("nlist: retire long-obsolete aout support")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 876a17321c896427d70de94101df4d888a19189b)
struct nlist is documented in both a.out(5) and stab(5), so add an Xref
to the latter.
(cherry picked from commit 762e451b318c8cbfddbcaaa92a218e8b45306eb9)
nlist.3: Clarify which symbol table is used
nlist() requires section headers, and currently fetches symbol names
only from SHT_SYMTAB,
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57065
(cherry picked from commit cd6bf930eafe850dc631feeaf8332832601f4225)
nlist.3: Add discouraged use notice
It is a relic from a.out days and is poorly specified. Although ELF
support was added to nlist, there are better ways to access ELF data.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57078
(cherry picked from commit 94b7a335683abcbcd76e8b67d37e21271d81590c)
unbound: Tweak freebsd-configure script
Regenerating the configure script is optional and can introduce noise
if the installed versions of autoconf, automake, and libtool do not
match those used upstream. Tweak our script slightly so it will skip
this step if libtoolize is not found.
(cherry picked from commit cd69bc03cf67b958e08206d49562903c57b5bd28)
unbound: Tweak freebsd-configure script
Regenerating the configure script is optional and can introduce noise
if the installed versions of autoconf, automake, and libtool do not
match those used upstream. Tweak our script slightly so it will skip
this step if libtoolize is not found.
(cherry picked from commit cd69bc03cf67b958e08206d49562903c57b5bd28)