# Executable trust

---

# Executable trust

_Peios Kernel / Internals / KACS / Executable trust_

> Find the Peios kernel articles about executable trust.

Use these articles to understand executable trust in the Peios kernel.

- [Signature verification](</kernel/internals/kacs/executable-trust/signature-verification.md>)
- [Exec and library integrity](</kernel/internals/kacs/executable-trust/exec-and-library-integrity.md>)
- [Firmware verification](</kernel/internals/kacs/executable-trust/firmware-verification.md>)
- [Process integrity protection](</kernel/internals/kacs/executable-trust/process-integrity-protection.md>)

---

# Signature verification

_Peios Kernel / Internals / KACS / Executable trust_

> Signature verification: behaviour and implementation of the Peios kernel.

<a id="trm-3-6"></a>

Binary signing is the foundation of PIP trust determination and of
Library Signature Verification. The kernel verifies cryptographic
signatures on executable files to establish their trust level, and
signing is the *only* mechanism by which a binary acquires PIP
protection — there is no runtime API that can confer it.

This section describes verification. The signature format itself, and
what a signer has to produce, are specified in PSPK's Binary Signing
and PIP chapter. The kernel only ever verifies; it holds no private
key and contains no signing primitive.

<a id="trm-3-6-1"></a>

## The key table

The kernel carries its verification keys in a dedicated data section
of the kernel image, as an array of 1960-byte entries — a raw
1952-byte ML-DSA-65 public key, then a `u32` little-endian PIP type,
then a `u32` little-endian PIP trust — terminated by an all-zero
entry. <a id="cite-sig.key-table.entry-layout"></a>

Before any cryptographic work, the whole table is walked and
validated. A table with no all-zero terminator is rejected with
`EINVAL`, and so is a table containing any entry whose tier is not
exactly Protected (512) with `PeiosTcb` trust (8192). <a id="cite-sig.key-table.validation-einval"></a> Both rejections
fail *every* verification on the system, which is what makes the
single-tier constraint absolute rather than conventional: a key at any
other tier does not merely fail to be honoured, it disables signing
entirely. <a id="cite-sig.key-table.invalid-disables-all"></a>

The consequence is that a verified binary is always Protected/8192. <a id="cite-sig.verified-always-protected-tcb"></a>
The Isolated type (1024) is reserved and unreachable, and the
multi-key, multi-tier model the table layout anticipates would need a
change to the validator, not merely an added key. <a id="cite-sig.isolated-type-unreachable"></a>

A build configured for KUnit compiles in a different, hard-coded key
at the same tier, taken from the test vector header. <a id="cite-sig.kunit-test-key"></a> Such a kernel
trusts a publicly known key.

`/sys/kernel/security/kacs/signing_keys` lists the table: one line for
each entry before the terminator, in table order, reading

```
key_sha256=<hex> pip_type=<u32> pip_trust=<u32>
```

where the key is named by the SHA-256 of its raw 1952-byte public key, in
lowercase hexadecimal, and the type and trust are the entry's own, in
decimal. <a id="cite-sig.key-table.securityfs-listing"></a> Entries are listed as they
are, whether or not the validator would accept them, so a table that
disables signing shows why. The keys are public, so reading the file is
not access-checked; whoever can open it can read it. Like every
securityfs object, it can be opened only once the mount has a
synthesising policy, which on Peios lets Authenticated Users in.
<a id="cite-sig.key-table.securityfs-unchecked"></a>

<a id="trm-3-6-2"></a>

## Finding a signature

Verification begins by recording the file's current size. Everything
that follows is bounded by that snapshot, and the size is re-read
before the attempt returns — a file that changed size mid-verification
invalidates the whole result. <a id="cite-sig.size-snapshot-revalidated"></a>

The first four bytes decide the path. A file matching `\x7fELF` takes
the ELF path; a file shorter than four bytes, or with different magic,
goes straight to the xattr. <a id="cite-sig.magic-selects-path"></a>

On the ELF path the kernel parses the header, locates the section
header table and the section-name string table, and scans sections in
index order for one named exactly `.peios.sig`. The match is over all
eleven bytes including the terminating NUL, so a longer name with that
prefix does not match. <a id="cite-sig.elf.section-name-exact-match"></a>

**Finding the section commits the ELF path.** The moment a section
header with that name is found, the xattr is no longer consulted —
whatever happens next. <a id="cite-sig.elf.section-commits-path"></a> A wrong section type, a size other than 3310, a
range outside the file, an allocation failure, a short read, a bad
version byte, or a hash failure all yield "unsigned" rather than
falling back. <a id="cite-sig.elf.section-failures-yield-unsigned"></a> This is deliberate: without it, an attacker could craft
a malformed ELF section to force fallback to whichever path they could
more easily control.

