[lldb] Don't crash on a PE image read from memory that llvm::object rejects (#241902)
ObjectFilePECOFF::CreateMemoryInstance builds an object file from the
512 bytes lldb reads at a module's header address. ParseHeader can parse
the headers and section table from that, but
llvm::object::COFFObjectFile often can't; the export table and other
data directories point past the end of the buffer. CreateInstance
rejects a file whose binary can't be created, but CreateMemoryInstance
keeps the object, and m_binary stays null.
ParseSymtab, GetSectionDataSize and GetTlsIndexAddress dereference
m_binary without checking it. Loading such a module makes lldb look for
its symbol file, which parses the symbol table and crashes in
AppendFromExportTable. Check the binary there, as GetUUID and
ParseDependentModules already do.
Meta hit this with a Linux core of a .NET process. .NET assemblies are
PE files, the process maps them as plain files, and the core saved the
first page of one of them. Creating a module from that memory with
[3 lines not shown]
[dsymutil] Undo prefix mapping before resolving paths for ODR uniquing (#242437)
The classic linker resolves the declaration file of a type with
realpath() to tell apart types with the same name, line and size. For
paths remapped by compilation caching, which don't exist on disk,
realpath() fails and only the file name is left, so different types
declared in headers with the same name in different directories were
merged. Undo the prefix mapping from compilation-prefix-map.json first.
[dsymutil] Support compilation-prefix-map.json from compilation caching (#242436)
Compilation caching can prefix map the paths that the compiler sees, so
that cache keys don't depend on where the build happens, for example
/path/to/project becomes /^src. The build system records the mapping in
a compilation-prefix-map.json file in a parent directory of the object
files, as a JSON object from each remapped prefix to the original one.
dsymutil didn't support it, so it used the remapped paths from the
debug info as is: it failed to copy the Swift interfaces that the debug
info refers to, didn't recognize interfaces from the SDK or the
toolchain that it should skip, and wrote the remapped paths into the
dSYM.
Load the compilation-prefix-map.json closest to each object file, and
use it to find Swift interfaces and Clang modules, and to restore the
original paths in the path attributes and line tables of the linked
debug info. Clang modules use the map of the object file that refers to
them. -object-prefix-map still only applies to looking up Clang
[5 lines not shown]
[Support] Add vfs::findFileInParentDirectories() (#242492)
Several tools look for a file in a directory and its parent
directories, for example clang-format for .clang-format and clang-tidy
for .clang-tidy, and each has its own loop for that. Add a function for
it, which dsymutil will use to find the compilation-prefix-map.json
files that compilation caching writes.
[Support] Add PrefixMapper (#242491)
Add a utility for remapping path prefixes, along with MappedPrefix for
parsing "old=new" mappings. Mappings are matched on whole path
components and respect the configured path style, so Windows paths are
matched case- and separator-insensitively.
This will be used by dsymutil to undo the path prefix mapping applied
by compilation caching.
mii: call only PHY_STATUS() from mii_pollstat()
When we are in mii_pollstat() which effectively is called only from
ue_mii_sts methods of various drivers, we are interested in polling the
status and not making any actions.
What PHY_SERVICE(,, MII_POLLSTAT) effectively did was PHY_STATUS()
followed by mii_phy_update(). The latter is undesired, as we already may
be servicing a link state change event and posting a second one is not
what we want. Usually mostly harmless, this second event would panic when
device is calling into mii during its detach (e.g. USB device).
NB: there are few drivers that would do extra stuff between PHY_STATUS()
and mii_phy_update() in their mii_service methods. This seems irrelevant
to me when we are in ue_mii_stat/mii_pollstat. But I could be wrong.
See the PR for longer discussion.
PR: 290417
NAS-145334 / 28.0.0-BETA.1 / Let an S3 bucket grant list its actions (#20272)
The S3 service now serves bucket policies, which compile to grant rows
that can list exact actions instead of a preset. Accept that in the API:
a grant's access is a preset or a list of the actions READWRITE allows.
The service refuses its whole config over any other name, so owner-only
actions like releasing a legal hold are refused here first. The 28.0 and
27.1 APIs take a list; 27.0 clients see one as the smallest preset that
covers it.
Render a list into policies.conf comma-separated, add the three policy
actions to audit masks and audit events, and add the Object Lock fields
the audit parser now keeps: bypass, lock_mode, retain_until, legal_hold
and obj_vers.
This is required to enable the fine-grained access controls required for
managing buckets that have WORM-related settings.
Database field already is JSON and so we don't need migration.
Depends on changeset in NAS-145329
[SPIR-V] Add temporary SPV_INTEL_bfloat16_arithmetic alias for SPV_EXT_bfloat16_arithmetic (#244006)
This PR adds SPV_INTEL_bfloat16_arithmetic as a temporary alias for
SPV_EXT_bfloat16_arithmetic for consumers that recognize only the INTEL
name. It should be removed once those consumers move to the EXT name.
Fix two user.update validation bugs
Use the groups the account ends up with for the shell and privileged-group
checks. An update that clears every auxiliary group no longer falls back to
the stored groups. Setting `userns_idmap` while clearing a privileged group
now succeeds.
Run the case-insensitive SMB username conflict check whenever the account is
an SMB user. A rename no longer skips it when the request omits `smb`.
The tests come from #20265.
Add integration tests for container hostname configuration
container.start only logs a warning if it cannot write the container's
/etc/hostname and /etc/hosts, so check the rootfs after a start, and
after a rename followed by a start.
Resolve container etc paths within the rootfs when setting the hostname
Before a container starts, middleware writes its /etc/hostname and updates
the 127.0.1.1 line of its /etc/hosts.
Read an existing etc/hosts relative to the container's rootfs, resolving
symlinks as the container itself would, and only if it is a regular file
of a reasonable size. atomic_write already refuses a symlink in the path
of the files it writes. Unusual rootfs contents (symlinks, FIFOs, very
large files) are now handled predictably.
[libc][regex] Harden ExprPool, nullable, and pmatch (#243882)
Evaluating nullable() recursively can blow small stacks on embedded and
GPU targets when a pattern contains a long chain of anchors. Store a
4-bit anchor truth table inside Expr (keeping it at 16 bytes) so
nullable() runs in constant time with no recursion.
ExprPool also used an unseeded hash table with linear probing, letting
crafted patterns cause long collision chains. Mix heap and stack
addresses into a per-pool seed during initialisation and switch to
triangular probing. Narrowing node_count to ExprId frees 4 bytes for the
seed, keeping ExprPool at 72 bytes.
In NDEBUG builds, stripping assertions left invalid ExprIds and ByteSet
indices unchecked. Add runtime bounds checks across ExprPool and the
matcher, and reject unknown anchor bits before interning.
In regexec, a match previously left caller-provided pmatch arrays
unchecked and uninitialised. Check pmatch for null when nmatch is
[9 lines not shown]
RuntimeLibcalls: Mark noreturn and pure helper libcalls
Mark the functions which never return as noreturn. Add some nounwind
and cold, mostly following inferLibFuncAttributes. Mark
misc. functions as pure.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes inferLibFuncAttributes gives libcalls
Remove more differences with the attributes the InferFunctionAttrs
pass would add to the declared libcalls.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[LAA] Skip undef/poison strides behind integer casts. (#244395)
collectStridedAccess only rejected undef/poison strides when the stride
itself is undef/poison. If the stride is an integer cast of
undef/poison, the undef/poison value is still recorded as symbolic
stride, and users crash trying to walk its (non-existent) use-list.
Check the stride with casts stripped instead.
Fixes https://github.com/llvm/llvm-project/issues/241518.
[Bitstream] Reduce the inline capacity of BitstreamCursor's block scope
`BitstreamCursor` stores the code size and abbreviations of its enclosing
blocks in `SmallVector<Block, 8> BlockScope`, 272 of the cursor's 344 bytes.
That's a lot for objects that are embedded in bulk: clang's `ModuleFile`
holds seven cursors (`Stream` and the cursors for input files, source
locations, macros, preprocessed entities, submodules and declarations), which
makes up 65% of its 3,816 bytes, and the dependency scanner keeps over a
thousand `ModuleFile`s alive at its peak.
The nesting is shallow in practice. Measured with temporary instrumentation:
- Clang AST files (all 95,080 `ModuleFile`s of a 400-TU `clang-scan-deps`
run, clean and incremental): every cursor stays at depth 2 or less, and no
`EnterSubBlock()` ever reaches depth 3.
- LLVM IR bitcode (`llvm-dis`, `llvm-bcanalyzer -dump` on -O2 and -O2 -g
modules of clang sources): at most depth 3 (module -> function ->
constants/metadata/...).
This patch reduces the inline capacity to 2. Clang's cursors never allocate;
[38 lines not shown]
[Bitstream] Shrink BitCodeAbbrev's inline operand storage
`BitCodeAbbrev` stored its operands in a `SmallVector<BitCodeAbbrevOp, 32>`:
528 bytes of inline storage, a 640-byte malloc block once allocated via
`std::make_shared`. Most abbreviations have just a few operands, and a reader
keeps every abbreviation of every open block (and the BLOCKINFO ones) alive.
That adds up for Clang module files: the dependency scanner keeps many
`ASTReader`s with hundreds of PCMs open at once, and each `ModuleFile` holds
several cursors with their own abbreviation lists.
Counted with temporary instrumentation of `ReadAbbrevRecord` over one scan of
a 40-context/400-TU workload against the macOS SDK (`clang-scan-deps -j 14`,
clean module cache): 3.88M abbreviations read, up to 39.8k alive at once.
Operand counts:
| operands | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 17 |
|-----------|------:|------:|-----:|-----:|----:|----:|----:|----:|----:|----:|
| share | 43.6% | 27.0% | 4.9% | 7.4% | 2.5%| 2.5%| 2.5%| 4.9%| 2.5%| 2.5%|
| cumulative| 43.6% | 70.6% |75.5% |82.8% |85.3%|87.7%|90.2%|95.1%|97.5%| 100%|
[53 lines not shown]
[lldb] Pass the language through SBTarget::BreakpointCreateByNames (#244405)
The overload that takes a language forwarded eLanguageTypeUnknown.
Assisted-by: Claude
[LV] Ignore dead member addresses of interleaved store groups. (#244390)
VPlan computes the address of a store group from member 0, but
collectValuesToIgnore kept the address of the insert position (the last
member), so its dead address computation was still costed as forced
scalar.
[BOLT] Compare unwind and EH state in ICF (#244049)
ICF compared a CFI pseudo instruction only by its operand, an index into
the frame instruction table of its own function, but not by the frame
instruction behind it. It did not compare the rules in effect at the
entry (CIE initial instructions plus FDE instructions before the first
advance), as these don't end up in pseudo instructions. ICF also doesn't
compare the personality routine, whether the function has an LSDA, the
AArch64 return address signing state, or DW_CFA_GNU_args_size. For all
of these, BOLT keeps them outside the instruction stream. Since ICF
compares functions instruction by instruction, by opcode and operands,
and MCPlusBuilder::equals() skips annotations, so any state kept in
function fields or annotations is only compared when ICF checks for it
explicitly, like for landing pads and LSDA tables.
If two functions with identical code but different unwind info were
folded, the folded function would then always unwind with the rules of
the selected function, which could be wrong sometimes.
[12 lines not shown]
[lldb] Intern debugger-owned SB API strings in the debugger pool (#244348)
Intern strings returned by SB classes that belong to a debugger in that
debugger's pool (which currently is still the global pool).
GetDebuggerStringPool is a helper that takes a Target by reference, so
no getter can ask for a debugger's pool without a target. That was
intentional, to force the caller to think about that (and intern the
string in the global pool), making it easy to use the API correctly and
hard to do so incorrectly.
Assisted-by: Claude
Merge tag 'selinux-pr-20261119' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore:
"A single SELinux fix for a problem where we were not properly handling
MAP_SHARED_VALIDATE"
* tag 'selinux-pr-20261119' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
selinux: check MAP_SHARED_VALIDATE mappings as shared