[BOLT] Gadget scanner: prevent false positives due to jump tables
As part of PAuth hardening, AArch64 LLVM backend can use a special
BR_JumpTable pseudo (enabled by -faarch64-jump-table-hardening
Clang option) which is expanded in the AsmPrinter into a contiguous
sequence without unsafe instructions in the middle.
This commit adds another target-specific callback to MCPlusBuilder
to make it possible to inhibit false positives for known-safe jump
table dispatch sequences. Without special handling, the branch
instruction is likely to be reported as a non-protected call (as its
destination is not produced by an auth instruction, PC-relative address
materialization, etc.) and possibly as a tail call being performed with
unsafe link register (as the detection whether the branch instruction
is a tail call is an heuristic).
For now, only the specific instruction sequence used by the AArch64
LLVM backend is matched.
netipsec: Select outbound transmit queues by SA instead of inner flow
Outbound IPsec packets retain the flow ID of the inner traffic. Multi-queue
interfaces use this ID to select a transmit queue (iflib's QIDX()) or a member
port (lagg(4) with use_flowid). Consequently, packets belonging to the same
security association (SA) can be distributed across independently draining
queues.
ESP and AH sequence numbers are assigned before encryption, but the packets
can be transmitted out of order when different queues drain at different
rates. This can cause legitimate packets to fall outside the receiver's
anti-replay window and be dropped as possible replays. RFC 4303, Section
3.4.3, makes 32 packets the smallest window a receiver must support, and
strongSwan installs that minimum by default.
Assign each SA a flow ID derived from a Jenkins hash of its SPI, computed once
when the SA is created, from the SPI in host byte order so that the value is
the same on every architecture. Set this ID on outbound packets in
ipsec{4,6}_perform_request(), with M_HASHTYPE_OPAQUE_HASH, once the SA is
[32 lines not shown]
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`
[12 lines not shown]
[TableGen] Fix depfile escaping test on MinGW (#242919)
The test assumed that native Windows paths use backslashes.
LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON, the default for MinGW builds,
converts separators to forward slashes before escaping, causing the
depfile check to fail.
Run the test with both separator preferences explicitly selected. Check
forward-slash output on Windows while retaining literal backslash checks
on other platforms, independently of the configured default.
Addresses
https://github.com/llvm/llvm-project/pull/160834#issuecomment-6902350571
[AArch64] Restore STI after emitting a PAuth IRELATIVE resolver (#242420)
The resolver can be emitted while emitting a function, whose
instructions then used the subtarget freed at the end of
emitPAuthRelocationAsIRelative. Found by -Wlifetime-safety.
Assisted-by: Claude Opus 5.5
Co-authored-by: Gabor Horvath <gaborh at apple.com>
release/23.x: [LV] Have ExtractValue match the shape of the operand. (#229927)
Previously, BuildStructVector would create a vector of a wide struct
type, where each element is widened.
This can cause issues, if a transform turns an extractvalue of a wide
call into a single-scalar (e.g. makeScalarizationDecisions), because we
currently cannot extract lane 0 from a struct of vectors.
Instead of relying on BuildStructVector, we can instead have the
ExtractValue match the shape of its operand (either widen if the operand
is wide, or replicated if the operand is scalar). If a vector value is
needed, we can directly use the existing BuildVector.
This fixes a number of crashes in the newly added tests, including
https://github.com/llvm/llvm-project/issues/229609.
Depends on https://github.com/llvm/llvm-project/pull/229925
PR: https://github.com/llvm/llvm-project/pull/229927
[X86][APX] Fix commuting SHLD/SHRD NF, NF_ND and EVEX variants (#233873)
All SHLD/SHRD rri8 variants are marked commutable, but
commuteInstructionImpl only rewrote the legacy and _ND opcodes as SHLD
B, C, I <-> SHRD C, B, (BitWidth - I). The _NF, _NF_ND and _EVEX
variants fell through to the generic commute, which only swaps the
sources and changes the result.
This is reachable when optimizeCompareInstr converts an EFLAGS clobber
to its NF form (e.g. SHLD16rri8_ND -> SHLD16rri8_NF_ND) and RA assigns
the destination to the second source: X86CompressEVEX commutes it to
drop the redundant NDD destination and emits the wrong shift. The
TwoAddressInstruction pass can hit the same bug when commuting the
non-NDD _NF and _EVEX forms.
Assisted-By: Claude Opus 5.5 <noreply at anthropic.com>
[ELF] includeInSymtab: Fix crash for SHF_MERGE section symbol with out-of-range addend (#240732)
includeInSymtab passes a section symbol's st_value, which is not
range-checked, to getSectionPiece. A value at or past the end of the
SHF_MERGE section causes an assertion failure or crash.
A local section symbol is not copied to .symtab, and a non-local one
gets the "offset is outside the section" error from getSymVA.
Fix #235203
(cherry picked from commit 4423d417a23c193b234c2a8c6fa566e2d60c0ab9)
[libc++] Use section-based overridden function detection on Mach-O (#240482)
PR #208330 switched the non-ptrauth implementation of
__is_function_overridden to a mechanism that defines a local alias at
the same address as the weak function f.
Recent Mach-O linkers (e.g. the one in Xcode 27.0) bind references to a
weak definition directly when that definition has a local alias at the
same address, instead of going through a weak-def-coalesced stub or GOT
entry. Older linkers like the ones in Xcode 26.6 (which we use in the
CI) don't do that, which is why this wasn't caught by the CI. This means
that we always resolved `__is_function_overridden` to false with newer
linkers, which breaks the detection mechanism.
Assisted by Claude
(cherry picked from commit de513b8f794ed75611475fea0f4ff2746a7c663f)
tcp: address PR295870
Fix accounting in the sequence space for a FIN bit potentially
piggy bagged during SACK loss recovery triggered transmissions.
Reviewed By: #transport, tuexen
Sponsored by: NetApp, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61312
(cherry picked from commit 0aa6428f463699c5f5e03715ea4ebe2309a23a2d)
tcp: address PR295870
Fix accounting in the sequence space for a FIN bit potentially
piggy bagged during SACK loss recovery triggered transmissions.
Reviewed By: #transport, tuexen
Sponsored by: NetApp, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61312
(cherry picked from commit 0aa6428f463699c5f5e03715ea4ebe2309a23a2d)
[mlir][affine] Fix sibling fusion with multiple loads (#226759)
Sibling fusion missed nests that load the shared memref more than once,
e.g. two loops that both read `A[i]` and `A[i + 1]`. Such siblings were
filtered out, and even when one of the nests had a single load, the
slice was computed as the union over all load pairs. That union spans
several source iterations per destination iteration and gets rejected as
an incorrect slice.
Sibling nests don't depend on each other, so compute the slice from a
single pair of loads instead, preferring one that gives a maximal slice,
and drop the single-load restriction.
Fixes #219356
Used Claude to help with helper function and tests
vendor/GCC120: Backport one lto-dump fix
lto-dump: Do not print output file
Right now the following is printed:
lto-dump
.file "<artificial>"
.ident "GCC: (GNU) 13.0.0 20220707 (experimental)"
.section .note.GNU-stack,"",@progbits
After the patch we print -help and do not emit any assembly output:
lto-dump
Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...
LTO dump tool command line options.
-list [options] Dump the symbol list.
[5 lines not shown]