pwd_altroot(): avoid creating new pwd structure if altroot does not change
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
vfs: guard against altroot pointing to not a directory
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
namei: disallow altroot for beneath lookups
Once namei_setup() has determined that the lookup is strictly relative,
set ni_rootdir to pwd_rdir and mark the lookup as already restarted,
which effectively disables restart on ENOENT.
This is done in namei_setup() and not in NDINIT(), because RBENEATH
might be set after NDINIT() by vn_open_cred() or inherited from
the dirfd in fgetvp_lookup(), and ISRESTARTED is cleared by
NDREINIT()/NDRESET().
Noted by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
exec_new_vmspace(): drop altroot for native processes if setuid
Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
[SystemZ][z/OS] Emit printable string data as CE/CA constants in HLASM (#243234)
The HLASM streamer emitted every emitBytes() payload as hex (DC XL),
which made z/OS string data hard to read in the generated assembly.
MCAsmStreamer already distinguishes printable strings from binary data.
Mirror that behavior in SystemZHLASMAsmStreamer::emitBytes(). Each chunk
is classified as follows:
- If it is printable EBCDIC-1047 text (checked after converting it to
ASCII with ConverterEBCDIC::convertToUTF8), emit DC CE'...' using the
converted text.
- Otherwise, if it is printable ASCII, emit DC CA'...'.
- Otherwise, fall back to DC XL<n>'...'.
Apostrophes and ampersands inside the quoted text are doubled, as
emitALIAS() already does, so HLASM does not treat them as delimiters or
variable substitutions.
[17 lines not shown]
NAS-144777 / 27.1.0 / Prevent path traversal in container image extraction (by yocalebo) (#20278)
The image pull extracted each tarball member without a filter. A member
name with ../ or a leading slash can write a file outside the image
dataset. Middleware runs as root, so this is a root file write on the
host.
A new filter uses tarfile.tar_filter to reject these members. The
tar_filter also removes the setuid, setgid and sticky bits. A rootfs
needs these bits, so the filter puts the original mode back.
The extraction now also uses numeric_owner. Without it, tarfile gets the
uid and gid from the host user names and not from the image.
Original PR: https://github.com/truenas/middleware/pull/20277
Co-authored-by: Caleb St. John <30729806+yocalebo at users.noreply.github.com>
[flang] Move elementwise fold results instead of copying them (#240581)
The `FoldOperation` overloads for elementwise operations return
`*array`, where `array` is the local `std::optional<Expr<T>>` that
`ApplyElementwise` produced. In C++17, `return *array;` does not move,
so every folded array result (for a named constant, the whole array
`Constant`) is copied once more on the way out.
Return `std::move(*array)` at the 16 sites in `flang/lib/Evaluate`.
Assisted-by: AI
[flang] Make GenericExprWrapper and GenericAssignmentWrapper movable (#240580)
Both wrappers declare a destructor, which suppresses their implicit move
constructor and move assignment. The `std::move` calls in
`SetExprHelper` (`flang/include/flang/Semantics/expression.h`) therefore
fall back to the copy constructor, so every analyzed expression is
deep-copied twice when it is stored into the parse tree. `SetExpr` runs
for every `parser::Expr` node, so a long chain such as `a(1) + a(2) +
... + a(N)` costs time and allocations quadratic in N.
Declare defaulted move operations for both wrappers.
Assisted-by: AI
NAS-144777 / 28.0.0-BETA.1 / Prevent path traversal in container image extraction (#20277)
The image pull extracted each tarball member without a filter. A member
name with ../ or a leading slash can write a file outside the image
dataset. Middleware runs as root, so this is a root file write on the
host.
A new filter uses tarfile.tar_filter to reject these members. The
tar_filter also removes the setuid, setgid and sticky bits. A rootfs
needs these bits, so the filter puts the original mode back.
The extraction now also uses numeric_owner. Without it, tarfile gets the
uid and gid from the host user names and not from the image.
[CIR][OpenMP] Add support for host_eval so that SPMD kernels can be used
This patch adds support for host_eval so that SPMD kernels and in the future
num_threads and other clauses can be implemented correctly.
Assisted-by: Cursor / Claude Sonnet 5 High
[BPF] Relocate enumerators in case labels and add -fbpf-no-enum-reloc= (#243338)
This is a follow-up to #232498, which added the preserve_access_index
attribute for enums. It resolves two points from the review.
Switch cases
------------
An enumerator in a case label was not relocated: the case label requires
a constant, so the local value was used and -Wbpf-enum-not-relocated was
reported. Now it is relocated, so `case A:` behaves like
`if (cond == A)`. For example:
```
enum bpf_func_id { BPF_FUNC_a = 1, BPF_FUNC_b = 4 }
__attribute__((preserve_access_index));
int f(int id) {
switch (id) {
case 2:
return 1;
[107 lines not shown]
[Mips] Use a frame pointer when the call frame isn't reserved (#242006)
If the outgoing call frame is too large to reserve, SP is adjusted
around calls.
Without a frame pointer, locals and spills are addressed from SP. Mips
eliminateFrameIndex() ignores SPAdj (and the scavenger uses SPAdj = 0
for emergency spill slot), so accesses inside a call sequence can use
the wrong address.
Adapt #181302 and #182124 from RISC-V.
- Force a frame pointer when the call frame isn't reserved.
- Compute the max call frame size at the end of ISel, so hasFP() is
known before reserved registers are frozen.
- Compute it when loading MIR too.
- Regenerate tests. Checks in byval.ll were encoding wrong addresses.
[Polly] Retain vectorization for fallback loop when RTC is provably false at compile time (#243781)
Polly currently has a guard to not disable vectorization if the runtime
condition is constant False. This expands that to also include
situations where the runtime guard is non-constant, but provably false
at compile time, e.g RTC = (cond1 && cond2 && cond3), and any of them is
false. Currently vectorization is disabled in those cases, causing big
slowdowns.
Fixes #243780
Assisted by Codex (6.1 Sol and 6.1 Astra)