Only accept a report file name in audit.download_report
audit.export creates each report directly in the user's report
directory, so report_name must be a single file name. Refuse a name
that is empty, is "." or "..", or contains "/" or a NUL byte.
Open the report with safe_open, which refuses a symlink anywhere in
the path, and serve it from that file once it is confirmed to be a
regular file. This replaces the separate existence and file type
checks on the path.
[clang] Don't relocate DWARF on 32-bit ARM and x86 Mach-O (#244069)
On 32-bit ARM and x86, Mach-O uses scattered relocations, which identify
their target by address. Relocatable DWARF puts every __DWARF section at
address 0, so these relocations become ambiguous: a line table's
reference to a file name in __debug_line_str resolves to the first
function in __text instead.
Don't enable relocatable DWARF for these architectures.
Assisted-by: Claude
NAS-145324 / 27.1.0 / Check the resolved path in filesystem permission changes
filesystem.stat set realpath from the absolute path for anything that
was not itself a symlink, so it kept ".." components and symlinked
parent directories. Resolve the whole path, as the field's description
says. NFS share validation and vm.device.convert, which also use
realpath, now see the fully resolved path.
The path checks of filesystem.chown, filesystem.setperm and
filesystem.setacl matched that realpath by string prefix, without a
component boundary. Compare whole path components instead. The S3
bucket check no longer resolves the path a second time.
Also fix the schema name in the "Must be an absolute path" error.
(cherry picked from commit c0250bb7913c6d4b569d4536ec97f5938317894f)
[dsymutil][test] Use FileCheck --ignore-case in pseudo-probe.test (#243999)
Follow-up to #243925, addressing the post-merge review comment from
@perry-ca.
Use FileCheck's `--ignore-case` option instead of piping `od` output
through `tr A-F a-f`, consistent with other tests (e.g.
`llvm/test/tools/yaml2obj/XCOFF/string-table.yaml`).
[OpenMP] Fix __kmp_invoke_microtask for arm64_32 (#243956)
On arm64_32 pointers are 4 bytes. Use 4 byte loads and stores for the
p_argv entries, the stack arguments and *exit_frame_ptr.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[InstCombine] Check the select type in the usub.sat sign mask fold (#244281)
`foldICmpUSubSatWithAndForMostSignificantBitCmp` replaces a select with
an `and` that has the type of the `usub.sat` operands. We can't do the
replacement when the select has a different type.
This PR was assisted by AI but I reviewed all the changes.
[lldb] Fix SBCommandReturnObject::SetError dropping the error (#244317)
8789c96698e0 inverted the check, so only a successful SBError was
forwarded.
Assisted-by: Claude
[lldb][MS ABI] Use special demangle flags for templates (#238970)
In #236572, I added some flags to mimic the formatting MSVC (and Clang)
use for templates in PDB. Specifically, they don't insert spaces in
parameter lists and closing braces do have a space. DWARF only differs
in that it puts spaces between parameters.
When we detect a template name, we now demangle that manually, since
`Mangled` doesn't use the right flags. This is a bit more overhead, but
the result is cached anyway.
[Clang][Driver][NFC] Simplify fp-contract state tracking (#243282)
Simplify -ffp-contract state tracking by replacing
'LastSeenFfpContractOption' and 'SeenUnsafeMathModeOption' with a single
optional fallback value 'FPContractFallback';
Explicit -ffp-contract options set the fallback 'FPContractFallback' to
their value. Unsafe-math options establish "on" as the fallback only
when none exists. Disabling unsafe math restores that fallback,
preserving existing option-ordering behavior and CUDA/HIP exceptions.
Share the contraction-enabling logic through enableUnsafeFPContract()
and remove a redundant diagnostic-state reset.
Assisted by Copilot GPT-6.1 Sol
[clang][OpenMP] Fix APSInt bit-width mismatch in ordered depend/doacross check (#238672)
In `ProcessOpenMPDoacrossClauseCommon`, both `DepCounter` and
`TotalDepCount` were initialized as `32-bit APSInts`, after which
`TotalDepCount` was overwritten by
`OrderedCountExpr->EvaluateKnownConstInt(...)`. When the `ordered(n)`
clause expression had a bit-width other than 32 bits, `TotalDepCount`
took on that expression's bit-width while `DepCounter` remained 32-bit,
triggering an APInt bit-width assertion in `DepCounter >=
TotalDepCount`.
Initialize `DepCounter` after `TotalDepCount` is evaluated using
`TotalDepCount.getBitWidth()` so both unsigned APSInts always have
matching bit-widths.
Fixes #235971
Assisted-by: Gemini
[CIR][OpenMP] Specify target triple in OpenMP loop codegen tests (#244278)
Add `-triple x86_64-unknown-linux-gnu` to tests added in
61067a5096e (#229256) to avoid defaulting to the host target triple
and failing on non-x86 builders like
https://lab.llvm.org/buildbot/#/builders/231/builds/2223.
[bazel][libc] Enable fullbuild-only tests in CI (#244324)
These were previously excluded from CI, but now have support in
Buildkite and github CI (19b0091751d8c786c92e749a2d3404595edd359b). This
PR also adds `target_compatible_with` for overlay builds.
[OpenMP][flang] Score unknown context selector properties by selector
Flang records an unknown property such as kind(bogus) or vendor(bogus)
as TraitProperty::invalid, which belongs to no selector. Under
match_any or match_none, where such a variant can still be selected,
the property therefore lost its selector's weight: kind(bogus) added
nothing, while an unmatched kind(gpu) adds 2^l, where l is the number of
constructs in the context. A score on a selector that mixes known and
unknown properties was also added twice, once for the known property and
once for invalid, and unknown properties in different selectors shared
a single score.
Add VariantMatchInfo::addUnknownTrait, which keeps the property
unmatched and records its selector and score, and score that selector
like any other. Use it in Flang. Clang drops unknown properties while
parsing and is unaffected.
Fixes: https://github.com/llvm/llvm-project/issues/233029
Assisted-by: GitHub Copilot (Claude Opus 5.5)
[Clang][OpenMP] Use the associated loop's range in loop metadata (#240649)
The start and end locations in the `!llvm.loop` metadata of an OpenMP
loop came from the directive's source range, which covers only the
pragma line. Consumers of these locations, such as optimization remarks,
therefore reported the loop at the `#pragma omp` line rather than at the
loop.
Use the range of the associated loop instead, looking through loop
transformation directives such as `unroll` and `tile`. This covers the
inner loop and the outer dispatch loop of dynamic, guided and chunked
schedules. `sections` has no associated loop and keeps the directive
range.
For example, with `-fopenmp -O2 -Rpass=loop-vectorize`:
2 #pragma omp simd
3 for (int i = 0; i < n; ++i)
4 a[i] += b[i];
[4 lines not shown]
CGExprCXX: emit family and allockind attributes
This allows us to remove the special knowledge about C++ allocation from
LLVM's MemoryBuiltins.cpp, instead trusting attributes to communicate
the important properties.
Annoyingly, clang has to grow a little bit of hard-coded knowledge about
mangled symbol names in order to actually get the most-basic-matching
::operator::new when working out the alloc-family attribute. I spent
some time trying to do this "right" by looking up the available
operators new and finding the best one, but that's super tricky and this
has the virtue of working and being pretty obviously correct when
compared to the old code.
Happily, clang now emits allocator family attributes for custom
allocators like the `__hot_cold_t` overloads in `new_hot_cold.cpp`
(which `isReplaceableGlobalAllocationFunction` in clang recognizes),
allowing us to remove that special knowledge from LLVM.
[7 lines not shown]
SimplifyLibCalls: preserve allocation attributes in optimizeNew (#239731)
When `LibCallSimplifier::optimizeNew` rewrites an `operator new` call
into a `__hot_cold_t` allocation call, forward the allocation attributes
(`allockind`, `allocsize`, `"alloc-family"`, and parameter `allocalign`)
from the original call onto the synthesized call instruction alongside
its metadata.
This is a new patch since 2023 (unlike most of the rest of the stack)
and allows the next patch to remove more specialized C++ knowledge from
the LLVM layer, instead leaving it in clang where it seems more
sensible.
This patch was authored with the assistance of an LLM and was reviewed
by me before posting.