Several *structural* ELF failures commit the path too, before any
`.peios.sig` section has been seen: a file shorter than an ELF header,
a class other than `ELFCLASS64`, a byte order other than little-endian,
an unexpected ELF version, a section header entry size other than 64,
an absent or out-of-range section-name string table index, and a
section header table or string table lying outside the recorded size. <a id="cite-sig.elf.structural-failures-commit"></a>
A 32-bit or big-endian ELF therefore cannot carry an xattr signature
at all — it is committed to the ELF path and then fails on it. The one
structural case that does *not* commit is `e_shnum == 0`, so an ELF
with no section headers falls through to the xattr normally. <a id="cite-sig.elf.no-section-headers-falls-through"></a>

The xattr path reads `security.peios.sig` and requires exactly 3310
bytes; any other size is treated as unsigned. <a id="cite-sig.xattr.exact-size"></a> The read bypasses the
LSM xattr hooks, so FACS does not mediate the verifier's own read of
the signature. <a id="cite-sig.xattr.read-bypasses-lsm-hooks"></a>

<a id="trm-3-6-3"></a>

## Hashing and verification

The message signed is a 32-byte SHA-256 content hash, computed
differently depending on where the signature was found. For an ELF
section source, the hash covers the file with the section's *contents*
replaced by zeros — the `Elf64_Shdr` entry describing it is hashed
verbatim, along with everything else. <a id="cite-sig.hash.elf-section-zeroed"></a> For an xattr source the hash
covers the entire file with no exclusions, and that applies to ELF
files reaching the xattr path as well as to non-ELF ones. <a id="cite-sig.hash.xattr-covers-whole-file"></a> Hashing
proceeds in 4 KB chunks, with the zero run emitted in
`SHA256_BLOCK_SIZE` pieces.

The kernel then verifies the 3309-byte signature against each key in
the table, in order, returning on the first success. <a id="cite-sig.verify.exhaustive-trial-in-order"></a> There is no key
identifier in the blob, so key selection is exhaustive trial and the
cost is one ML-DSA verification per key. The trust tier is a property
of *which key verified*, never of anything the signer encoded. <a id="cite-sig.tier-from-key-not-blob"></a>

Verification uses the kernel crypto signature API with the `mldsa65`
algorithm. That API exposes no context parameter, so the empty FIPS
204 context is structurally guaranteed rather than checked — a
signature made under a non-empty context simply fails to verify. <a id="cite-sig.empty-fips204-context"></a>

<a id="trm-3-6-3-1"></a>

### When verification cannot be performed

"Did not verify" and "could not be verified" are different answers and
are kept apart. The per-key verifier is tri-state: verified, did not
verify, or a negative errno meaning the check could not be made — an
unavailable ML-DSA transform, or a key the transform will not accept. <a id="cite-sig.verifier.tri-state"></a>

A negative stops the search rather than trying the remaining keys: the
failure is in the machinery, and every remaining key would meet the same
one. It then propagates out of the exec path, which **refuses the exec**
with `EACCES`. <a id="cite-sig.unverifiable.exec-eacces"></a>

That asymmetry with the ordinary unsigned path is the point. An unsigned
binary runs with no integrity label, which is legitimate. Treating an
unverifiable one the same way removes PIP from every process the system
executes, and the result is indistinguishable from a correctly working
system that has no signed binaries — so nothing surfaces it until
signing is deployed, at which point it looks like the signing rollout
broke something.

On the LSV path the same condition denies the mapping, which already
fails closed. <a id="cite-sig.unverifiable.lsv-denies"></a>

<a id="trm-3-6-3-2"></a>

### The boot-time probe <a id="cite-sig.boot-probe"></a>

A `late_initcall` allocates the transform once and, if it cannot,
emits `pr_err` and a `kacs.signature.crypto.failed` KMES event
carrying `signature.crypto-stage` `boot-probe` and the error as
`outcome.errno`, negative. The condition is then visible at boot rather than
inferred from every process running without an integrity label.

It cannot refuse to start, and two things rule that out rather than one:

- At LSM init the algorithm is not yet registered, so `crypto_alloc_sig`
  returns `ENOENT` on every boot. A probe there would fire always.
- A non-zero return from an LSM's init function is only `WARN`'d
  (`security/lsm_init.c`, `lsm_init_single`). The hooks are never added,
  so "refuse to initialise" means running with no KACS at all — worse
  than the failure it would be preventing.

Enforcement therefore lives at exec, where refusing one exec is
recoverable in a way losing the integrity boundary is not.

The probe is not `IS_ENABLED(CONFIG_CRYPTO_MLDSA)`. That option is an
unconditional `select` under `SECURITY_PKM`, which is a `bool`, so a
config test would always pass and catch nothing. Only calling the
allocator sees the ordering failure.

<a id="trm-3-6-8"></a>

## Revocation <a id="cite-sig.no-revocation"></a>

There is none. A signed binary later found to be malicious cannot be
invalidated short of removing it from the filesystem or replacing the
kernel image with a different key. No hash blocklist, no per-key
revocation, and no revocation state of any kind exists.

