tests/sys/kern/ssl_sendfile: :eagain_vs_eof: improve failure messaging
Convert many raw `ATF_REQUIRE(..)` macro calls to `ATF_REQUIRE_MSG(..)`
and output the sbytes attached to the context in provide meaningful
information with failure messages.
While here, fix a typo in a comment and some indentation in another
testcase (:random).
PR: 299447
MFC after: 1 week
CodeGen: Use RuntimeLibcallsInfo for memset_pattern16 (#241384)
CodeGen passes shouldn't be using TargetLibraryInfo for functions they will
emit. Use RuntimeLibcallsInfo which knows how to insert the correctly typed
and annotated declaration. This is a slight behavior change since
RuntimeLibcallsInfo respects the triple's libcall availability, but doesn't respect
TargetLibraryInfo "no-builtins" attributes. This is consistent with how regular
memset is treated.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
ZTS: zvol_stress: no fio verify_async on FreeBSD
On FreeBSD 16.0-CURRENT since main-n290812 (CI image 20261109),
zvol_stress fails every run: each fio dies with "got signal=11",
"err= 4" and "file hash not empty on exit" once its verify pass is
done. It isn't ZFS: the same fio command line crashes on a plain
file on UFS.
fio starts its verify_async threads with a 2 * PTHREAD_STACK_MIN
stack, which is 4 KiB on FreeBSD amd64. freebsd-src 2734bbbcba3c
("libthr: Create landing pad in thr_once in C++ exception") made
libthr.so link libgcc_s, so the first pthread_exit() in a process
now finds _Unwind_ForcedUnwind and dlopen()s libgcc_s in
thread_uw_init(). On a verify thread that overflows the one-page
stack into its guard page:
#0 object_match_name (name="/lib/libgcc_s.so.1") rtld.c:6056
#1 load_object rtld.c:2928
#2 dlopen_object rtld.c:4044
[15 lines not shown]
TCP RACK: fix RSM computation for TCP fast open
When spitting an RSM containing the SYN and data, honor the
sequence number used by the SYN flag when computing the offset
in the socket buffer.
Approved by: re (cperciva)
PR: 297006
Reviewed by: rrs, Peter Lei
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61149
(cherry picked from commit ff066579fd7719a6361e7ce8cc9ade47517d242d)
(cherry picked from commit d40890ffbd8bcacfc4e24c37daad931db8f31804)
vmm: Skip TMR rebuilds for edge-to-edge IOAPIC writes
IOAPIC redirection-table writes rendezvous all active vCPUs to
rebuild their vlapic trigger-mode registers when fields other than
mask or polarity change. Retargeting an edge-triggered pin incurs
this cost even though it does not contribute to the TMR.
vioapic_update_tmr() rebuilds the TMR from level-triggered entries
only. Skip the rendezvous when the modified entry is edge-triggered
both before and after the write. Check the old and new trigger modes
so that edge-to-level and level-to-edge transitions still rebuild
the TMR. Retain the existing all-vCPU rebuild path, mask/polarity
exclusions and remote-IRR handling.
Approved by: re (cperciva)
Approved by: markj, cperciva
Differential Revision: https://reviews.freebsd.org/D60721
MFC to: releng/15.2
Reported by: Wanpeng Qian <wanpengqian at gmail.com>
[4 lines not shown]
vmm: Add a bulk TMR reset hook for Intel APICv
vioapic_update_tmr() resets all 256 vectors before rebuilding the
level-triggered vector set. With Intel virtual interrupt delivery,
each per-vector reset loads the VMCS, reads and writes an EOI-exit
bitmap, and clears the VMCS.
Add an optional bulk-reset hook so VMX can clear the four EOI-exit
bitmaps with one VMCS load/clear pair. Clear the software TMR banks
directly when using the hook, and retain the per-vector fallback
for backends without it.
Approved by: re (cperciva)
Approved by: markj, cperciva
Differential Revision: https://reviews.freebsd.org/D60692
MFC to: releng/15.2
Reviewed by: markj
(cherry picked from commit ee9205f068c7675cf4d23e51cc98238d95ba1950)
(cherry picked from commit 88d7efb9e4fa03c8d364f9aeb88b10075e1bf69c)
linux: Bound native getdents and getdents64 batches
linux_getdents() and linux_getdents64() round their native read size up
to DEV_BSIZE before converting entries. For an unaligned caller buffer,
the native batch can contain more entries than fit in the Linux buffer.
Conversion then returns EINVAL even after copying complete entries,
and the native read has already advanced the directory position.
For counts of at least DEV_BSIZE, use min(args->count, MAXBSIZE) instead.
A 768-byte request, such as rustix's initial directory read, now uses a
768-byte native buffer rather than 1024. The converted Linux dirent and
dirent64 records are no larger than their native counterparts, so the
whole translated batch fits. Returning a short batch is allowed, and
consuming the whole native batch avoids needing to rewind the directory
position.
Keep the existing sizing for counts below DEV_BSIZE. This fixes the
oversized-batch case in both getdents interfaces, including legacy
getdents for 32-bit and 64-bit callers. The remaining small-buffer,
[10 lines not shown]
bsdinstall: Set TMPDIR in pkgbase install
The FreeBSD-base repository (aka "pkgbase") is now created using 'pkg
repo -l' in order to make 'pkg rwhich' work. Unfortunately this makes
the data.pkg file considerably larger, and FreeBSD 15.2-BETA1 fails to
install using a remote repository since the installer has a small /tmp
(20 MB).
Run pkg commands with 'env TMPDIR=<chrootdir>/tmp' since the /tmp in
the system being installed is considerably larger than the tmpfs which
the installer runs with. Create <chrootdir>/tmp first so we can ensure
it has 1777 permissions.
Approved by: re (cperciva)
Reviewed by: bapt
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D61380
(cherry picked from commit a7163bd76986282fdcb059b91301d3214da49642)
(cherry picked from commit f3555a0e240ae2b26fdf0db2e3f68ec6846bbb58)
i2ctinyusb: do not list i2ctinyusb.c twice in SRCS
The module Makefile named its only source file in both the SRCS= line
and the SRCS+= line that follows. bsd.kmod.mk tolerates the duplicate
in a normal build, but when the kernel is built with -flto=thin the
linker sees the same bitcode object twice and refuses to link the
module ("Expected at most one ThinLTO module per bitcode file").
Approved by: re (cperciva)
Fixes: 54e231b373ef
(cherry picked from commit b5cd411af6418986fa0da9c12d02b9f26c344a4a)
(cherry picked from commit cfd1aabac12fc239d1c9b8433b29c68a25a7e5b6)
mqueuefs: set *a_eofflag in VOP_READDIR
mqfs_readdir() never reported end of directory. Since 77b273d8f5f4
VOP_READDIR_APV() asserts that a readdir which returns no entries also
sets *a_eofflag, so with INVARIANTS the final zero-length
getdirentries(2) that ls(1) issues on a mounted mqueuefs panics:
panic: VOP_READDIR: eofflag not set
Report end of directory when the child list was walked to its end;
leave the flag clear when the walk stopped because the buffer was full.
Approved by: re (cperciva)
(cherry picked from commit fbac0abdc5ab1fe867ac85635662ef06b2ee9d10)
(cherry picked from commit 6df22096ddb27edb169cfb6758d1dab130f9f683)
[test][Clang][CFI] Precommit tests for cfi-vcall checked loads (#241638)
Record current `cfi-vcall` codegen before emitting
`llvm.type.checked.load` for non-trapping modes. Cover cross-DSO CFI,
VFE, relative vtables, speculative devirtualization, MS ABI secondary
vfptrs, virtual object deletion, ignorelists, debug info, sanitizer
stats, and `EmitVTablePtrCheck` in trap and minimal-runtime modes.
Add compiler-rt tests for two false traps, marked XFAIL:
- deleting a base object through a same-layout derived pointer with
`-fwhole-program-vtables`;
- `-fdevirtualize-speculatively` with a public class whose vtable comes
from a non-LTO object.
Needed by #241639, #241640, #241643, #241644, #241646, and #241647.
Assisted-by: Gemini
[compiler-rt][RISCV] Terminate the save/restore #error strings (NFC) (#241799)
The `#error` directives in riscv/save.S and riscv/restore.S were missing
their closing quote. The assembler preprocessor tolerates that, but a C
preprocessor warns about the unterminated string literal even when the
directive is in a group that is skipped, for instance when the files are
included in C translation units.
Assisted-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Mintsuki <mintsuki at protonmail.com>
Signed-off-by: Mintsuki <mintsuki at protonmail.com>
[NFC][LowerTypeTests] Make export summary tests self-contained without split-file (#221090)
Follow-up to https://github.com/llvm/llvm-project/pull/220776.
LLVM assembly parsing natively supports co-locating module IR and
ThinLTO
module summary entries in a single `.ll` file (LLParser skips summary
records when parsing module IR, and skips module IR when parsing summary
assembly via parseSummaryIndexAssembly).
Migrate all 13 LowerTypeTests tests that used split-file and temporary
summary files to directly reference %s with
-lowertypetests-read-summary=%s.
This eliminates unnecessary temporary directory creation, split-file
overhead, and disk I/O, keeping each test completely self-contained.
Also convert promoted-internal.ll from a split-file YAML import summary
to
a `cfiFunctionDefs` summary entry in the same file.
Assisted-by: Gemini
[SPIRV] Backend service functions must handle callees with aligned returns (#240910)
We use service functions to pipe undefined but declared (potentially
indirect) callees through IRTranslator. The generated service function
is not translated, but rather emitted as a trap. This is mostly fine
except for cases where the callee provides alignment guarantees on the
return value. In this latter situation, IRTranslator defaults to
inserting an assertion on the alignment value, but we never
allocate/create the vreg it asserts on, which leads to broken MIR. The
workaround here is to signal that we "lowered" a tail call (which is not
a lie), case in which the assertion is not inserted. For a more robust
future solution, we could opt for properly lowering the service function
to MIR, and dealing with it afterwards.
---------
Co-authored-by: Dmitry Sidorov <dsidorov at amd.com>
[libc][signal] fix the ordering issue of abort guard (#242025)
Current abort guard's locking lifetime encloses blocking lifetime.
Hence,
inside locking-blocking gap, reentrant signal handler can deadlock. As
demonstrated in the following cases:
With a handler that calls `sigaction(SIGABRT, ...)` interrupting `fork`:
```
thread (in fork) signal handler on the same thread
---------------- ---------------------------------
SigAbortGuard(exclusive=false)
abort_lock.read_lock()
<------- signal delivered ------->
sigaction(SIGABRT, ...)
SigAbortGuard(exclusive=true)
abort_lock.write_lock()
waits for the reader, which is
[29 lines not shown]
IR: Add getOrInsertFunction with a constructor callback
This fixes an annoying asymmetry in the Module APIs. We already have
getOrInsertGlobal with a constructor callback, but did not have the
same for Functions. This allows inserting a declaration with a single
symbol table probe.
Inserting a missing function did a getNamedValue lookup, then a second
hash table probe when Function::Create added the name. Add
ValueSymbolTable::lookupOrInsert to do both with one try_emplace to
implement this. Intrinsic and unnamed functions keep the old path since
intrinsics are set up from their name on construction. A microbenchmark
inserting all of the runtime libcalls shows this is about 28% faster in
the miss / insertion case.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>