bnxt: fix an out-of-bounds write in bnxt_copy_maddr()
bnxt_copy_maddr() copies link-layer multicast addresses into the
BNXT_MAX_MC_ADDRS-entry list given to the firmware, but only skips the
copy when cnt == BNXT_MAX_MC_ADDRS. The callback returns 1 for every
address, so with 18 or more addresses it writes past the end of the
list. bnxt_multi_set() switches to ALL_MCAST when there are more than
BNXT_MAX_MC_ADDRS addresses, so the extra entries are never used, but
on amd64 the list sits at the start of a 4 KB allocation, and with 683
or more addresses the writes go past it.
Skip the copy for every cnt >= BNXT_MAX_MC_ADDRS.
Fixes: dbf9bf044c6e ("Convert to if_foreach_llmaddr() KPI.")
MFC after: 2 weeks
Sponsored by: E-CARD LTD.
Sponsored by: Klara, Inc.
Reviewed by: sef, gallatin
Differential Revision: https://reviews.freebsd.org/D61950
bnxt: don't fail init when out of VLAN L2 filters
bnxt_hwrm_set_filter() allocates an L2 filter for every configured
VLAN and fails the init if any allocation fails. A port has a fixed
number of L2 filters (509 on a BCM57416), so with enough VLANs every
init fails with RESOURCE_ALLOC_ERROR and the port stays down until
VLANs are removed.
The port's MAC filter does not match on VLAN, so the per-VLAN filters
are not needed to receive tagged traffic ( VLANs added while the port
is running already work without one until the next init). Treat
ENOMEM from the VLAN filter allocations as non-fatal (leave the
remaining tags without a filter and log their count, once per init).
Any other error still fails the init.
Append new tags in bnxt_vlan_register() instead of prepending them, so
the oldest VLANs keep their filters and the most recently added ones
beyond the ports capabilities do not get a filter.
[7 lines not shown]
bnxt: reset VLAN filter IDs in bnxt_clear_ids()
bnxt_clear_ids() resets the firmware IDs the driver caches, including
vnic_info.filter_id, but not the per-VLAN filter IDs added in
91fcacc35597. On pre-P5 chips, bnxt_init_hw() and bnxt_stop() free
the filters in firmware with HWRM_FUNC_RESET and leave tag->filter_id
set. Once the VLAN filters have been allocated, the next init (for
example from ifconfig down/up or an MTU change) fails in
bnxt_hwrm_set_filter() with "Attempt to re-allocate l2 ctx filter",
and the port stays down until its VLANs are removed.
Reset tag->filter_id along with vnic_info.filter_id.
Fixes: 91fcacc35597 ("if_bnxt: Add support for VLAN on Thor")
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: E-CARD LTD.
Reviewed by: sef
Differential Revision: https://reviews.freebsd.org/D61945
[CIR] Use the pragma FP environment for __builtin_convertvector
`ScalarExprEmitter::VisitConvertVectorExpr` emitted the conversion
without a `CIRGenFPOptionsRAII`, so the cast got the floating-point
environment of the command line instead of the one that pragmas set at
the expression. With `-ffp-exception-behavior=strict` on the command
line and `#pragma clang fp exceptions(maytrap)` plus
`#pragma STDC FENV_ACCESS ON` in the function, ClangIR lowered the
conversions to constrained intrinsics with `round.tonearest` and
`fpexcept.strict`, where classic codegen emits `round.dynamic` and
`fpexcept.maytrap`.
Install the RAII for the conversion, after the source operand is
emitted, as classic codegen does on each floating-point path.
The test converts between float vectors and signed, unsigned, double
and bool vectors, so it covers the `float_to_bool` and `bool_to_float`
casts too. ClangIR and classic codegen share every LLVM check for them,
and the ClangIR run rejects any plain conversion or `fcmp` instruction
[3 lines not shown]
[mlir][DataLayout] Add DataLayout type entry presence query (#240853)
Split from https://github.com/llvm/llvm-project/pull/238562
For the `IntegerRangeAnalysis` we want to distinguish cases when index
type width was explicitly specified vs implicit 64bit fallback.
Add `hasTypeEntry` (cached) to `DataLayout` to check if some type was
explicitly specified. `getTypeSize` can still return some fallback value
even if `hasTypeEntry` is false.
[analyzer][NFC] Mark leaf classes final and drop virtual from some methods (#245795)
Two small cleanups to the analyzer's class hierarchies:
- Mark final the leaf classes of the MemRegion, SymExpr,
ConstructionContext, PathDiagnosticPiece and BugReport hierarchies, plus
RegionStoreManager, RangeConstraintManager and SimpleSValBuilder, which
call their own virtual methods internally. Classes that have subclasses
are left as they are.
- Drop virtual from methods that are never overridden:
StoreManager::getLValue{Var,Ivar,Field,Element},
CallEvent::getArgSourceRange, RangedConstraintManager::assumeSymRel,
SMTConstraintManager::addStateConstraints and
CFGDominatorTreeImpl::releaseMemory.
This lets the compiler devirtualize more calls and slightly shrinks the
analyzer libraries. There is no significant performance change on LLVM
TUs.
[2 lines not shown]
NAS-145415 / 27.1.0 / Advertise the TrueNAS API over mDNS as _truenas-api._tcp (by william-gr) (#20309)
Advertise the TrueNAS API over mDNS as `_truenas-api._tcp`, on the web
UI's HTTPS port, so that a client such as the TrueNAS Connect app can
find a TrueNAS whatever its host name. Today a TrueNAS advertises its UI
only as `_http._tcp`, named after its host name, and nothing in that
says TrueNAS: the app keeps services whose name starts with "truenas"
and misses a renamed system.
The TXT record holds what the NAS already answers before signing in,
with the `_PLAIN` suffixes trimmed off the authentication mechanisms,
and `txtvers` first (RFC 6763 §6.7). It is 73 bytes:
```
txtvers=1
api=min=v25.10.0,max=v28.0.0
mech=API_KEY,TOKEN,PASSWORD,SCRAM
```
[16 lines not shown]
[CIR] Keep complex and bool casts constrained in strict FP functions
In a strictfp function ClangIR emitted plain `fpext`, `fptrunc`,
`fptosi`, `sitofp`, `uitofp` and `fcmp une` for casts between complex
types and for conversions between floating-point values and bool, where
classic codegen emits constrained intrinsics. CIRGen created the
complex casts and `float_to_bool` without the `fenv` attribute,
LoweringPrepare dropped the attribute when it expanded a complex cast,
and the LLVM lowering of `float_to_bool` and `bool_to_float` ignored
it.
`createCast` now takes an optional `fenv` attribute. CIRGen passes the
current floating-point environment for `float_to_bool` and for the
complex cast kinds that convert floating-point values. The kinds that
only select or pack a part, `float_to_complex` and
`float_complex_to_real`, get none, and the verifier no longer accepts
the attribute on them. LoweringPrepare passes the attribute of a
complex cast to the scalar casts of its expansion. With `fenv`,
`float_to_bool` lowers to the quiet constrained `fcmp` and
[8 lines not shown]
[CIR] Mark LoweringPrepare init functions strictfp
Classic codegen's StartFunction makes a function that has no
FunctionDecl `strictfp` when the TU-wide default FP environment is
constrained: FP exceptions are not ignored or the rounding mode is
dynamic. Of those functions ClangIR creates `_GLOBAL__sub_I_*`,
`_GLOBAL__I_*`, the C++20 module initializer, `__cxx_global_var_init*`,
`__cxx_global_array_dtor*` and `__tls_init`. It marked only
`__cxx_global_var_init*`, through a `strictfp` attribute on `cir.global`,
so the other functions and the calls in them were not `strictfp`.
Classic also marks the `__dtor_*` stubs, `_GLOBAL__D_a` and
`__GLOBAL_cleanup_*`, which ClangIR does not emit.
LoweringPrepare creates these functions after CIRGen, so it reads the
TU-wide default from `#cir.lowering_options`. `no_trapping_math` already
records whether FP exceptions are ignored, and the new `rounding_math`
field mirrors `LangOptions::RoundingMath`. It is omitted when false, so
the module attribute prints as before without `-frounding-math`.
`buildRuntimeFunction` adds `strictfp` together with the other TU-wide
[8 lines not shown]
[CIR] Lower constant vectors with undef, poison and zero elements
The `cir::ConstVectorAttr` verifier only checks the element types, so
`#cir.undef`, `#cir.poison` and `#cir.zero` are valid elements, and
`VecShuffleOp::fold` created an undef element for a -1 index. The
lowering to the LLVM dialect handled int, float and bool elements and
hit an `llvm_unreachable` on anything else, so a
`__builtin_shufflevector` of two constant vectors with a -1 index
crashed `-fclangir -emit-llvm`.
A zero element is now a zero in the dense constant. An undef or poison
element also takes a zero there and is then replaced by an
`llvm.insertelement` of `llvm.mlir.undef` or `llvm.mlir.poison`.
`llvm.mlir.constant` cannot hold such an element itself: a dense
elements attribute holds only literals, and the translation to LLVM IR
accepts a per-element `LLVM::UndefAttr` or `LLVM::ZeroAttr` only in
struct and array constants and no `LLVM::PoisonAttr` at all. The
IRBuilder folds the insertions when the module is translated, in
function bodies and in global initializers, so the LLVM IR holds one
[10 lines not shown]
[CIR] Use the FP environment of a compound assignment for its conversions
`ScalarExprEmitter::emitCompoundAssignLValue` emitted the conversions of
a compound assignment, from the left operand to the computation type
and back, without a `CIRGenFPOptionsRAII`. Under `#pragma STDC
FENV_ACCESS ON` the arithmetic was constrained but the conversions of
`x *= 0.1` or `i += x` got the default environment, and lowered to
plain `fpext`, `fptrunc`, `sitofp` and `fptosi` where classic codegen
emits constrained intrinsics.
Install the RAII with the features of the assignment after the left
operand is loaded, as classic codegen does.
Assisted-by: Claude Code (Opus 5.5).
[CIR] Mark calls in strictfp functions strictfp
LangRef requires every call in a function that uses constrained FP
intrinsics to be `strictfp`, at the call site or on the callee, and
LLVM checks the call, not its caller, before it folds or simplifies a
libcall. Classic codegen gets the attribute from IRBuilder's
constrained mode. ClangIR marked only the function, so at -O1 LLVM
folded `erf(1.0)` to a constant under `FENV_ACCESS ON`.
The lowering now adds `strictfp` to every call in a `strictfp` function
once the module is translated to LLVM IR. That covers direct and
indirect calls, invokes, intrinsics, inline assembly, and the calls
that LoweringPrepare and EH lowering create. CIR does not change,
`strictfp` stays a function attribute.
The fixup runs only in `lowerDirectlyFromCIRToLLVMIR`. LLVM dialect
that another tool translates, such as `cir-opt -cir-to-llvm` output fed
to `cir-translate -mlir-to-llvmir`, does not get the attribute. The
LLVM dialect has no call-site `strictfp`, so the proper home is MLIR's
[10 lines not shown]
[flang][OpenMP] Clarify descriptor mapping lifetime warnings (#244624)
Mapping an allocatable component such as `this%arr` with `target enter
data` can produce a warning about a locally created descriptor, even
when the descriptor belongs to the caller’s derived-type object.
Give these cases a dedicated warning explaining that an exit through a
nonallocatable assumed-shape dummy does not identify the original
component descriptor. Recommend a direct component exit or an
`ALLOCATABLE` helper dummy for matching cleanup.
| Aspect | Before | After |
|---|---|---|
| Component identification | Names and highlights `arr` | Names and
highlights the full designator, `this%arr` |
| Explanation | Describes a potentially local descriptor | Explains that
releasing allocated storage may leave its descriptor mapped |
| Cleanup guidance | Recommends `TARGET EXIT DATA` in the same scope |
Recommends a direct component exit or an `ALLOCATABLE` helper dummy |
[3 lines not shown]
[CIR] Fix crashes in the complex constant folders
The folders of `cir.complex.real`, `cir.complex.imag` and
`cir.complex.create` asserted on constants that the `cir.const` verifier
accepts.
`cir.complex.real` and `cir.complex.imag` cast a constant operand to
`#cir.const_complex`. A complex constant can also be `#cir.zero`,
`#cir.undef` or `#cir.poison`. CIRGen emits `#cir.zero` for a
value-initialized complex, so clang crashed on `__real__ CI()`. A part
of `#cir.zero` now folds to the zero of the element type. A part of
`#cir.undef` or `#cir.poison` folds to undef or poison, as the cast
folder does for its operand.
`cir.complex.create` built a `#cir.const_complex` from any two constant
parts. The attribute holds int or float literals only, so its verifier
failed on a part that is undef, poison or a global view. The folder now
leaves such a create alone.
Assisted-by: Claude Code (Fable 5.2).
[clang] Expose a few more flags to clang-cl (#246029)
Expose -f(no-)allow-editor-placeholders, -f(no-)spell-checking,
-fdiagnostics-format=, -fparse-all-comments, -fno-align-functions,
-fbuiltin-module-map, -fno-implicit-module-maps, and -pedantic to
clang-cl.
libclang adds -fno-spell-checking and -fallow-editor-placeholders to the
args it's given, so when using libclang with --driver-mode=cl, libclang
used to error on the flags it itself adds.
audio/maolan-generate: Add new port
maolan-generate is a Rust-based music generation tool that provides
a CLI for prompt-driven audio creation. It handles the runtime
generation and decoding of music using text or lyrics prompts
with optional style tags.
WWW: https://maolan.rs
PR: 294911
First start at interprocessor messaging for pmap operations.
First up: tell other CPUs that have a pmap loaded when that pmap
transitions to using the null_segtab (when last mapping has been
removed).
[libc][regex] Increase expr_test GPU stack to 8 KiB (#246031)
Since [#245590](https://github.com/llvm/llvm-project/pull/245590)
landed, `expr_test` fails with a GPU memory-access error ([buildbot
log](https://lab.llvm.org/staging/#/builders/248/builds/155)). The
default 3 KiB device stack is too small for the alternation tests, so
give `expr_test` an 8 KiB stack.
Verified on a local GPU: 3 KiB reproduces the error, while 8 KiB passes
all 14 tests. The two host regex support tests also pass.
Assisted-by: Devin