18197 RFC1918 addresses get site-local scope defeating RFC 6724 destination selection
Reviewed by: Joshua M. Clulow <josh at sysmgr.org>
Reviewed by: Sebastian Wiedenroth <wiedi at frubar.net>
Approved by: Dan McDonald <danmcd at edgecast.io>
[clang-tidy] Compact the confusable identifier table (#202626)
Encode confusable replacement strings once in a shared UTF-8 byte array.
Each sorted mapping becomes an eight-byte code point, 16-bit offset, and
16-bit length entry instead of reserving nineteen UTF-32 code points for
every replacement.
ConfusableIdentifierCheck appends the UTF-8 slice directly after the
binary search, removing the per-identifier UTF-32 to UTF-8 conversion.
Add compile-time assertions for the eight-byte entry layout and the 64
KiB replacement-data limit, plus generator-side overflow checks.
The logical table shrinks from 508,400 to 63,327 bytes, saving 445,073
bytes. A stripped standalone clang-tidy shrinks from 91,116,608 to
90,654,176 bytes, saving 462,432 bytes (0.508%).
A lookup microbenchmark improves from 79.9 to 40.4 ns median. A
100,000-identifier clang-tidy benchmark improves from 0.343 to 0.314
seconds mean.
[3 lines not shown]
[mlir][tosa] Fix TosaNarrowTypes conversion order to prevent rollback crash (#207372)
Fix #206952 by doing `convertRegionTypes` before moving and unlinking
the blocks when handling `tosa.cond_if` ops. This will cause a crash
when doing rollback.
[clang][AST] Outline constant-interpreter shift diagnostics (#202633)
CheckShift is instantiated for each primitive left-hand and right-hand
type
and for both shift directions. Its four diagnostic paths are cold, but
each
instantiation currently emits the diagnostic construction and undefined
behavior handling.
Move those paths to the non-template, noinline diagnoseShiftFailure
function.
Valid shifts retain the existing checks and do not call the outlined
function.
Invalid shifts preserve the same diagnostic arguments and call
noteUndefinedBehavior exactly once.
On arm64 macOS with a Release build of standalone Clang, this changes:
linked binary: 222,173,192 -> 221,924,960 bytes (-248,232)
[5 lines not shown]
[SystemZ][z/OS] Show instruction encoding in HLASM output (#181904)
This change adds the support to show instruction encoding as a comment
when emitting HLASM text. With this, the last 2 LIT tests migrate to
HLASM syntax.
[clang] accept member specializations declared in class scope (#207256)
Explicit specializations are not restricted to namespace scope since
CWG727 was accepted as a DR.
Also fixes a crash upon error recovery in this case which was a recent
unreleased regression.
Fixes #206866
[scudo] Remove internal linkage from LargeBlock header helpers (NFC) (#207708)
`addHeaderTag` and `getHeader` are static function templates in
`secondary.h,` so any TU that includes the header without using them
trips `-Wunused-template`. Dropping static fixes the warning.
Part of #202945.
[CodeGen] Compact cost table entries (#202836)
ISD and CostType can both be shrunk to uint16_t, which reduces the
binary by 16KB.
Work towards #202616
AI tool disclosure: Co-authored with OpenAI Codex.
[MLIR][OpenMP] Prevent openmp-device attribute being added to the host (#207719)
This attribute is only intended for an OpenMP target device but a recent
patch started causing it to appear on the host. This causes the
OpenMPOpt pass to treat the LLVM IR module as an OpenMP offloading
target, potentially introducing invalid modifications.
Fixes #207423.
[compiler-rt][sanitizer_common] Fix -Wunused-template in test helpers… (#207706)
`Ident` is a static function template in a test header, so any test TU
that never calls it trips `-Wunused-template`. Drop static.
`check_locked` in `sanitizer_mutex_test.cpp` has no callers.
Part of #202945.
[ORC] Track __emutls_t definitions in IRMaterializationUnit (#207161)
When emulated TLS is enabled, `IRMaterializationUnit`'s constructor
emits an `__emutls_t.<var>` symbol for each non-zero-initialized
`thread_local` global and records it in `SymbolFlags`, but never adds it
to `SymbolToDefinition`.
If the same weak (`linkonce_odr`) definition is materialized by more
than one module — e.g. an `inline` function that odr-uses such a
`thread_local`, pulled into two `PartialTranslationUnit`s by clang-repl
— `JITDylib::defineImpl` discards the duplicate via
`IRMaterializationUnit::discard()`. `discard()` looks the symbol up in
`SymbolToDefinition` and, finding nothing, dereferences `end()`: an
assertion failure in `+Asserts` builds and heap corruption otherwise.
Register `__emutls_t.<var>` in `SymbolToDefinition` alongside its flags,
mirroring the `__emutls_v.<var>` handling just above.
### Test
[11 lines not shown]
dtrace: Fix DOF section-specific validation
The entry size of the probe section is assumed to be at least
sizeof(dof_probe_t) by the loop further below.
enoff_sec->dofs_entsize was not being validated at all.
When multiplying an index by a table entry size, make sure the
multiplication can't overflow.
Fix an off-by-one when validating the translated probe argument array.
Make sure that the probe argument argvs are valid string offsets
even if the argument count is zero.
Reviewed by: christos
MFC after: 2 weeks
Sponsored by: CHERI Research Centre
Differential Revision: https://reviews.freebsd.org/D57979
dtrace: Improve DOF string table validation
The check for a nul terminator implicitly assumes that the section size
is positive. Make the assumption explicit.
Reviewed by: christos
MFC after: 2 weeks
Sponsored by: CHERI Research Centre
Differential Revision: https://reviews.freebsd.org/D57977
dtrace: Fix DOF section bounds validation
We must ensure that each DOF section does not overlap with the DOF
header or section table. Otherwise the relocations processed in the
second pass over sections can manipulate DOF metadata, leading to OOB
writes.
Reviewed by: christos
MFC after: 2 weeks
Sponsored by: CHERI Research Centre
Differential Revision: https://reviews.freebsd.org/D57976
dtrace: Improve DOF section size validation
The loop which validates each DOF section assumes that the section
header is present, so the section size must be at least as large as the
header, otherwise a small OOB access is possible.
Reviewed by: christos
MFC after: 2 weeks
Sponsored by: CHERI Research Centre
Differential Revision: https://reviews.freebsd.org/D57975
ee: Handle EINTR when waiting for a character
Otherwise one can't easily attach gdb to ee.
Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57997
ee: Improve handling of malformed UTF-8 characters
In delete(), when copying the deleted character to the d_char buffer,
don't assume that it fits. utf8_prev() may return a sequence of more
than 5 bytes.
In insert_utf8(), fix the copy-up of the line. We extended the line by
"len" bytes, so "temp" has to be repositioned accordingly. Compare with
plain insert().
Use sizeof when copying to buffers instead of hard-coding buffer sizes.
Don't dynamically allocate d_char, there is no need.
Fixes: 62fba0054d9e ("ee: add unicode support")
Reported by: Sayono Hiragi (overflow in delete())
Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57996
pmap_enter(): When overwriting an existing mapping for one to a different
PA, don't pass the vm_page * computed earlier to the pmap_remove_mapping()
call; that vm_page * is for the new PA, not the existing one we're removing
the mapping for.
NAS-141677 / 26.0.0-RC.1 / Replication fixes (#19255)
• Removing an SSH key pair now correctly updates SFTP cloud credentials
that were using that key.
• Encrypted SSH private keys are now rejected more consistently during
validation.
• Remote SSH semi-automatic setup now returns a clear error when the
selected SSH key pair no longer exists or is invalid.
• Fixed SSH pairing with TrueNAS 13 systems during remote replication
setup.
Improving MinUI and MaxUI implementation in valuebounds (#207701)
Previously, the valuebounds implementation for MinUI and MaxUI was too
conservative.
We can already make correct assumptions even when we know only one
operand is provably not negative.
NAS-141677 / 25.10.5 / Replication fixes (#19256)
• Removing an SSH key pair now correctly updates SFTP cloud credentials
that were using that key.
• Encrypted SSH private keys are now rejected more consistently during
validation.
• Remote SSH semi-automatic setup now returns a clear error when the
selected SSH key pair no longer exists or is invalid.
• Fixed SSH pairing with TrueNAS 13 systems during remote replication
setup.
---------
Co-authored-by: themylogin <themylogin at gmail.com>
[flang][cuda] Only strip internal linkage for device globals (#207521)
Stripping all linkage was too much. Only strip internal linkage so the
symbol is visible to CUDA API.
[InstCombine] Propagate debuglocs when replacing insert->extract elts (#206026)
InstCombine may replace an extractelement->insertelement chain, where
the insert vector is wider than the extract vector, with a pair of
shufflevectors - one to widen the extract vector, and one to perform the
extract+insert simultaneously. Currently the second shufflevector
correctly adopts the insertelement's debug location, since it replaces
the chain of instructions that culminates with the insert. The first
shufflevector however takes its debug location from its insert position,
if the extract vector was a PHI or non-instruction, and otherwise
receives no location.
Since the first shufflevector is really adapting the extract vector for
use by one or more other instructions, we can consider it an extension
of the extractvector. If the extract vector is an instruction, its debug
location should be used (even if it is a PHI - this likely defaults to a
CompilerGenerated debug location); otherwise, the extract vector is a
constant, and so the shufflevector represents a constant materialization
- so should receive a CompilerGenerated location.
[AMDGPU] Do not copy the range attribute onto a widened kernarg load (#207655)
Sub-dword args (e.g. i8) are loaded as a full i32 and truncated. Copying
the i8 range onto the i32 load is invalid IR, and its bounds are wrong
since the upper bytes hold other args
Only copy the range when the load type matches the argument type