26469 Commits
Author SHA1 Message Date
Konstantin Belousov 9dae9b31d2 libthr: require both _Unwind_ForcedUnwind and _Unwind_GetCFA for !PIC
Static linking must bring in both symbols for the unwind to work.

The landing pads added by 2734bbbcba reference _Unwind_Resume and
__gcc_personality_v0. In a static link, these pull UnwindLevel1.o
from libgcc_eh.a, which also defines _Unwind_ForcedUnwind, but
not UnwindLevel1-gcc-ext.o, which defines _Unwind_GetCFA. Unless
something else pulls that object in, as libcxxrt does for C++ programs,
thread_unwind_stop() calls a NULL _Unwind_GetCFA on every thread exit.

Reported and tested by:	dch
Fixes:	2734bbbcba ("libthr: Create landing pad in thr_once in C++ exception")
Sponsored by:	The FreeBSD Foundation
2026-11-07 01:21:08 +02:00
Dag-Erling Smørgrav feab010f44 libfetch: Use monotonic clock for timeouts
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61225
2026-11-06 12:16:42 +01:00
Simon J. Gerraty b22b999afc libsecureboot restore default trust anchors
If site.trust.mk does not set VE_SIGNATURE_LIST
initialize it based on content of VE_SIGNATURE_EXT_LIST
which is in turn initialized from TRUST_ANCHORS.

Sponsored by:	Hewlett Packard Enterprise Development LP

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61245
2026-11-05 16:27:00 -08:00
Faraz Vahedi 3ac9299ee9 libc: Export timespec_getres(3) and add tests
timespec_getres() has been declared in <time.h> and built into libc,
but never listed in a symbol map.  It is therefore local to libc.so,
and dynamically linked callers fail to link.

Reviewed by:	ziaee, fuz, des
Approved by:	fuz (mentor)
Fixes:		9b5d724cad ("libc: Add timespec_getres(3) as per C23.")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D60799
2026-11-05 23:39:01 +03:30
ShengYi Hung 2734bbbcba libthr: Create landing pad in thr_once in C++ exception
In _thr_once, if init_routine fails with exception, the stack allocate
__cup will become invalid when unwinder walk back and free the stack of
thr_once. This cause cleanup linked list be dangling. In here, we give
the cleanup function a landing pad so that we td can correctly point
to previous cleanup function.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D61212
2026-11-06 03:01:55 +11:00
ShengYi Hung 71937d8e11 libthr: Predict libthr is initialized in _thr_check_init
_thr_check_init() is called on hot paths such as pthread_once(), and
the uninitialized case can only happen once. Mark it with
__predict_false so the compiler lays out the initialized case as the
fall-through path.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D61213
2026-11-06 03:00:27 +11:00
ShengYi Hung 1e1ce1f6f9 libthr: Fix whitespace in thr_once.c
Remove trailing whitespace and replace space indentation with a tab.

No functional change.
2026-11-06 03:00:27 +11:00
ShengYi Hung 7806832f23 libthr: Cache recent pshared_key
For a pshare key, we can actually cache the last one as a fast path
instead of trapping into kernel directly. It makes sense as a lock and
unlock should be a pair on the same key and at the same time. For
example, lock(A) -> unlock(A) -> lock(B) -> unlock(B). Each unlock is
a hit and refresh later (50% hit).

For a single pshare lock, it is evne a 100% hit as the key never
changed.

For nested lock lock(A) -> lock(B) -> lock(C) -> unlock(C) ->
unlock(B) -> unlock(A). It only cache the last one. However, we should
really think about rewritting this logic as it is a pshare lock shared
by many processes and nested should be uncommon.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60957
2026-11-05 10:41:05 +11:00
Simon J. Gerraty 9ca2cfeb4e libsecureboot: add support for more signatures
For 2027 we need to support new, stronger signatures and hashes.

Re-work Makefile.inc and local.trust.mk to define
VE_SIGN_URL_LIST or VE_SIGNATURE_LIST (can be derrived from
VE_SIGN_URL_LIST) containing tuples of sig/method/hash/flags and
for VE_SIGN_URL_LIST the same plus /url.

From VE_SIGNATURE_LIST we derrive VE_SIGNATURE_EXT_LIST used to populate
signature_ext_list which defines the order in which we look for
signatures for a manifest.

We also populate signature_info_list which maps a signature ext to the
needed hash and flags to indicate whether that hash needs to be repeated.

verify_sig will lookup signature_info_list, no match means not
supported.  For asc we just call verify_asc() otherwise we call
verify_ec() or verify_rsa() depending on the key type found in the
certificate chain, we pass the signature_info entry to these so they
know which hash to use and whether to repeat it.

The need to repeat the hash is a consequence of sending a hash to a
server using signature methods that insiste on hashing their input.
To-date only our original ECDSA signatures use this.
A FakeHash class added in 2012 avoids that wrinkle.

