tpm: fix multi-threaded access with per-open state
The TPM driver currently has a single buffer per instance to hold the
result of a command, and does not allow subsequent commands to be sent
until the current result is read by the same OS thread that sent the
command, with a timeout to throw away the result after a while if the
result is not read in a timely fashion. This has a couple problems:
- The timeout code has a bug which causes all subsequent commands to
hang forever if a different OS thread tries to read the result
before the OS thread which sent the command, and the OS thread
which sent the command never tries to read the result.
- Even if the first problem is fixed, applications expect to be able
to read the result from a different OS thread than the OS thread
which sent the command. The particular case that we saw was a go
application where the go runtime scheduled the goroutine which read
the result to a different OS thread from one where the goroutine
that sent the command ran, and there's no way to force these to
[11 lines not shown]
NAS-140381 / 26.0.0-BETA.2 / Use netlink API for default interface detection with IPv6 fallback (by sonicaj) (#18534)
This commit fixes Apps/Docker setup failing on IPv6 single-stack
deployments with "Unable to determine interface" error. The existing
get_default_interface() only read /proc/net/route (IPv4). This replaces
the procfs text parsing with the truenas_pynetif netlink API
(get_default_route), which tries IPv4 first and falls back to IPv6. Dead
constants RTF_GATEWAY and RTF_UP are removed.
Thank you @xionglingfeng for highlighting this issue and your
contribution.
Original PR: https://github.com/truenas/middleware/pull/18528
Co-authored-by: Waqar Ahmed <waqarahmedjoyia at live.com>
NAS-140381 / 27.0.0-BETA.1 / Use netlink API for default interface detection with IPv6 fallback (#18528)
This commit fixes Apps/Docker setup failing on IPv6 single-stack
deployments with "Unable to determine interface" error. The existing
get_default_interface() only read /proc/net/route (IPv4). This replaces
the procfs text parsing with the truenas_pynetif netlink API
(get_default_route), which tries IPv4 first and falls back to IPv6. Dead
constants RTF_GATEWAY and RTF_UP are removed.
Thank you @xionglingfeng for highlighting this issue and your
contribution.
Fix declare simd linear stride rescaling and arg_types verifier
1. Rescale constant linear steps from source-level element counts to byte
strides in Flang's processLinear(). For reference-like parameters
(pointers or non-VALUE dummy arguments) with Linear or LinearRef ABI
kind, the step must be multiplied by the element size in bytes. This
matches Clang's rescaling in CGOpenMPRuntime.cpp. Val and UVal kinds
are not rescaled as they describe value changes, not pointer strides.
Var-strides are also not rescaled as the value is an argument index.
2. Add a verifier check in DeclareSimdOp to ensure 'arg_types' length
matches the number of function arguments, preventing out-of-bounds
access during MLIR-to-LLVM IR translation.
Also restructure processLinear() to compute stepOperand per-variable
instead of appending the same operand for all objects in the clause,
enabling per-variable rescaling.
Assisted with copilot.
NAS-140347 / 26.0.0-BETA.2 / Expose `failover` namespace and several other public methods in API docs (by creatorcary) (#18533)
Automatic cherry-pick failed. Please resolve conflicts by running:
git cherry-pick -x 5ef002c21543d0d839a1fc7622e27d4b540d6bdd
If the original PR was merged via a squash, you can just cherry-pick the
squashed commit:
git reset --hard HEAD~5
git cherry-pick -x ad71fbed025f09eedd584d53fb02fa8972e4d3e4
Some methods, like the entire `failover` namespace (not including
sub-namespaces like `failover.reboot`), are excluded from the API docs.
This is because of two overlooked rules:
1. Setting `private = True` in the `Config` class of one `Service` class
is the same as setting `private = True` in the `Config`s of all
`Service` classes with the same name.
2. `private = True` in the `Config` class overrides `@api_method` with
[45 lines not shown]
[CGP][PAC] Flip PHI and blends when all immediate modifiers are the same
GVN PRE, SimplifyCFG and possibly other passes may hoist the call to
`@llvm.ptrauth.blend` intrinsic, introducing multiple duplicate call
instructions hidden behind a PHI node. This prevents the instruction
selector from generating safer code by absorbing the address and
immediate modifiers into separate operands of AUT, PAC, etc. pseudo
instruction.
This patch makes CodeGenPrepare pass detect when discriminator is
computed as a PHI node with all incoming values being blends with the
same immediate modifier. Each such discriminator value is replaced by a
single blend, whose address argument is computed by a PHI node.
NAS-140347 / 27.0.0-BETA.1 / Expose `failover` namespace and several other public methods in API docs (#18490)
Some methods, like the entire `failover` namespace (not including
sub-namespaces like `failover.reboot`), are excluded from the API docs.
This is because of two overlooked rules:
1. Setting `private = True` in the `Config` class of one `Service` class
is the same as setting `private = True` in the `Config`s of all
`Service` classes with the same name.
2. `private = True` in the `Config` class overrides `@api_method` with
`private=False`.
## Changes
- The following public methods (already being used by webui) will now be
displayed in the generated API docs:
| Namespace | Method | File |
|-----------|--------|------|
| `failover` | `do_update` | `failover.py:108` |
[31 lines not shown]
Add batch port validation endpoint `port.validate_ports`
This commit adds a new `port.validate_ports` endpoint that validates
multiple port/bindip combinations in a single call. Currently the apps
library calls `port.validate_port` once per port, each of which
internally queries all registered port delegates via `ports_mapping()`.
For apps with many ports (e.g. SeaweedFS with 15), this results in
redundant repeated work.
The new endpoint accepts a list of `{"port": int, "bindip": str}` dicts
and calls `ports_mapping()` only once for the entire batch. It supports
two modes:
- `raise_error=True`: raises a single `ValidationErrors` with all
conflicts (same pattern as the existing endpoint)
- `raise_error=False`: returns a JSON-serializable list of
`(attribute, errmsg, errno)` tuples
The existing `validate_port` endpoint is refactored to share a
`_validate_single_port` helper but its inputs, outputs, and behavior
are unchanged.
[llvm] Silence llvm-debuginfod-find/headers-winhttp.test on Windows bots temporarily (#187753)
Windows bots are still failing after a3db68a97b2c321e and
d7dbba55bff52f342. This test is new, let's take it off while
we investigate.
[OpenMP] Emit aggregate kernel prototypes and remove libffi dependency (#186261)
Summary:
This PR changes the handling of the emitted kernels when targeting a CPU
to be a pointer struct.
The old handling emitted a standard function prototype, this
necessitated a target specific ABI to call it because the signature
differed with the number of arguments. Instead, this PR emits a void
pointer to a naturally aligned struct, this is what APIs like `pthreads`
assert.
This allows us to remove all the complexity around launching host
kernels and just pass the argument list.