[lldb][Clike] Add ByteSizedType (#243814)
ByteSizedType is a mixin that adds a byte size to a Type. Type itself
only declares GetByteSize (returning "unknown" by default) because many
types derive their size from another type (arrays, typedefs, ...) or
from the target (pointers) and therefore don't need to store one. Types
with a size of their own, such as builtins, records and enums, will mix
this in.
An unknown size is stored as a UINT64_MAX sentinel instead of using
std::optional, which would need extra space for its flag.
assisted-by: claude
[lldb][Clike] Don't require TypeSystemClang for AppleObjCRuntimeV2 (#238961)
This makes this code compatible with TypeSystemClike. This is also code
that has no error handling aside from silently doing nothing, so I added
logging in case we fail to grab the TypeSystem.
[lldb][test] Add a new test for float types (Reland) (#238992)
This is a new modern test for float types that replaces the test logic
from `API/types` test that is about to be deleted.
This is #208451 but updated to also handle PDB.
See also #208402
assisted-by: claude
[lldb][Clike] Don't compare types using TSClang in ItaniumABIRuntime (#238958)
This won't work with TypeSystemClike. CompilerType has a generic API
that does the same without adding a dependency on TypeSystemClang.
NAS-145364 / 28.0.0-BETA.1 / middleware: strengthen path handling (#20280)
Paths that an unprivileged user may control are opened with safe_open,
safe_open_raw and safe_makedirs from truenas_os_pyutils, which refuse a
symlink anywhere in the path, and a FIFO, socket or device node before
opening it.
- rsync: create and chown ~/.ssh/known_hosts through symlink-refusing
fds; cap the known_hosts read at 4 MiB
- ssh-keyscan: pass "--" before the host
- user: read authorized_keys with safe_open, capped at 1 MiB; unlink it
through a symlink-free .ssh fd
- filesystem.mkdir: chmod, rmdir and listxattr through fds; compare .ssh
by component
- NFS: refuse export paths that exportfs would rewrite
- nvmet: a FILE namespace must be a symlink-free regular file in a data
pool
- SMB: path_suffix and dataset_naming_schema must stay beneath the share
- filesystem.set_zfs_attributes: callers without FULL_ADMIN are limited
[28 lines not shown]
NAS-145422 / 27.1.0 / Fix flaky FTP tests (by themylogin) (#20312)
Preserving configs from previous test runs made tests unstable as they
became dependent on unrelated and uncontrollable environment.
Original PR: https://github.com/truenas/middleware/pull/20306
Co-authored-by: themylogin <themylogin at gmail.com>
NAS-145422 / 27.0.0 / Fix flaky FTP tests (by themylogin) (#20311)
Preserving configs from previous test runs made tests unstable as they
became dependent on unrelated and uncontrollable environment.
Original PR: https://github.com/truenas/middleware/pull/20306
Co-authored-by: themylogin <themylogin at gmail.com>
NAS-145423 / 27.1.0 / Fix queries like `["event_data.method", "in", ["network.configuration.update", "smb.update"]]` (by themylogin) (#20310)
It failed with TypeError: 'in <string>' requires string as left operand,
not NoneType at plugins/datastore/filter.py:13.
Not used by any of the current code, it was found by an agent
investigating an unrelated bug.
*Cause*: for JSON-path filters, filter.py turns a list or dict value
into one JSON string. That is right for `=`, as in
`["event_data.params", "=", [1]]`. But `in` and `nin` got the whole list
as one string, so `in_()` failed. This was added in f8bf3b9578. Before
that commit, in on a JSON path worked, so this is a regression.
Original PR: https://github.com/truenas/middleware/pull/20307
Co-authored-by: themylogin <themylogin at gmail.com>
[ConstantFolding] Add constant folding for strlen (#244183)
This patch adds constant folding of `strlen` on a string literal. These
are not uncommon, for example coming out of code like
```
std::string s = foo();
if (s == "bar") { ...
```
This patch (plus a follow-up one which exposes libfunc folding to inline
costs) helped resolve a 3% regression in a SPEC2026 benchmark coming out
of disable-pre-lto-vec changes.
netipsec: Apply the rest of a bundle when the PMTU check finds no SA
ipsec{4,6}_check_pmtu() looks up the SA of the last request of a policy to
learn the path MTU. When that request is at level "use" and no SA is
found for it, the lookup returns EJUSTRETURN, and ipsec4_common_output1()
and ipsec6_common_output() took that to mean that the packet needs no
IPsec processing. That holds for a policy with one request. For a bundle
it also skipped the requests before the last one, for example the ESP
tunnel request of "esp/tunnel/A-B/require ah/transport//use", and the
packet was sent without their transforms.
The lookup finds no SA when none is installed, and also when the last
request is a transport request that follows a tunnel request, as in the
example. The lookup fills in the empty addresses of a transport request
from the packet as it is before any transform, while the transform applies
the request after the tunnel request, to the outer header, and the SA is
installed for the addresses of the tunnel. So the bundle above was sent
without its transforms even with an AH SA from A to B in place.
[21 lines not shown]
[PowerPC] fix `ppc_fp128` `FABS` miscompile (#209286)
fixes https://github.com/llvm/llvm-project/issues/209034
On little-endian powerpc the bit position of the sign bit is bit 63, not
bit 127. However, `APFloat` reports that the sign bit is the MSB. As I
understand it, it is actually right about that because in the `APFloat`
internal representation the sign bit is in fact in the MSB, but using
this information for runtime values is incorrect for LE.
All three fix locations are required to get the correct output for this
reproducer.
I'm assuming there are more ways that this can fail, so a more
structural solution would be neat. I don't know how to do that though,
so in the meantime we can accumulate test cases and plug the gaps.
Fix swpgonly leak in uvm_swap_dropcluster()
from renaud@; OK kettenis@
Fix typo in my last commit
from renaud@
this is errata/8.0/024_swpgonly.patch.sig
[libc++][pstl] Add a task scheduler based on std::thread (#237313)
This PR adds a simple task scheduler for PSTL.
With that, `std::execution::par` makes algorithms run in parallel on
non-Apple platforms (Apple platforms keep using `libdispatch`).
The implementation uses only the threading facilities provided by the
C++ Standard and contains no platform-specific code.
This code is intended to be a replaceable implementation detail of
libc++, which is not exported and can only be accessed via the
`std::__pstl::__statpart::__apply()` proxy.
The design prioritises correctness and simplicity over peak performance,
while still performing reasonably for typical usage (comparable to
`dispatch_apply_f()` from GCD).
sys: protect special device locks during vnode teardown
Special device advisory locking can race with vnode teardown and access
freed specinfo.
OpenAI reported the problem and supplied an initial patch; that patch
introduced a NULL dereference window by clearing v_specinfo while
leaving the vnode typed VCHR or VBLK across a sleep; it also left
teardown exposed to vnode recycling during the drain.
In other words the initial patch addressed one race, introduced another,
and left the vnode lifetime problem unfixed.
Here the reworked approach with large colaboration with claudio@ with
talks and inputs from deraadt@ and beck@.
Resolve and detach specinfo under lockf_lock, interrupt all pending
requests, and retain its storage until the drain completes. Keep VXLOCK
and the temporary vnode reference through teardown; set VBAD before
[5 lines not shown]
In recv_report first check that the report is sensible via check_report
and then during parse copy only the bytes from the packet needed.
The netmask is stored as 3 bytes with the high byte being 0xff by default.
Also the netid depend on the size of the netmask and needs to be pulled
out of the packet with care.