This is a much more flexible arrangement and should be more
readily usable by others.

Sponsored by:	Hewlett Packard Enterprise Development LP.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61007
2026-11-04 15:07:09 -08:00
Pierre Pronchery 16eb1901dc pkgconf: vendor import of version 3.0.9
Merge commit 'fe9da42ef146a6f93ea15fcbcc14872d2e6788c3' into main

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D60852
2026-11-04 19:06:51 +01:00
Osvaldo Janeri Filho a01ea51561 libpmc: Map AMD Family 1Ah models 00h-0Fh to amdzen5
178d0b5b8d adapted the Zen 5 pattern matching from Linux perf.
However, Linux prints CPU models with a single digit when under 0xF
(allowing |[[:xdigit:]] to match 0h-Fh), whereas hwpmc/libpmc formats
model numbers with two leading hex digits (00h-0Fh).

Fix the pattern to explicitly cover two-digit hex models in the 00h-0Fh
range, and add a test case verifying table selection across Zen 5 and Zen 6
cpuid strings.

Reviewed by:	Ali Mashtizadeh <[email protected]>
Signed-off-by:	Osvaldo Janeri Filho <[email protected]>
Fixes:		178d0b5b8d ("libpmc: Import AMD Zen 6 PMU events.")
Sponsored by:	Advanced Micro Devices, Inc.
Differential Revision:	https://reviews.freebsd.org/D60625
2026-11-04 13:53:55 -04:00
Osvaldo Janeri Filho 869bb2bbb7 hwpmc: use the PerfMonV2 DF encoding on Family 19h
Family 19h processors with PerfMonV2 use the Family 1Ah DF encoding.
Selecting it by family alone drops the upper unit mask bits, and most
DF events count zero.

Reviewed by:	Ali Mashtizadeh <[email protected]>
Sponsored by:	AMD
MFC after:	1 week
Signed-off-by: Osvaldo Janeri Filho <[email protected]>
Differential Revision:	https://reviews.freebsd.org/D60769
2026-11-04 13:47:57 -04:00
Konstantin Belousov 82bbfe16ae cap_enter.2: document new behavior, in particular EBUSY
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60963
2026-11-04 18:23:11 +02:00
Konstantin Belousov aff8d265fa chroot.2: document EPERM for shared pwd
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60963
2026-11-04 18:23:11 +02:00
ShengYi Hung b138d017c7 libc/locale: Check EILSEQ return
_citrus_iconv_std_iconv_convert can return EILSEQ without setting
invlen. As a result, we should check EILSEQ in the return value or it
will incorrectly return -2

Reviewed by:    kevans
Fixes: e2030ca246 ("libc: fix c*rtomb/mbrtoc*")
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D61151
2026-11-04 15:09:36 +11:00
ShengYi Hung 6071292d39 libthr: Return EDEADLK if it is held by ourself
Reviewed by:    kib, markj
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60959
2026-11-03 17:51:49 +11:00
Philip Paeps a377d25bd2 libexpat: cath up with import of expat 2.10.0
Update expat_config.h and the libbsdxml(3) manpage to reflect the most
recent import.

MFC after:	3 days
MFC with:	765f30b9f3
2026-11-03 08:59:30 +08:00
Dag-Erling Smørgrav d667885130 libfetch: Apply timeout to SSL handshake
When the SSL handshake cannot proceed because the server is slow to
respond, poll() with a timeout instead of spinning.

MFC after:	1 week
PR:		298962
Event:		Oslo Hackathon 2026
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D60975
2026-11-02 13:28:39 +01:00
Dag-Erling Smørgrav 581d5098ec libfetch: Use C locale for dates
MFC after:	1 week
PR:		299084
Reviewed by:	arrowd, kevans
Differential Revision:	https://reviews.freebsd.org/D60901
2026-11-02 13:28:39 +01:00
ShengYi Hung 1a38209136 libusb: Add SSP and SSPx2 enum support
Report the new kernel speeds as LIBUSB20_SPEED_SUPER_PLUS.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57195
2026-11-02 14:02:10 +11:00
Martin Matuska 322d422752 libarchive: merge from vendor branch
libarchive 3.8.11

ChangeLog:
https://github.com/libarchive/libarchive/compare/v3.8.10...v3.8.11

Obtained from:	libarchive
Vendor commit:	03036ffa409a2aa1c5bbad35be2202641a040fda
MFC after:	3 days
2026-11-01 00:39:49 +01:00
Enji Cooper 0e58fb271c atf, lutok, kyua: compile with CXXSTD=gnu++20
All three of the test infrastructure components require at least C++20
in order to build. Make that version the default to better match what
is required in recent versions of the projects.

