[clang][Sema][ThreadSafety] Accept attributes without arguments as meaning 'this' (#242937)
An attribute such as ACQUIRE or RELEASE without capability arguments is
documented to refer to 'this': the analysis translates it to the self
argument of the call (ThreadSafetyAnalyzer::getMutexIDs). But Sema
accepts one only on a non-static method of a capability class, and
elsewhere warns, even though it keeps the attribute.
On a function pointer field, the meaning of such an attribute has slowly
changed without being explicitly proposed. d1e84bb9ad3b (#191187)
allowed these attributes on function pointer fields. A call through a
field had no self argument then, so such an attribute on a field
translated to no capability and was dropped. dfeadc6b0836 (#231602) made
the base of the member access the self argument of a call through a
field, so that the attribute could name a sibling member. As a side
effect, an attribute without arguments on a field came to name that
object, as it does on a method. For
struct CAPABILITY("mutex") Node {
[39 lines not shown]
[clang][Sema][ThreadSafety] Name a member through 'this' in a parameter's attribute (#241077)
When parsing a parameters attribute, `this` wasn't in scope, so it
turned into a `DeclRefExpr`, which got turned into a wildcard for `&mu`
or matched nothing for `mu`. But the `DeclRefExpr` was only supposed to
turn into a wildcard for `&S::mu`, not to unexpectedly degrade accuracy
in all cases when parsing was imprecise. For example, in:
struct S {
Mutex mu;
void run(void (*cb)() REQUIRES(mu));
};
The analysis then read 'mu' as no particular object, matching no held
capability, so 'cb()' warned with 'mu' held; and '&mu' as the wildcard
'&S::mu', matching the 'mu' of any object.
This PR now parses a parameter's late-parsed attributes in the
function's scope, along with the function's own: at the end of the
[16 lines not shown]
Add USB quirk for WCH-Link adapter
WCH-Link is a debug adapter from QinHeng Electronics that features a
(proprietary) debug bridge for their RISC-V MCUs, as well as a serial
gateway, implemented as a CDC device. The CDC's call management
descriptor declares the data interface to be 1, but it is actually
interface 2. UQ_IGNORE_CDC_CM has already been implemented before to
handle this kind of firmware bug, so just add this quirk for WCH-Link.
Reported by: Holm Tiffe
MFC after: 1 week
vfs: drop S_ISGID on create when not a member of the group
A new file on tmpfs, HAMMER or HAMMER2 gets the directory's group and
the mode the caller asked for. If the creator was not a member of
that group, S_ISGID was kept, so any user who can write to a
directory owned by another group could create a set-group-ID
executable for that group; with /tmp on tmpfs (root:wheel 1777) that
is wheel. UFS and ext2fs already drop the bit when they create the
inode.
Do the same check as ufs_makeinode() in tmpfs_alloc_file(),
hammer_create_inode() and hammer2_inode_create_normal(), after the
group has been chosen: keep S_ISGID only for a member of the group or
with SYSCAP_NOVFS_SETGID. As in FreeBSD's fix for tmpfs, this covers
every node type.
Same issue as FreeBSD-SA-26:94.tmpfs (CVE-2026-127749).
Tested on tmpfs, UFS, HAMMER and HAMMER2: a file created with mode
[6 lines not shown]
[flang][OpenMP] Build the variant construct context from source nesting
METADIRECTIVE and DECLARE VARIANT selection collected the construct trait
set by walking the MLIR operations that enclose the current insertion
point. Those operations do not match source nesting: only some
constructs create an operation, composite constructs nest their
operations in a different order, and a clause is emitted wherever the
operation it belongs to is being built.
Collect the context from the source instead. The OpenMP constructs that
enclose the current PFT evaluation give the context of a statement. A
frame is recorded for each construct region entered while lowering an
evaluation, so that a clause sees the outer leaf constructs of its
compound directive. A METADIRECTIVE contributes the directive it
selected.
No functional change is intended. The context still contains only the
constructs counted before: TARGET, TEAMS, PARALLEL, DO, SIMD and
DISPATCH. Counting the remaining enclosing constructs is left to
[11 lines not shown]
[flang][OpenMP] Require an enclosing SIMD for construct={simd}
A construct={simd} selector without properties was ignored, because SIMD
is a predefined trait selector name (it can take clause properties)
rather than a directive name. A DECLARE VARIANT or METADIRECTIVE
alternative that requires SIMD was therefore selected everywhere,
including outside any SIMD construct.
Record the SIMD construct trait for such a selector. Lowering builds the
construct trait set from the enclosing MLIR operations, so also recognize
omp.simd there; otherwise calls inside SIMD would no longer match.
Fixes #244759
Assisted-by: GitHub Copilot
[SLP]Handle CouldNotCompute GEP pointer diff
getMinusSCEV returns CouldNotCompute for different pointer bases.
SCEVs cached before LCSSA formation make that possible for GEPs on
the same pointer operand; isLoopInvariant then crashed.
Fixed #245379
Pull-request: https://github.com/llvm/llvm-project/pull/245398
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::VBROADCAST_LOAD/SUBV_BROADCAST_LOAD handling (#245057)
Similar to #241972 - inspect constant loads by
X86ISD::VBROADCAST_LOAD/SUBV_BROADCAST_LOAD nodes for UNDEF/POISON
pr45443.ll - fixes regression from #243097
[analyzer] Avoid redundant lookups when removing dead bindings (#244748)
RegionStoreManager::removeDeadBindings looked up every cluster it was
already iterating over to check whether it was visited. SymbolReaper
re-walked the dependents of symbols that were already marked live and
looked up symbols twice. This reduces the instructions of analyzing some
LLVM TUs by about 1%.
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Gabor Horvath <gaborh at apple.com>
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[RISCV][P-ext] Rename pabs/pabd intrinsics to match latest spec. (#245321)
The type suffix should be unsigned to match the return type.
Spec change: https://github.com/riscv/riscv-p-spec/pull/383
NAS-145321 / 27.0.0 / Resolve container etc paths within the rootfs when setting the hostname (by bmeagherix) (by bugclerk) (#20290)
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.
Original PR: https://github.com/truenas/middleware/pull/20264
Original PR: https://github.com/truenas/middleware/pull/20276
Co-authored-by: bmeagherix <118192357+bmeagherix at users.noreply.github.com>
NAS-145323 / 27.0.0 / Only accept a report file name in audit.download_report (by bmeagherix) (by bugclerk) (#20289)
audit.export creates each report directly in the user's report
directory, so report_name must be a single file name.
Original PR: https://github.com/truenas/middleware/pull/20266
Original PR: https://github.com/truenas/middleware/pull/20273
Co-authored-by: bmeagherix <118192357+bmeagherix at users.noreply.github.com>
NAS-145324 / 27.0.0 / Check the resolved path in filesystem permission changes (by bmeagherix) (by bugclerk) (#20288)
The path checks of filesystem.chown, filesystem.setperm and
filesystem.setacl compared filesystem.stat's realpath, which keeps ".."
components for anything that is not itself a symlink, and matched
prefixes without a component boundary. Check os.path.realpath() of the
path instead, and compare whole path components.
Also fix the schema name in the "Must be an absolute path" error.
Original PR: https://github.com/truenas/middleware/pull/20267
Original PR: https://github.com/truenas/middleware/pull/20271
Co-authored-by: bmeagherix <118192357+bmeagherix at users.noreply.github.com>
[InstCombine] Fold a select of X and (and X, M) when the condition bounds X
If C implies that X has no bits outside the constant mask M, the arms of
select C, X, (and X, M) are equal wherever C holds, so the select is its
false arm; if !C implies it, the select is its true arm. The same holds
with the arms swapped.
Lua's interpreter decodes an RK operand by selecting between B and B &
0xff on the sign of the instruction word. On RISC-V, SimplifyCFG sinks
the two GEPs of RK() into one and leaves a select of their indices:
%s = lshr i32 %i, 23
%c = icmp sgt i32 %i, -1
%a = and i32 %s, 255
%r = select i1 %c, i32 %s, i32 %a
On RISC-V (rv64gc, -O3) this removes 46 instructions from lvm.c of Lua
5.1.4 (MultiSource/Applications/lua in llvm-test-suite, 2218 -> 2172)
and 84 from that of the Lua 5.3.6 release (3641 -> 3557). SimplifyCFG
[8 lines not shown]
[LV] Only charge legacy cost of forced scalars VPlan replicates. (#244725)
The legacy cost model charges forced scalars VF times their scalar cost,
even if VPlan folds them, hoists them or keeps them single-scalar. Only
pre-compute the legacy cost for forced scalars VPlan replicates per
lane; the VPlan cost model handles the rest.
This matches the existing behavior for InstsToScalarize.
Most test changes are due to no longer charging VF copies of `add %iv,
0` in the X86 interleave cost-model tests, which VPlan folds.
PR: https://github.com/llvm/llvm-project/pull/244725