zstream: track and limit memory use
`zstream` reads stream record payloads into memory while processing a
stream. Most subcommands use several parallel queues, which currently
have queue lengths on the order of 1000 slots. Depending on the
pipeline, there may be several thousand records in memory at any given
moment.
This is fine for typical filesystem send streams because most records
aren't payload-bearing and default record sizes are modest. However,
it's possible for streams to be far denser, as illustrated by this zvol
send stream breakdown posted by @ryan-moeller in #18565:
```
SUMMARY:
Total DRR_BEGIN records = 1 (0 bytes)
Total DRR_END records = 1 (0 bytes)
Total DRR_OBJECT records = 2 (0 bytes)
Total DRR_FREEOBJECTS records = 1 (0 bytes)
[36 lines not shown]
Reject untrusted poudriered log paths
Poudriered allowed any client-authorized command to specify a log
path. The root daemon created its parent directories and opened the
path with O_TRUNC.
Reject log fields on client requests. Preserve configured schedule
logs, use a root-owned /var/log fallback, and refuse to follow final
symlinks when opening logs.
(cherry picked from commit 01d5de2876a23701e41957826cd8115702c41684)
[MLIR][Analysis] Fix incorrect RegionBranchOpInterface API usage in SliceWalk (#188758)
`getControlFlowPredecessors` was passing `opResult.getResultNumber()`
and `blockArg.getArgNumber()` directly as the `index` argument to
`getPredecessorValues`. However, `getPredecessorValues` expects an index
into `getSuccessorInputs()`, not into the full result/block-argument
list.
If an op implementing `RegionBranchOpInterface` has results or block
arguments that are not successor inputs (e.g., an `scf.for`-like op
returning an additional loop counter that is not an `iter_arg`), the
passed index would be out of bounds.
Fix both cases by first looking up the value in `getSuccessorInputs()`
and using the found position as the index. If the value is not a
successor input, return `std::nullopt` since it has no control-flow
predecessors.
Fixes #175168
Assisted-by: Claude Code
[SSAF] Flatten 'UnsafeBufferReachableAnalysisResult' to a plain set
Previously, an 'UnsafeBufferReachableAnalysisResult' was organized as
a map from contributors to their mutually exclusive
sub-results. Because this extra layer of contributor information
proved unnecessary, this commit flattens the result into a plain set.
The source transformation expects the result to be a plain set, so
this is a prerequisite step for
rdar://185840466
xhci: Only reset the data toggle value when the USB stack asks for it
The previous patch assumes that we don't want to reset toggle bit in
STOPPED_STEP. However, a device can explicitly call
usbd_clear_data_toggle if necessary. As a result, instead of not
dropping the bit unconditionally, we added a field in xhci to specify
that we want to drop it, so that usbd_clear_data_toggle can handle it
correctly.
Reported by: oh
Reviewed by: kevans
Tested by: oh
Fixes: 28d85db46b48 ("xhci: Do not drop and add bits in xhci")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D59186
[SSAF] Add APIs for resolving bare EntityNames to qualified EntityNames
Also give Transformation access to SSAFOptions so that it can use
link-unit and compilation-unit IDs to resolve bare EntityNames.
first step of
rdar://185840466
[NFC][analyzer] Tweak constness of CheckerContext methods (#218937)
The method `CheckerContext::isDifferent` should be a `const` method (it
does not modify `*this`), but it was originally declared as non-`const`
and later commit f93f6e5259e32a00921c66561f3117356a779a01 introduced the
`const` variant as an overload along the non-`const` original variant.
As the non-`const` overload is does not have any advantage, this commit
removes it. (In many other cases a separate non-`const` overload is
needed because the `const` overload has `const` in its return type, but
here both overloads return the same `bool`.)
Additionally `CheckerContext::getPredecessor` had two overloads with
signatures
```c++
ExplodedNode *getPredecessor() { return Pred; }
const ExplodedNode *getPredecessor() const { return Pred; }
```
and this commit corrects it to `ExplodedNode *getPredecessor() const`
because it can return a pointer to a non-`const` `ExplodedNode` even if
`*this` is `const`.
[libc] Fix subnormal performance in strtod/strtof (#218991)
This makes parsing subnormal doubles around 12x faster and subnormal
floats around 4x faster.
Previously, calls like strtod("5e-324") took around ~64us, vs ~11ns for
a normal value like 1e-300. The main cause was that MAX_SHIFT_AMOUNT was
4, when it should have been 60, as indicated by the code comments. This
means that there were 15x more shifts than intended. Another issue is
that the subnormal branch was shifting one bit at a time instead of
taking advantage of the chunking already present in shift.
The behavior of strtod and strtof are unchanged.
```
+------------------------------+------------+-----------+---------+
| Benchmark | Before | After | Speedup |
+------------------------------+------------+-----------+---------+
| BM_StrToDoubleNormalShort | 59.4 ns | 59.9 ns | 1.0x |
| BM_StrToDoubleNormalLong | 973.0 ns | 362.0 ns | 2.7x |
[9 lines not shown]
net/cloudquery: fix build on 32 bit architectures
Compilation failed on 32 bit archtectures with the following error
message:
vendor/github.com/cloudquery/plugin-sdk/v4/schema/testdata.go:463:27:
3600000000 (untyped int constant) overflows int
vendor/github.com/cloudquery/plugin-sdk/v4/schema/testdata.go:467:27:
3600000000000 (untyped int constant) overflows int
vendor/github.com/cloudquery/plugin-sdk/v4/schema/testdata.go:467:45:
60000000000 (untyped int constant) overflows int
The reason is that strconv.Itoa() accepts only 32 bit arguments.
Attempt to fix by conversion of strconv.Itoa() to strconv.FormatInt()
with native int variables casted to 64 integers.
[mlir][LLVM] Use a disjoint scope domain when inlining noalias
This matches recent changes to the LLVM inliner.
AI disclosure: Claude wrote the code, I wrote the commit message and
have done initial review.
[mlir][LLVM] Add disjointScopes to AliasScopeDomainAttr
This also updates the MLIR-side inliner to clone disjoint domains
while cloning alias scopes, matching changes to LLVM.
AI disclosure: Claude wrote the code, I wrote the commit message and
looked at the code.
[AMDGPU] Use a disjoint scope domain for merged LDS structs
When lowering LDS values, all the values are mutually disjoint, so we
can use the newly-added disjoint scopes feature to simplify the IR.
AI disclosure: Claude wrote this and I reviewed it and wrote the
commit message
[AMDGPU] Use a disjoint scope domain for noalias kernel arguments
All noalias arguments of a kernel are disjoint with each other, so we
can use a disjoint scope to save on metadata construction.
AI disclosure: Claude wrote this, I looked at it and wrote this
message.
[Inliner] Use a disjoint scope domain for noalias arguments
InlineFunction creates alias.scope/noalias metadata to represent the
set of `noalias` arguments to a function. We don't need the `!noalias`
now that we have the ability to use disjoint scopes, saving us IR size
and metadata bloat.
TODO move these to a previous commit.
Also changes InstCombine to not drop the experimental.noalias.scope.decl
for disjoint scopes even if they're not mentioned in a `!noalias`, but
do still delete them if they're not used.
[IR] Add alias scope domains with disjoint scopes
See RFC at
https://discourse.llvm.org/t/rfc-disjoint-scope-alias-scope-noalias-domains/91537
This commit adds support for declaring an alias scope domain disjoint.
Disjoint domains are ones where each scope is implicitly `!noalias`
with each other scope in the domain. This is represented by adding an
`i1` into the scope's domain as the second argument, with `i1 true`
representing disjoint scopes and `i1 false` representing the old
non-disjoint behavior. AutoUpgrade mechanisms have been added to add
in the missing `i1 false` to existing metadata.
This commit updates alias analysis to know about disjoint scopes and
updates the function cloner to also clone the alias domain if it's
disjoint (since, as a herd of LLMs discovered, you don't want the old
IR to be noalias with a clone of itself).
Commits to migrate passes to use disjoint scopes where that's an
[4 lines not shown]
[utils] Don't rename %. inside quoted strings in test checkseg
Replacing `%.foo` with `%dotfoo` everywhere also caught any `%.foo`
inside metadata, which would then cause incorrect CHECK lines to be
generated (since the value in the metedata isn't going to be
modified).
This commit fixes the issue by matching quoted strings in a regex
before looking for %. to replace.
AI disclosure: Claude found and fixed this, I wrote the commit message
[ConstantTime] Address reviewer feedback on llvm.ct.select core
- Fix vector-split build error: call the existing SplitRes_Select for
CT_SELECT instead of the nonexistent SplitRes_CT_SELECT.
- Fix a VP_MERGE result-split regression: the CT_SELECT switch reformat had
moved ISD::VP_MERGE onto the SplitRes_SELECT_CC line, which reads operand 4
(out of bounds for VP_MERGE's 4 operands) and builds a SELECT_CC without
splitting the EVL, crashing or miscompiling any vp.merge whose result
vector must be split. Restore it to the SplitRes_Select group.
- Accept byte types (bN and vectors of them) in the Verifier and document
them in LangRef; add byte-typed X86 codegen and Verifier test coverage.
- Drop the redundant `VT0 == MVT::i1` guard in visitCT_SELECT; the inner
condition-type checks already cover correctness after promotion.
- LangRef: reword the constant-fold rule to the enforceable "constant
operand" form, restate fast-math flags via the general FP-call rule (only
nnan/ninf are poison-generating), and drop the redundant undef/poison
propagation paragraph that the noundef return already covers.
- Revert an unrelated whitespace change in LegalizeTypes.h.
- Drop redundant intrinsic declarations from the InstSimplify test and soften
the SelectionDAGBuilder fast-math comment.