MFC after:	1 week
2026-10-31 13:14:48 -07:00
Steve Kargl 1fb5d8265b msun: fix behaviour of nextafter*() and nexttoward*() for MAX value
For an edge case at an extreme, e.g., nextafter(-DBL_MAX,-INFINITY)
do not return x+x.  Instead, evaluate x+x and assign it to a volatile
to raise an exception, and then fall through to return the correct
result in current rounding mode.

PR:		299389
MFC after:	6 days (for inclusion into releng/15.2)
2026-10-31 10:19:54 +00:00
Avinash Duduskar 727e413ff3 libpfctl: add pfctl_open_from_nl_fd() and pfctl_nl_fd()
pfctl_open_from_nl_fd() opens the pf device as pfctl_open() does but,
when given a descriptor, adopts it as the Netlink socket instead of
creating one. The handle's sequence numbers start at a random value:
replies are matched by sequence number, so a random start makes it
improbable that a reply an earlier owner of the socket left unread is
taken for the answer to one of ours, or one of ours for theirs, however
many times the socket has been handed on. pfctl_open() becomes a
wrapper that passes -1.

pfctl_nl_fd() returns the handle's Netlink descriptor, as pfctl_fd()
does for the device, so a caller can hand it to a child process.

PR:		291981
Signed-off-by:	Avinash Duduskar <[email protected]>
Reviewed by:	kp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2508
2026-10-30 15:06:58 +01:00
Konstantin Belousov 9bd3091596 libthr: test pthread_query_np(3) and pthread_query_all_np(3)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60838
2026-10-30 15:51:03 +02:00
Konstantin Belousov 588bd8bb6c libthr: pthread_query_np(3) and pthread_query_all_np(3)
Reviewed by:	aokblast, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60838
2026-10-30 15:51:03 +02:00
Konstantin Belousov 49e0c6270c libthr: fix the race between pthread_getname_np() and thread exit
The exiting thread frees the thread name in exit_thread() without
holding the thread lock.  This makes it possible for a thread doing
pthread_getname_np() to observe the non-null thread->name and try to
copy its content, accessing the memory after free.

Set the thread->name to NULL under the thread lock.  Note that other
thread might still set the exiting thread name, until the PS_DEAD state
is assigned.  Since code should not call free() after
_malloc_thread_cleanup(), re-check thread->name in _thr_free().

Reviewed by:	aokblast, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60838
2026-10-30 15:51:02 +02:00
Konstantin Belousov 7f309ac039 libc: provide the declaration for __libsys_errno in libc_private.h
Reviewed by:	aokblast, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60838
2026-10-30 15:51:02 +02:00
Kristof Provost a7aad5bbcd pf: convert DIOCXBEGIN, DIOCXROLLBACK, DIOCXCOMMIT to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-10-30 13:21:10 +01:00
David E. O'Brien 5b41e3df0b gethostbyaddr_r: follow style from other *_r variants 2026-10-29 23:40:52 -07:00
David E. O'Brien 1d450a4258 gethostbyaddr_r: correct typo in signature from dc68997328
'man 3 gethostbyaddr_r' was incorrectly showing 9 arguments.
2026-10-29 23:35:36 -07:00
Enji Cooper eecc84de35 GoogleTest: run several tests as plain C++ tests
Some of the tests provided by GoogleTest don't play well with the kyua
GoogleTest engine available in 0.15.0, in part because they test
edgecases that the kyua GoogleTest engine does not expect or handle
gracefully.

Treat the tests as plain C++ tests to keep parity (result-wise) before
switching the testcase type from `plain` (what it is today under the
covers) to `googletest`.

MFC after:	1 month
MFC with:	3fb03fb35b ("[tests] switch GoogleTest tests to ...")
2026-10-29 16:32:31 -07:00
ShengYi Hung 6a65632e1a libthr: Add missing include header
Fixes:          56a490f9c5 ("libthr: Robust tryjoin test")
MFC after:      2 weeks
2026-10-30 06:17:00 +11:00
Enji Cooper 36c4912749 atf: refer to common.mk using SRCTOP
This helps make the dependent Makefile (and the values contained within)
easier to catch when upgrading atf in the future.

MFC after:	1 week
2026-10-29 10:59:03 -07:00
ShengYi Hung 56a490f9c5 libthr: Robust tryjoin test
We cannot actually rely on a status (finish) before thr_exit. The
thread needs the kernel signal status=1 to userspace. Before that,
any tryjoin fails. The previous one works as we sleep 1 and should be
enough for normal case.

