netipsec: Release the SA and SP when mb_unmapped_to_ext() fails
ipsec4_perform_request() maps unmapped (M_EXTPG) mbufs before the
software transforms run. mb_unmapped_to_ext() frees the chain when it
fails, and the error return then kept both the SA reference taken by
ipsec4_allocsa() and the SP reference that this function must release.
The SA, its crypto session and the SP were never freed after they were
deleted.
The conversion fails with ENOMEM when an mbuf allocation fails, for
example for sendfile(2) data sent through a software IPv4 SA, and with
EINVAL for every packet of a NIC kTLS connection that matches an IPsec
policy. Take the common error path instead; it skips m_freem() when
the mbuf pointer is NULL.
IPv6 is not affected: ipsec6_perform_request() does not call
mb_unmapped_to_ext().
Reported by: llm-postcr
[3 lines not shown]
[LoopFusion] Fold single-input exit PHIs before sinking instructions (#241955)
When LoopFuse sinks an instruction into the fused loop's exit block, a
single-input PHI in that exit block that forwards the instruction was
left in place. After the move, that PHI used a value that no longer
satisfied the IR requirements for its position, producing invalid IR.
Fix this by folding such PHIs before the move: replace each PHI's uses
with the sunk instruction and erase the PHI. The assertion documents the
expected shape (one incoming value, equal to the instruction), so any
other use of the exit PHI is left untouched.
Add preheader_exit_phi.ll as a regression test covering the forwarded
PHI case.
NAS-144162 / 27.1.0 / Harden NTP (by anodos325) (#20211)
Basically, this commit is adding support for a newer secure way of
updating time. It's a preliminary
step for some WORM-related work in S3 land where we want to basically
ensure that buckets fall
back to being RO if time de-synced or not from secure source.
- Add `nts` to system.ntpserver, rendered as chrony's `nts` option
- Without `force`, probe NTS-KE (TLS 1.3, ALPN ntske/1) and the
negotiated NTP server on save
- Cap `maxpoll` at 21 for NTS servers
- Render `authselectmode prefer` in chrony.conf
- Add system.security `require_nts` (default off), rendered as
`authselectmode require`
- With `require_nts`: refuse enabling without an NTS server, saving
servers without NTS and deleting the last NTS server
- Restart chronyd on both controllers when `require_nts` changes
- Migration: add `ntp_nts` and `require_nts`
[20 lines not shown]
[LV] Add tests for hoisted RT checks in loop nests (NFC). (#242900)
Add tests where the bounds of runtime checks are expanded to cover the
outer loop, but may not cover the accessed range, and where diff checks
are skipped although the bounds cannot be expanded.
Also mark GEPs as inbounds and @udiv_known_nonzero as mustprogress in
existing tests, so they keep testing hoisting.
Includes tests for https://github.com/llvm/llvm-project/issues/242368.
[OpenMP] Allow dispatch when the call is replaced by a declare variant (#242482)
A `dispatch` inside `parallel` was rejected when the base function also
has a `construct={parallel}` variant. See
https://godbolt.org/z/v9Gadhfsb.
This patch:
- adds `dispatch` to the construct context
- looks through the `PseudoObjectExpr` to the original call when
checking the dispatch statement.
These two Sema changes were first made by @SunilKuravinakop in #131838,
as part of the larger dispatch Sema and codegen work there. That PR has
been inactive for a while, so this PR takes only the Sema fix for the
rejected dispatch and
adds a test for it.
tftpd: Keep proper track of option length
When parsing options, keep track of the length of the unparsed portion
and pass that to get_field() instead of the length of the entire header.
While here, switch both make_options() and parse_options() to using
size_t for sizes and lengths.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61048
(cherry picked from commit 35cd70490f4b7ec1921db980ae3992192e4cbfbb)
su, login: fix heap over-read in environment export filter
ok_to_export() (su.c) and export() (login.c) read s[n] before
strncmp(s, *pp, n) confirms s is at least n bytes long, where n is
the length of the blocked variable name. A PAM environment entry
shorter than that name over-reads past its heap allocation.
Check strncmp() first; it stops at s's NUL terminator and never
reads past the boundary that guarded the s[n] access.
MFC after: 1 week
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Reviewed by: des, markj
Differential Revision: https://reviews.freebsd.org/D61420
(cherry picked from commit e1b5e1f9ddac43ed669a44cfdbba1b394d144c6b)
tftpd: Keep proper track of header length
When parsing a header, keep track of the length of the unparsed portion
and pass that to get_field() instead of the length of the entire header.
Reported by: n0ps1ed
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60902
(cherry picked from commit 579e428a551a11b43e341297dd0ef9d38c4fcda7)
tftpd: Fix off-by-one in get_field()
Due to a logic error, get_field() would behave as if the passed-in size
was one greater than it actually is. Fix it so it always fails if no
terminating NUL is found within the buffer, instead of succeeding if the
first byte past the end is a NUL.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61032
(cherry picked from commit 14541ca2bf3766e659a22c5ea9ed3dc2d5f11fa5)
tftpd: Keep proper track of header length
When parsing a header, keep track of the length of the unparsed portion
and pass that to get_field() instead of the length of the entire header.
Reported by: n0ps1ed
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60902
(cherry picked from commit 579e428a551a11b43e341297dd0ef9d38c4fcda7)
tftpd: Fix off-by-one in get_field()
Due to a logic error, get_field() would behave as if the passed-in size
was one greater than it actually is. Fix it so it always fails if no
terminating NUL is found within the buffer, instead of succeeding if the
first byte past the end is a NUL.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61032
(cherry picked from commit 14541ca2bf3766e659a22c5ea9ed3dc2d5f11fa5)
su, login: fix heap over-read in environment export filter
ok_to_export() (su.c) and export() (login.c) read s[n] before
strncmp(s, *pp, n) confirms s is at least n bytes long, where n is
the length of the blocked variable name. A PAM environment entry
shorter than that name over-reads past its heap allocation.
Check strncmp() first; it stops at s's NUL terminator and never
reads past the boundary that guarded the s[n] access.
MFC after: 1 week
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Reviewed by: des, markj
Differential Revision: https://reviews.freebsd.org/D61420
(cherry picked from commit e1b5e1f9ddac43ed669a44cfdbba1b394d144c6b)
tftpd: Keep proper track of option length
When parsing options, keep track of the length of the unparsed portion
and pass that to get_field() instead of the length of the entire header.
While here, switch both make_options() and parse_options() to using
size_t for sizes and lengths.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61048
(cherry picked from commit 35cd70490f4b7ec1921db980ae3992192e4cbfbb)
[GlobalISel] Address review comments on demanded bits through TRUNC/XOR/SELECT
- simplifyMultipleUseDemandedBits: take operand known bits straight from
value tracking instead of special-casing constants. That only mattered
for a constant reached at the value-tracking depth limit, so drop the
test that covered it; constant AND/OR masks are still looked through
before this point.
- trunc (lshr X, C) -> lshr (trunc X), C: build the narrow shift with the
target's preferred amount type for the narrow type, as the trunc_shift
combine does, and fall back to the original amount type when only that
forms a legal shift (legalized AArch64 i32 shifts take i64 amounts).
The vector unit test now checks the narrowed amount type.
- AArch64: only fold a G_UBFX into TB(N)Z when lsb + bit is a bit of the
source register.
- Mark the new rule-filtered MIR tests REQUIRES: asserts, since
-*-only-enable-rule needs an assertions build, and drop
-verify-machineinstrs from them.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
misc/warp: Update to recent GitHub commit
The upstream has stopped tagging the repository on release since June
2026. This commit updates the port to a commit near the latest
upstream release.
pax: Use copy_file_range
Use copy_file_range(2) instead of our own inefficient and unreliable
attempt at detecting holes. If copy_file_range(2) is not available,
which in theory should be never, we fall back to a simple read(2) /
write(2) loop which makes no attempt to copy holes. This should
speed up pax copy mode and cpio passthrough mode significantly.
This includes refactoring much of the existing I/O code to use the
size_t and ssize_t instead of int where appropriate.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: obiwac
Differential Revision: https://reviews.freebsd.org/D58470
pax: Add tests
Add tests exercising pax copy mode, cpio passthrough mode, the ability
to extract pax, cpio, and tar archives, and the ability to parse pax,
cpio, and tar command lines.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: obiwac
Differential Revision: https://reviews.freebsd.org/D58469
[mlir][arith] Don't apply SelectCommonElementwiseOp to nested selects (#243050)
`arith.select` is itself pure and elementwise, so the pattern added in
#234818 also matched selects of selects:
select(c, select(d, a, b), select(d, x, y)) -> select(d, select(c, a,
x), select(c, b, y))
The result matches again with `c` and `d` swapped, so the greedy
rewriter never converges, causing canonicalization to hang or run out of
memory on code with nested selects (e.g. math function expansions).
Bail out when the select operands are themselves `arith.select` ops.
[X86] Prefer MOVD/MOVSS over EXTRACTPS $0 for element 0 of v4f32 (#229730)
Extracting element 0 of a `v4f32` into a GPR currently selects
`VEXTRACTPS $0` instead of the shorter and cheaper `VMOVD`.
This is because the pattern `(extractelt (bc_v4i32 (v4f32 VR128:$src1)),
imm:$src2)` accepts any index, including 0. And since it has a higher
complexity than the `(extractelt (v4i32 VR128), 0)` pattern that we want
it gets selected.
So this adds a peephole to X86FixupInstTuning that rewrites EXTRACTPS
with index 0 this turns:
`EXTRACTPS` into `MOVPDI2D`
`VEXTRACTPS` into `VMOVPDI2D`
`VEXTRACTPSZ` into `VMOVPDI2DIZ`
Used AI for checking and test case generation.