## Related explanations

- [Exec and library integrity](</kernel/internals/kacs/executable-trust/exec-and-library-integrity.md>)
- [Firmware verification](</kernel/internals/kacs/executable-trust/firmware-verification.md>)

---

# Exec and library integrity

_Peios Kernel / Internals / KACS / Executable trust_

> Exec and library integrity: behaviour and implementation of the Peios kernel.

<a id="trm-3-6-4"></a>

## PIP determination at exec

At `execve()` the kernel looks up and verifies the signature as above.
A verified binary takes `pip_type` and `pip_trust` from the matched
key; no signature, an invalid or unstable one, a bad signature, or no
matching key all yield None/0. <a id="cite-sig.exec.tier-from-matched-key"></a>

**Exec proceeds in every case where the question could be answered.** <a id="cite-sig.exec.proceeds-regardless"></a>
PIP is additive protection, not an execution gate: it determines trust
level, not permission to run. The one exception is a signature that
could not be verified at all, described above, which refuses the exec —
because there the question was not answered, so there is no basis on
which to assign a trust level. An
attacker who replaces a signed binary's signature with garbage costs
it PIP protection but can still execute it, subject to FACS. The
asymmetry with LSV — which *does* block unsigned libraries — is
intentional. Exec is permissive; `mmap(PROT_EXEC)` is restrictive.

Determination is transactional with exec success, in three phases. The
pending value is cleared at the top of every `bprm_creds_from_file`
invocation, staged into the task's security blob, and committed to the
process state only from `bprm_committed_creds`. <a id="cite-sig.exec.stage-then-commit"></a> An exec that fails
between staging and commit leaves the process state untouched, and the
stale pending value is cleared by the next exec or at task teardown. <a id="cite-sig.exec.failed-exec-leaves-state"></a>

Because the hook fires once per binfmt iteration and each iteration
re-stages, a `#!` script's PIP comes from the **interpreter** — the
last file processed — not from the script. <a id="cite-sig.exec.shebang-takes-interpreter"></a> A TCB-signed interpreter
runs at TCB level whatever script it executes. Symlinks need no
special handling either: the LSM hooks receive the already-resolved
target file, so a symlink inherits its target's level by construction. <a id="cite-sig.exec.symlink-resolves-to-target"></a>

Once committed, the values are fixed for the lifetime of the process
image, inherited at fork, and re-derived at the child's exec. <a id="cite-sig.exec.fixed-and-inherited"></a>

<a id="trm-3-6-5"></a>

## Content pinning

A binary that verifies to a nonzero tier has its backing inode pinned
as KACS-verified executable content before the exec result is
committed, and LSV pins on success too, before allowing the mapping. <a id="cite-sig.pin.on-verified-exec-and-lsv"></a>
Pinning closes the gap between verifying one byte image and modifying
the same inode afterwards.

If pinning fails at exec, the PIP result is **downgraded to None/0**
rather than the exec being failed or the tier being kept — the process
runs unprotected. <a id="cite-sig.pin.failure-downgrades-to-none"></a> Under LSV a pin failure denies the mapping instead. <a id="cite-sig.pin.failure-denies-lsv-mapping"></a>

A pinned inode rejects in-place content mutation even when the size
would be preserved: ordinary, positioned and append writes;
`ftruncate()` and pathname `truncate()`; and every `fallocate` mode,
including allocation-only ones, because the pin check runs before and
independently of the mode-support test. <a id="cite-sig.pin.rejects-content-mutation"></a> File ioctls that mutate
content, ranges, or allocation are rejected, and so are ioctls the
kernel cannot classify — unknown ioctls fail closed on a pinned inode. <a id="cite-sig.pin.unknown-ioctl-fails-closed"></a>
Mutation or removal of the `security.peios.sig` xattr is rejected as
well. <a id="cite-sig.pin.rejects-sig-xattr-mutation"></a>

The pin is conservative and one-way. It is set once and cleared only
when the inode is allocated or freed, never while the inode is live. <a id="cite-sig.pin.cleared-only-at-inode-lifecycle"></a>
Updating verified executable content therefore means replacing the
inode — write a new file and `rename()` over it — rather than
modifying it in place.

Unsigned, invalid, unstable, bad-signature and no-match attempts never
pin. <a id="cite-sig.pin.only-on-verified"></a>

<a id="trm-3-6-6"></a>

## Library Signature Verification

With the `lsv` mitigation enabled, `mmap()` with `PROT_EXEC` on a
file-backed mapping verifies the backing file. An unsigned file, an
invalid or unstable one, a bad signature, or no matching key all deny
the mapping with `EACCES`. <a id="cite-sig.lsv.denies-unsigned-eacces"></a> On success the library's tier is compared
against the loading process's: the image has to dominate the process,
so a Protected/PeiosTcb process can load only PeiosTcb-or-above
libraries. <a id="cite-sig.lsv.image-must-dominate-process"></a> With one key in the table this reduces to "is it signed
with the TCB key?"