Reviewed by:    kib, markj
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60832
2026-10-30 04:44:15 +11:00
ShengYi Hung 8e3a6d7f5a libthr: Deduplicate some rwlock code
1. abstime calculation
2. rdlock flags judgement

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60958
2026-10-30 04:44:15 +11:00
Juraj Lutter 3479ee8e00 memset.3: Fix .Fn usage and too many commas
Fix wrong usage of .Fn macro in paragraph for `memset_explicit' that
caused too many commas improperly emitted into rendered manual page.

Approved by:	des
MFC after:	1 week
2026-10-29 14:53:34 +01:00
Faraz Vahedi 13bcc9a882 libc: Fix stack buffer overflow in cgetnext()
`cgetnext()` copies a capability record's name field into a fixed
1024 byte on-stack buffer (`nbuf[BSIZE]`) one character at a time,
but never checks that the write pointer stays within the buffer.
Therefore, a record name that is longer than `BSIZE` (either on a
single line, or accumulated across several `\`-continued lines as
the pointer is not reset amidst continuation) writes past the end
of `nbuf` and smashes the stack.

The name field is read directly from the capability file, so any
consumer of `cgetnext()`/`cgetfirst()` that processes an untrusted
`termcap(5)`- or `printcap(5)`-style database (e.g. `cap_mkdb(1)`,
`lpr(1)`, or any third-party caller) can be exposed and hence made
to corrupt the stack.

Reviewed by:	fuz, dteske
Approved by:	fuz (mentor), dteske (mentor)
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2309
2026-10-29 15:39:45 +03:30
Martin Matuska d48b93e5e9 libarchive: update config_freebsd.h
Fixes: use of external filter programs, tests
MFC after: together with 61c70dc16
2026-10-29 10:22:24 +01:00
Konstantin Belousov 4ab9e73994 libthr/thr_mutex.c: make mutex asserts more useful
Print the file and line number of the caller where the assert fired.
Use _thread_exitf() directly for this.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-28 02:56:06 +02:00
Martin Matuska 61c70dc16a libarchive: merge from vendor branch
libarchive 3.8.10

ChangeLog:
https://github.com/libarchive/libarchive/compare/v3.8.9...v3.8.10

Obtained from:	libarchive
Vendor commit:	0c48412be2d94afe1859a807ea7896a18d8900bd
MFC after:	3 days
2026-10-26 22:47:32 +01:00
Ed Maste 7ea9ac99e1 libc: Add a man page caveat about the w modifier
In-tree Clang is unaware of the N2680 fixed-width modifier `w` and emits
a warning when used.

PR:		299631
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D60939
2026-10-26 09:46:02 -04:00
Wolfram Schneider f5b6c8f5c2 manpages: Fix unusual Xr order 2026-10-26 10:35:42 +00:00
Wolfram Schneider 3208a17f96 manpages: Fix unusual Xr order 2026-10-26 10:32:42 +00:00
Wolfram Schneider afe20e82f9 manpages: Fix unusual Xr order 2026-10-26 10:29:10 +00:00
Wolfram Schneider 4560b19ff4 manpages: Fix unusual Xr order 2026-10-26 10:27:43 +00:00
Konstantin Belousov cf63e3f3cd pdfork.2: improve markup
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-10-23 21:17:45 +03:00
Dag-Erling Smørgrav c6d7a2478c unbound: Update to 1.26.2
Release notes at
    https://community.nlnetlabs.nl/t/unbound-1-26-2-released

Merge commit 'ce3304d97ba4861eabac759e538426a568aef0a5'

Security:	CVE-2026-35501
Security:	CVE-2026-50106
Security:	CVE-2026-96405
Security:	CVE-2026-97206
Security:	CVE-2026-109125
2026-10-21 13:24:44 +00:00
Osvaldo Janeri Filho 06abe08de4 pam_exec: fix the stderr close test and avoid a double close
The cleanup tested cherr[0] when closing cherr[1].  The parent also closed
chin[0]/chout[1]/cherr[1] after pdfork() without clearing them, so the out:
cleanup path closed them again.  Clear each fd after closing and test the right
one.

Reviewed by:	des, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D60924
2026-10-20 22:05:31 +00:00
R. Christian McDonald a317317519 pf: Keep every chunk of a table that a ruleset defines
libpfctl sends a table definition in chunks of 256 addresses, each as
its own PFNL_CMD_INA_DEFINE.  The kernel treated every chunk as a new
definition and replaced the shadow table, so only the last chunk
survived.

Mark the chunks after the first with PF_ID_APPEND and have the kernel
add them to the shadow table in progress.  A request without the
attribute still replaces the shadow; one with it and no definition in
progress fails with EINVAL.  Old kernels ignore the attribute, so both
halves are needed; the ioctl sends all addresses at once and is not
affected.  Mask the flags userland passes to PFR_FLAG_ALLMASK, as
PFR_FLAG_APPEND is kernel-internal.

Add a test that defines a table of 1,000 addresses, also in an anchor.

Reviewed by:		kp
Fixes:			219ce30638 ("pf: convert DIOCRINADEFINE to netlink")
Sponsored by:		Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D60876
2026-10-20 08:52:00 -04:00