The hash covers the **entire file**, not the mapped region — the whole
file is read and hashed even when only part of it is being mapped, so
the signature covers code in sections this particular mapping does not
touch. <a id="cite-sig.lsv.hashes-whole-file"></a>

`mprotect()` adding `PROT_EXEC` to a mapping that was not already
executable runs the same checks in a fixed order: WXP, then TLP, then
LSV. <a id="cite-sig.lsv.mprotect-check-order"></a> Anonymous mappings have neither a path nor a signature, so TLP
and LSV skip them and only WXP applies. <a id="cite-sig.lsv.anonymous-skips-tlp-lsv"></a>

Enabling `lsv` on a running process also re-validates its existing
executable mappings before the bit is committed ([PSB Fields](</kernel/internals/kacs/process-security/psb-fields.md#trm-3-3-2>)), so the
mitigation cannot be turned on over already-mapped unsigned code.

<a id="trm-3-6-9"></a>

## Interaction with other mechanisms

**WXP** is orthogonal: it prevents pages being writable and executable
at once, while LSV prevents unsigned executable pages. A process with
both can execute only signed code in read-only pages.

**FACS** runs independently. A signed binary in a directory the caller
cannot reach is still unreachable — the open is denied before signing
is consulted. <a id="cite-sig.facs.open-denied-before-signing"></a> Signing determines the PIP level of a binary that is
already being executed; it never grants access to one.

**PIP object protection** consumes the result: once a process carries
a tier from its binary's signature, trust labels on objects are
enforced through the AccessCheck pipeline against the `pip_type` and
`pip_trust` held in the PSB ([Process Integrity Protection](</kernel/internals/kacs/executable-trust/process-integrity-protection.md#trm-3-7>)).

---

# Firmware verification

_Peios Kernel / Internals / KACS / Executable trust_

> Firmware verification: behaviour and implementation of the Peios kernel.

<a id="trm-3-6-7"></a>

## Firmware verification

A firmware load is not an exec, so none of the above would see it —
and firmware is code that runs on a device with DMA into host memory,
which makes a tampered blob a complete compromise. KACS therefore
implements the `kernel_read_file` and `kernel_post_read_file` LSM
hooks for `READING_FIRMWARE` (`security/pkm/kacs/firmware.c`).

The signature is the ordinary PIP blob, found by the lookup above.
Firmware is never ELF, so in practice it is the `security.peios.sig`
xattr, which `peipkg` stamps at install from the `<file>.peios.sig`
sidecar the package carries ([PSPU payload entries](https://learn.peios.org/specifications/pspu/package-format-and-repository-protocol/payload-entries)). The bar is the **PeiosTcb**
tier — the same floor a usermodehelper exec must clear, since both are
the kernel choosing to run code it did not ship. A verified signature
at any other tier counts as no signature. <a id="cite-sig.firmware.peiostcb-floor"></a>

For a whole-file read, which is the common case, the post-read hook is
handed the exact bytes the loader will decompress and give to the
device, and those are what is hashed — no second read, no TOCTOU. <a id="cite-sig.firmware.post-read-hashes-loaded-bytes"></a> A
partial read (a driver pulling a window out of a large blob) only
passes through the pre-read hook, where nothing has been read yet, so
that path verifies the file through the reader probe instead. <a id="cite-sig.firmware.partial-read-uses-probe"></a> The
hash covers the compressed bytes as they sit on disk, so verification
precedes decompression. <a id="cite-sig.firmware.hashes-compressed-bytes"></a>

Policy is `CONFIG_SECURITY_PKM_FIRMWARE_SIG_ENFORCE`, overridable for
one boot with `kacs_fwsig=enforce` or `kacs_fwsig=log` on the kernel
command line; there is no runtime switch. <a id="cite-sig.firmware.cmdline-override"></a> Under `enforce` an unsigned,
tampered or under-tier file is refused with `-EPERM`; the loader logs
that against the path it was refused at, moves on to its remaining
search paths, and reports the driver an ordinary load failure. <a id="cite-sig.firmware.enforce-eperm"></a> Under `log` the
verdict goes to a rate-limited warning and the `kacs:kacs_firmware_load`
tracepoint and the load proceeds. <a id="cite-sig.firmware.log-mode"></a> **2026.8 ships in log mode**: the
firmware set is being signed for the first time, and a blob the
packaging missed has to show up as a warning rather than as a device
that silently stops probing. <a id="cite-sig.firmware.default-is-log"></a> Enforcement becomes the default once a
release has run clean.

`CONFIG_FW_UPLOAD` — a device's own sysfs update interface — is not
covered; it is `select`ed by several drivers and cannot be turned off,
and the drivers that expose it are the place to gate it if that ever
matters. The `test.fwsig` build stage exercises both modes through
`CONFIG_TEST_FIRMWARE`'s `trigger_request`, which pulls a named file
through the real loader path with no hardware.

---

# Process integrity protection

_Peios Kernel / Internals / KACS / Executable trust_

> PIP protects objects through trust label ACEs and processes through a dominance test — where it is enforced, and the limits of what it can do.

<a id="trm-3-7"></a>

PIP protects **objects** from insufficiently trusted processes through
trust label ACEs evaluated inside AccessCheck ([PIP in AccessCheck](</kernel/internals/kacs/access-check/pip-in-accesscheck.md#trm-3-8-7>)). It also
protects **processes** — their memory, their execution, their metadata
— from other processes, which is what this section covers.

Every process-to-process operation passes two independent checks, and
both have to succeed. <a id="cite-pip.two-checks-both-required"></a>

The **process descriptor check** is an ordinary AccessCheck of the
caller's token against the target's process descriptor ([Process Security Descriptors](</kernel/internals/kacs/process-security/process-security-descriptors.md#trm-3-3-3>)). It
answers *who* may operate on the process, and it is where per-operation
granularity lives — different rights for signals, memory, and
metadata.

The **PIP dominance check** is a direct comparison of the two
processes' PSB fields. It answers *what trust level is required*. It
does not use AccessCheck, does not read a descriptor, and does not
involve the DACL pipeline at all: it is a standalone arithmetic test. <a id="cite-pip.dominance-independent-of-descriptor"></a>

The two are complementary. Object PIP protection stops a non-dominant
process opening authd's private key file; process PIP protection stops
the same process reading the key straight out of authd's memory with
ptrace, or killing authd with a signal.

<a id="trm-3-7-1"></a>

## The dominance test <a id="cite-pip.dominance-both-axes"></a>

```
pip_dominates(caller_psb, target_psb) -> bool:
    if target_psb.pip_type == None:
        return true   // Unprotected target — any caller dominates.
    return caller_psb.pip_type  >= target_psb.pip_type
       AND caller_psb.pip_trust >= target_psb.pip_trust
```

Both axes are plain unsigned integers compared numerically, not closed
enumerations — the dominance layer would happily order tiers the
signing layer cannot currently produce ([PSB Fields](</kernel/internals/kacs/process-security/psb-fields.md#trm-3-3-2>)). The early return for
an unprotected target is what keeps ordinary processes universally
accessible whatever trust values a caller happens to carry. <a id="cite-pip.unprotected-target-always-dominated"></a>

Dominance is binary. A caller that does not dominate has no process
access at all, whichever operation was attempted; the descriptor
provides the granularity and PIP is the all-or-nothing gate above it. <a id="cite-pip.dominance-is-all-or-nothing"></a>

That asymmetry with the object model is deliberate. Object access has
natural categories — read, write, execute. Process access does not: a
caller that can ptrace a process can read its memory, inject code, and
effectively become it. Partial process access is not a meaningful
boundary.

<a id="trm-3-7-2"></a>

## SeDebugPrivilege <a id="cite-pip.sedebug-bypasses-descriptor-only"></a>

`SeDebugPrivilege` bypasses the descriptor check and never the
dominance check. This holds at every enforcement point, and it is
enforced structurally in two independent places: inside the descriptor
evaluation a PIP-label denial short-circuits *before* the debug
rescue is reached, and the standalone dominance test runs afterwards
with no privilege escape of any kind.

<a id="trm-3-7-3"></a>

## Where dominance is enforced

**ptrace**, in every mode. A single successful attach is equivalent to
full compromise of the target — read and write memory and registers,
single-step, inject signals, redirect execution — so a non-dominant
caller is refused whatever the mode. <a id="cite-pip.ptrace.all-modes"></a> The Linux `__ptrace_may_access`
path is patched to return the LSM's answer directly, so native UID and
capability rules no longer grant where KACS denies. <a id="cite-pip.ptrace.lsm-answer-final"></a> Direct memory
access through `/proc/<pid>/mem`, `process_vm_readv` and
`process_vm_writev` routes through the same check, so one hook covers
every memory-access vector. <a id="cite-pip.ptrace.covers-memory-vectors"></a> This is what makes in-memory secrets
genuinely unreachable: a compromised administrator cannot read an
HSM daemon's key material out of its address space.

`PTRACE_TRACEME` inverts the roles — the nominated tracer is the
subject and the caller is the target — and requires `PROCESS_VM_WRITE`
on the caller's own descriptor plus dominance by the nominated tracer. <a id="cite-pip.ptrace.traceme-inverted"></a>

Mode combinations are validated: the mutually exclusive
`PIDFD_OPEN`, `GETFD` and `PROC_QUERY` flags cannot be combined, and a
request that is neither a read nor an attach, or claims to be both, is
rejected as malformed. <a id="cite-pip.ptrace.mode-combinations-rejected"></a>

**Signal delivery**, uniformly regardless of signal type. <a id="cite-pip.signal.uniform-all-types"></a> Lifecycle
management of PIP-protected processes therefore has to go through a
process that dominates them — in practice peinit, which runs at the
highest tier.

Signalling within the same process security state is not a boundary
operation, and the exemption is **structural**: it is a pointer
comparison of the two processes' security state, tested before any
descriptor or dominance evaluation. <a id="cite-pip.signal.same-security-state-exempt"></a> It does not depend on the default
descriptor's self ACE, which is what makes `raise()`, `abort()` and
`pthread_kill()` work for restricted and confined tokens whose
AccessCheck against their own descriptor would fail. <a id="cite-pip.signal.self-signals-work-for-restricted"></a>

Multi-target sends are evaluated per target by Linux's own iteration,
so the signal reaches the permitted subset and the call succeeds if at
least one delivery happened. <a id="cite-pip.signal.multi-target-partial-success"></a> POSIX's same-session `SIGCONT` exception
is deliberately absent — the patched `check_kill_permission` returns
the KACS answer before reaching the switch that carried it — so
`SIGCONT` needs `PROCESS_SUSPEND_RESUME` plus dominance like every
other job-control signal, whatever the session. <a id="cite-pip.signal.sigcont-no-session-exception"></a>

Kernel-originated signals bypass the whole check, as described in
[Process Security Descriptors](</kernel/internals/kacs/process-security/process-security-descriptors.md#trm-3-3-3>).

**`pidfd_open()`**, a boundary information query rather than a memory
or attach operation, needs `PROCESS_QUERY_LIMITED` plus dominance. <a id="cite-pip.pidfd-open.query-limited"></a>
**`pidfd_getfd()`** maps to `PROCESS_DUP_HANDLE` plus dominance —
extracting a descriptor from another process is a boundary crossing in
its own right. <a id="cite-pip.pidfd-getfd.dup-handle"></a>

**`/proc` metadata.** Entries that are already ptrace-gated or
memory-open-gated are covered automatically by the ptrace hook. The
rest would leak information about a protected process, so the
non-ptrace-gated entries carry their own descriptor requirement plus
dominance; [Process Security Descriptors](</kernel/internals/kacs/process-security/process-security-descriptors.md#trm-3-3-3>) gives the mapping. <a id="cite-pip.proc.metadata-needs-descriptor-and-dominance"></a> The one exception is
`/proc/<pid>/psb`, which needs `PROCESS_QUERY_LIMITED` and no
dominance: a protected process's PIP type, trust and mitigations are
readable to whoever its descriptor lets query it ([PSB Fields](</kernel/internals/kacs/process-security/psb-fields.md#trm-3-3-2>)). <a id="cite-pip.proc.psb-exempt-from-dominance"></a> Entries stricter than a metadata
query, such as `/proc/<pid>/stack`, keep their native hardening and
are not brought under the metadata rule. <a id="cite-pip.proc.stricter-entries-keep-native"></a>

Denying access prevents reading inside `/proc/<pid>/` but does not
hide the PID: the directory name is still visible through `getdents`. <a id="cite-pip.proc.pid-visible-not-hidden"></a>
Visible-but-inaccessible is the accepted position.

`/proc` is not FACS-managed — it is a virtual filesystem with no
backing store and no xattrs — so enforcement there happens through
direct kernel checks rather than an object-backed FACS path.

**Capability metadata.** `capget()` on the current process, or on a
thread sharing its security state, is not a boundary operation. <a id="cite-pip.capget.self-and-sibling-exempt"></a>
Against another process it is a detailed information query needing
`PROCESS_QUERY_INFORMATION` plus dominance. <a id="cite-pip.capget.cross-process-query-information"></a>

**Resource limits, scheduler and placement.** Read-only `prlimit`
needs `PROCESS_QUERY_INFORMATION` plus dominance; a limit change needs
`PROCESS_SET_INFORMATION` plus dominance. <a id="cite-pip.prlimit.read-and-change"></a>

- `setpgid()` needs `PROCESS_SET_INFORMATION`; <a id="cite-pip.setpgid.set-information"></a>
- `getpgid()` and `getsid()` need `PROCESS_QUERY_LIMITED`; <a id="cite-pip.getpgid-getsid.query-limited"></a>
- the scheduler, affinity and I/O priority queries need
  `PROCESS_QUERY_INFORMATION`; <a id="cite-pip.sched-queries.query-information"></a>
- and the memory-placement mutations Linux routes through
  `task_movememory` need `PROCESS_SET_INFORMATION`. <a id="cite-pip.movememory.set-information"></a>

Setting nice, scheduler parameters and I/O priority all need
`PROCESS_SET_INFORMATION` too. <a id="cite-pip.sched-set.set-information"></a> Self-directed
versions of all of these are not boundary operations and skip both
checks. <a id="cite-pip.self-directed-skips-checks"></a>

**CPU affinity** is per-thread, so changing the caller's own thread or
a sibling in the same process is not a boundary operation. <a id="cite-pip.affinity.same-process-not-boundary"></a> Changing a
thread in a *different* process needs `PROCESS_SET_INFORMATION` plus
dominance plus `SeIncreaseBasePriorityPrivilege` — and the privilege
is checked and marked used *before* the descriptor and dominance call,
so the `SeDebugPrivilege` rescue cannot substitute for it. <a id="cite-pip.affinity.cross-process-privilege-first"></a> KACS does
not relax the kernel's native affinity validity rules: an invalid or
disallowed mask still fails. <a id="cite-pip.affinity.native-validity-preserved"></a>

**Token opens.** `kacs_open_process_token` and
`kacs_open_thread_token` need `PROCESS_QUERY_INFORMATION` plus
dominance. <a id="cite-pip.token-open.query-information"></a> Reading a process's security identity is as sensitive as
reading its memory.

**Performance monitoring.** Target-specific `perf_event_open()` on
another process can leak execution timing, branch prediction
behaviour, cache access patterns and instruction traces — side
channels that reveal cryptographic keys. It needs
`SeProfileSingleProcessPrivilege` plus `PROCESS_QUERY_INFORMATION`
plus dominance, with the privilege again checked first so the debug
rescue cannot stand in for it. <a id="cite-pip.perf.target-specific-requirements"></a> Own-task profiling is not a boundary
operation and needs no privilege. <a id="cite-pip.perf.own-task-exempt"></a> System-wide profiling, `pid == -1`,
samples every task on a CPU including protected ones, so it needs the
operator-class `SeSystemProfilePrivilege`. <a id="cite-pip.perf.system-wide-privilege"></a> Cgroup perf mode stays
under Linux's native model. <a id="cite-pip.perf.cgroup-native"></a> Because the target task is resolved after
the stock `security_perf_event_open` hook fires, this rule is enforced
through a target-resolved syscall patch rather than that hook — there
is no `security_perf_event_open` registration at all.

<a id="trm-3-7-4"></a>

## The PeiosTcb floor on kernel-initiated execs

One place PIP gates execution rather than merely labelling it. It is
not a dominance test — there is no caller to compare against — but a
threshold: a binary the kernel execs *on its own behalf* must carry at
least PeiosTcb trust, or the exec fails with `EACCES`. <a id="cite-pip.umh.peiostcb-floor"></a>

The case that motivates it is `request_module()`. When the kernel needs
a module it does not have — `get_fs_type()` on a mount, `socket()` for
an unknown protocol family, the crypto API resolving a name — it spawns
`CONFIG_MODPROBE_PATH` as a usermode helper and runs it at the kernel's
own authority. That path is a writable sysctl, which makes redirecting
`/proc/sys/kernel/modprobe` a classic escalation: point it somewhere
attacker-controlled and the next module request executes it with the
kernel behind it. The floor makes the redirection worthless on its own,
because the attacker would also have to produce a TCB-signed binary.

This is the only exec KACS refuses on integrity grounds. Everywhere
else an unsigned binary runs and simply carries no tier, because a
requesting process's own authority bounds what it can do. A
kernel-initiated exec has no such process behind it, so there is no
lesser authority to fall back to.

The floor also refuses when no tier could be derived at all, not only
when one was derived and graded too low. <a id="cite-pip.umh.refuses-underivable-tier"></a> Treating "could not establish
trust" differently from "is not trusted" would leave the check
bypassable by whatever prevented the derivation from running.

Nothing upstream identifies such an exec by the time the LSM sees it.
The helper child is created by `user_mode_thread()`, so it never
carries `PF_KTHREAD` — `kernel_execve()` rejects kernel threads
outright — and `security_kernel_module_request()` fires in the
*requesting* task, before the child exists. So `kernel/umh.c` is
patched to mark the child after `commit_creds()` and before
`kernel_execve()`, and the mark is read in the `bprm_creds_from_file`
hook. It lives in the KACS task blob rather than costing a
`task_struct` flag.

The mark is never cleared. A helper that re-execs — an interpreter for
a `#!` helper — stays under the floor rather than escaping it on the
second exec; the task exists only to be that helper. <a id="cite-pip.umh.mark-never-cleared"></a>

A refusal emits `kacs_exec` with reason `umh-not-tcb`, so it is
visible rather than presenting as an unexplained module-load failure. <a id="cite-pip.umh.audit-reason"></a>

<a id="trm-3-7-5"></a>

## Trust raising under a tracer or supervisor

Dominance is tested when a tracer attaches and when a seccomp filter is
installed, and not again. <a id="cite-pip.unsafe.dominance-tested-at-attach-only"></a> That leaves one way to end up controlling a
process one does not dominate: be attached to it, or supervising its
syscalls through seccomp user notification, when it execs a binary
whose signature would raise its label. Linux marks exactly these execs
— `LSM_UNSAFE_PTRACE` when the task is traced, `LSM_UNSAFE_NO_NEW_PRIVS`
under `no_new_privs`, which every unprivileged seccomp filter requires
— and uses them to withhold setuid gains. KACS applies the same rule to
the label: the exec goes ahead, but the staged label is **capped at
the process's current one** whenever the new label would not be
dominated by it. <a id="cite-pip.unsafe.label-capped"></a> The binary runs with the protection it can be given,
as a setuid binary runs without its setuid under `strace`.

There is no privilege exception. `SeDebugPrivilege` never bypasses
dominance, and a TCB tracer already dominates every label, so nothing
is lost by capping. An exec that does not raise the label — the common
case, and every unsigned binary — is untouched. <a id="cite-pip.unsafe.non-raising-exec-untouched"></a> A cap emits
`kacs_exec` with reason `pip-capped-unsafe` carrying the label that
was kept. <a id="cite-pip.unsafe.audit-reason"></a>

<a id="trm-3-7-6"></a>

## Raw physical memory

A process able to read `/dev/mem` could map any process's physical
pages and bypass virtual memory protections entirely, PIP included.

The defence is `CONFIG_STRICT_DEVMEM`, which restricts `/dev/mem` to
I/O regions and denies RAM access. It is not merely a recommended
build option: the LSM **refuses to initialise** unless both
`CONFIG_STRICT_DEVMEM` and `CONFIG_MODULE_SIG_FORCE` are enabled, so a
kernel configured without them does not boot with KACS at all. <a id="cite-pip.devmem.required-configs"></a> The
same initialisation gate refuses to coexist with SELinux, AppArmor,
Smack, TOMOYO or the BPF LSM. <a id="cite-pip.init.refuses-other-lsms"></a>

Placing a restrictive descriptor on `/dev/mem` and `/dev/kmem` as a
secondary defence is not implemented; nothing in the kernel handles
those paths specially. <a id="cite-pip.devmem.no-descriptor-protection"></a>

<a id="trm-3-7-7"></a>

## Limits of the guarantee

PIP operates inside the kernel's trust boundary, and three things sit
outside it.

**Kernel compromise.** A loaded module runs with unrestricted access
to all memory and kernel structures. PIP is enforced by the kernel, so
a compromised kernel voids it, and `SeLoadDriverPrivilege` is the
ceiling of every guarantee here. `CONFIG_MODULE_SIG_FORCE` is
hard-required as noted above, and module signing is itself ML-DSA-65.
Stripping `SeLoadDriverPrivilege` from every token but peinit's and the
device manager's is the other half of that defence, and is policy
rather than kernel behaviour — nothing in the kernel strips it. The
device manager holds it because loading drivers for the hardware that
appears is its job; module signature enforcement is what keeps the
privilege from meaning more than "load a module Peios built".

**Hardware access.** DMA-capable devices read and write physical
memory directly, bypassing the CPU's virtual memory system. An IOMMU
mitigates this, and configuring one is a kernel responsibility outside
KACS.

**Hypervisor-level isolation.** PIP does not offer guarantees
equivalent to hypervisor-based memory isolation. The threat model
ceiling is a non-compromised kernel.

<a id="trm-3-7-8"></a>

## Impersonation

PIP reads the PSB, never the effective token. A Protected service
impersonating a client still evaluates its own PSB for every process
boundary check, so the client's identity has no bearing on it. <a id="cite-pip.impersonation.reads-psb-not-token"></a> In the
other direction, an unprotected process impersonating a token created
for a protected one gains nothing — its PSB is still None. Since
nothing constrains the PIP dimensions the way the integrity ceiling
constrains impersonation ([Impersonation Lifecycle](</kernel/internals/kacs/impersonation/state-transitions.md#trm-3-5-3>)), the PSB is the only safe source.

<a id="trm-3-7-9"></a>

## Coredumps

A crashing PIP-protected process is a potential secret leak, so its
dumps must not be readable by non-dominant processes.

The implemented strategy is to disable them: a process with a nonzero
`pip_type` has its dumpable flag cleared at exec, and
`prctl(PR_SET_DUMPABLE, 1)` is refused for as long as the process
remains protected. <a id="cite-pip.coredump.disabled-for-protected"></a> Requests that keep or make it non-dumpable are
allowed, and no alternative dumpable-setting path is left ungated. <a id="cite-pip.coredump.non-dumpable-requests-allowed"></a> If
a later exec assigns None/0, normal Linux exec-time dumpability rules
apply to the new image. <a id="cite-pip.coredump.unprotected-exec-restores-rules"></a>

The alternative — a signed, high-trust crash handler receiving dump
data from the kernel and writing it under a restrictive descriptor, so
that diagnostics survive without bypassing isolation — is not
implemented. <a id="cite-pip.coredump.no-crash-handler"></a> The two are not mutually exclusive; disabling dumps is
the minimum viable position.
