Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios Kernel

Process security

Single-page view · as markdown

Process security

Peios Kernel / Internals / KACS / Process security

Use these articles to understand process security in the Peios kernel.

  • State and lifetime
  • PSB Fields
  • Process Security Descriptors

State and lifetime

Peios Kernel / Internals / KACS / Process security

The Process Security Block is a per-process structure carrying properties that describe what the process is, independent of the principal running it.

Its PIP identity fields, pip_type and pip_trust, are determined by the binary loaded at exec (Binary Signature Verification). Its other fields — process mitigations and process restrictions — are process policy, set by whoever launches the process. Neither category is token identity, and neither is determined by the principal.

Keeping the PSB separate from the token is the point. The token describes identity and travels with impersonation: when a thread impersonates a client, the effective token changes. The PSB describes the process, and impersonation never touches it.

The PSB is never affected by impersonation. Impersonation changes who the thread is acting as. It does not change what the process is.

The canonical PSB reference lives on the task's LSM security blob, task_struct->security, separate from the credential that holds the token pointer. A mirrored, non-authoritative reference is also kept in credential security blobs, for the benefit of Linux hooks that receive only a credential. For any task-attached credential that mirror refers to the same PSB as the task blob, and it never defines a different process identity.

Credentials are swapped during impersonation, and that swap may change the credential's token pointer — but the canonical PSB is untouched and any credential-level mirror continues to refer to it.

Fork #

The child receives a copy of the parent's PSB with a single exception: process_guid is not copied, and the child is given a new kernel-generated one. Everything else — the PIP fields, the mitigations, and any active restrictions — is inherited, so a Protected process's children start Protected and PIP propagates across fork.

The child also receives a new default process descriptor. Its owner is the forking thread's primary token's user SID, not the impersonation token's, even when the thread is impersonating at the time. The DACL follows the default template.

Exec #

The PIP fields are reset at exec from the new binary's cryptographic signature. A Protected parent that execs an unsigned binary loses PIP protection: protection follows the binary, not the lineage.

The mitigation flags — lsv, wxp, tlp, cfif, cfib, pie, sml, ui_access — are not reset. They persist across exec unchanged, so a mitigation set between fork and exec survives whatever binary is subsequently loaded. no_child_process persists in the same way: a process restricted from creating children stays restricted no matter what it execs.

process_guid is not reset either, because it identifies the process — the scheduling entity — rather than the binary.

The process descriptor is not reset. Exec preserves it unchanged. It was initialised at fork from the forking thread's primary token and reflects the process creation context, or a later explicit management context, rather than the binary being executed. Primary token installation and the other explicit process-descriptor mutation paths replace or modify it only under their own rules (Token Lifecycle).

Clone with CLONE_THREAD #

Threads share the process's PSB. Thread creation is unaffected by no_child_process, which blocks new processes only.

Relationship to AccessCheck #

The PSB is not an input to AccessCheck in the general case. AccessCheck takes a token and a descriptor and evaluates access; most PSB fields are invisible to it.

PIP is the exception. The pipeline includes a PIP enforcement step reading pip_type and pip_trust, which come from the PSB rather than from any token: the enforcement layer extracts them and passes them to AccessCheck as explicit parameters.

The asymmetry between MIC and PIP follows from that. MIC uses the effective token, so impersonation changes how it evaluates — which is safe because the integrity ceiling on impersonation (Impersonation Gates) prevents escalation. PIP uses the PSB, so impersonation cannot change how it evaluates — necessary because there is no impersonation gate constraining the PIP dimensions, making the PSB the only safe source.

The process mitigations and no_child_process do not interact with AccessCheck at all. Each is enforced at its own enforcement point, independently of the access control pipeline.

PSB Fields

Peios Kernel / Internals / KACS / Process security

Process identity (fixed at fork) #

FieldTypeDescription
process_guidUUID128-bit identifier for this process instance, generated by the kernel at fork and immutable for the process's lifetime. It is not copied from the parent — every process receives a new one. Used by KMES and kernel-internal consumers for identity stamping and event correlation.

The process GUID is distinct from the PID. PIDs are recycled; process GUIDs are unique within a boot, and globally unique in practice. It is the stable correlation key that lets KMES attribute events to a process across its whole lifetime.

Protection (set at exec, fixed) #

FieldTypeDescription
pip_typeu32Process Integrity Protection type. Determined by the binary's cryptographic signature at exec.
pip_trustuintTrust tier within a PIP type; higher values can reach lower ones. Determined by the signer's identity.

PIP fields are signing-based. At exec the kernel verifies the binary's signature and derives both fields from the signer, using the algorithm and key model of Binary Signature Verification.

Both are plain unsigned integers rather than enumerations, and are compared numerically. Three type values are conventional — None (0), Protected (512) and Isolated (1024) — but only two are producible: the key table validator accepts a key only at exactly Protected with PeiosTcb trust (8192) and rejects the whole table otherwise, so Isolated is unreachable and a signed binary is always Protected/8192. Neither None nor Isolated is defined as a named constant in the public ABI at all. The parent process cannot influence the determination at all — even a compromised peinit running as SYSTEM cannot forge PIP protection for an unsigned binary. The public verification key is compiled into the kernel image, and the kernel only ever verifies; it never signs.

This is a deliberate departure from MS-DTYP, where the parent sets a protection level at process creation and the kernel validates the binary's signature against it. Peios removes the parent-controlled half entirely: one input, one answer.

Process mitigations (one-way) #

FieldDescription
lsvLibrary Signature Verification. Only signed shared libraries load. When the process has pip_type != None the library's trust level has to be at or above the process's PIP trust; when pip_type = None any valid signature suffices and trust is not compared.
wxpWrite-XOR-Execute Protection. No page is simultaneously writable and executable; W+X mappings and transitions between writable and executable are rejected.
tlpTrusted Library Paths. Shared libraries load only from approved directory prefixes. Weaker than LSV, since it trusts the path rather than the binary.
cfifForward-Edge Control Flow Integrity. Hardware indirect-branch tracking — Intel IBT, ARM BTI — is locked on and cannot be disabled by the process. Not settable: see below.
cfibBackward-Edge Control Flow Integrity. The hardware shadow stack, Intel CET, is locked on and cannot be disabled by the process.
piePosition-Independent Executable Requirement. Non-PIE binaries are rejected at exec, so that ASLR is actually effective.
smlSpeculation Mitigation Lock. Speculation mitigations are locked on and cannot be disabled by the process.

Mitigations are inherited from the parent at fork and can be set by syscall. They are one-way: once set they are never cleared, and exec does not reset them — a mitigation set by the launcher persists regardless of which binary is loaded.

Do not infer an additional service policy from peinit launch: the source-checked peinit 0.0.12 path does not make a per-service PSB mitigation request. Inherited and self-applied flags are separate from that launcher behavior.

Setting a bit is activation-backed. Before a mitigation bit moves from clear to set, KACS either activates the underlying protection for the target process or verifies that the process already satisfies the invariant. If any requested mitigation cannot be activated or verified, the whole operation fails closed without mutating any bit from that request. Once committed, later operations that would disable the protection or make the process violate the invariant are rejected, and re-requesting an already-set mitigation never weakens what is already committed.

For the runtime memory mitigations, activation covers existing state as well as future transitions. Enabling wxp fails if the process already has a mapping that is simultaneously writable and executable, or otherwise already violates the invariant in a way KACS can observe. Enabling tlp fails if the process already has a file-backed executable mapping whose kernel-resolved path is missing, unresolvable, outside the approved prefix cache, or otherwise TLP-denied. Enabling lsv fails if the process already has a file-backed executable mapping whose signing material is missing, invalid, or below the required PIP trust. Anonymous executable mappings are governed by wxp alone; tlp and lsv apply only to file-backed ones.

For the architecture-backed mitigations, activation goes through the architecture's kernel interface to place the process in the protected state and prevent later process-controlled disablement. Enabling cfif, cfib, or sml fails closed when the platform cannot make the protection true for the target.

sml also accepts a second route: a platform that reports speculation as unconditionally not-affected satisfies activation by that fact alone, with nothing to enable.

cfif cannot currently be committed at all. Activation against a live task returns ENODEV unconditionally, because the kernel exposes no userspace control surface for IBT or BTI, so the bit fails closed on every request. cfib works, through shadow-stack enable-and-lock, with one restriction: enabling it on a task other than the caller fails.

Two mitigations are event-gated rather than retroactive: pie is enforced at subsequent exec and no_child_process at subsequent process creation. They still follow the one-way commit rule, and have to be set before the event they are meant to constrain.

All of this is distinct from PIP. Mitigations are policy set by the launcher; PIP is a property of the binary determined by the kernel.

The mitigations compose deliberately: LSV ensures only signed libraries load, WXP blocks code injection, CFIF blocks forward-edge code reuse through indirect calls and jumps, CFIB blocks return-oriented programming, and PIE makes ASLR effective. Together they make exploitation dramatically harder than any one of them alone.

UI access (one-way) #

FieldDescription
ui_accessPermits interaction with higher-integrity UI elements. Reserved for future desktop functionality. Set by syscall, typically by peinit between fork and exec, and fixed thereafter.

Process restrictions (one-way) #

FieldDescription
no_child_processOnce set, the process creates no child processes — fork, or clone without CLONE_THREAD. New threads are unaffected, and the flag is never cleared.

Unlike the exec-time fields, this one can be set at two points. The parent's code, running in the freshly forked child, can set it before exec, so the new binary loads with the restriction already in place. Or a process can restrict itself at any time during its life — after it has finished spawning its own workers, for instance.

The TLP cache #

The approved directory prefixes for TLP live in a global kernel cache rather than on individual PSBs: the tlp flag decides whether a process is subject to enforcement, while the paths themselves are machine-wide.

The cache is an array of absolute directory prefix byte strings evaluated against kernel-resolved Linux path bytes, holding at most 64 entries of at most 4096 bytes each. Every prefix begins with / and ends with / — so that /usr/lib/ does not match /usr/libevil — and contains no embedded NUL byte. An empty, relative, NUL-containing, or non-slash-terminated prefix is invalid and is rejected without mutating the existing cache, which is staged and swapped under a mutex so a rejected update cannot leave it partly written.

The cache has no production writer. The only code that populates it is a test helper compiled in solely under the KUnit configuration: there is no syscall, no securityfs node, and no registry path that fills it. In a shipping build the cache is therefore permanently empty — and since an empty cache matches no path, enabling tlp on a process denies every file-backed executable mapping it subsequently attempts.

At mmap(PROT_EXEC) time, a process with TLP enabled has the mapped file's current kernel-resolved backing path checked against every approved prefix. If the path cannot be resolved, if no prefix matches, or if the cache is empty, the mapping is rejected.

Reading the PSB #

/proc/<pid>/psb gives a process's PSB as one line of text, in this order:

pip_type=<u32> pip_trust=<u32> mitigations=0x<hex> process_guid=<uuid>

mitigations is the committed mitigation bitfield in at least three hexadecimal digits, including ui_access and no_child_process, with the bit values of KACS ABI Reference. process_guid is the 16 bytes in order, formatted 8-4-4-4-12.

A process reads its own without any check. Reading another process's needs PROCESS_QUERY_LIMITED on its process descriptor, with SeDebugPrivilege rescuing a descriptor denial as it does for every process right, and does not need PIP dominance. That a process is protected is not a secret every other refusal keeps; it is what a caller needs to see to understand those refusals.

The PSB is otherwise written only: kacs_set_psb sets mitigations and returns nothing about them.

Identity virtualization (reserved) #

FieldDescription
virtualizationPer-process state for setuid compatibility redirection. Not active, and implementations may omit the field until it is.

Process Security Descriptors

Peios Kernel / Internals / KACS / Process security

Every process carries a security descriptor controlling who may operate on it, stored on the PSB alongside the PIP and mitigation fields. It replaces Linux's UID-based process access control — a patchwork of UID comparisons and capabilities — with a single descriptor evaluation.

Process access rights #

RightValueMeaning
PROCESS_TERMINATE0x0001Send signals whose default action is termination.
PROCESS_SIGNAL0x0002Send informational signals whose default action is to ignore: SIGCHLD, SIGURG, SIGWINCH.
PROCESS_VM_READ0x0010Read process memory — ptrace peek, /proc/<pid>/mem, process_vm_readv.
PROCESS_VM_WRITE0x0020Write process memory — ptrace poke, /proc/<pid>/mem, process_vm_writev. Includes debugger attach.
PROCESS_DUP_HANDLE0x0040Extract file descriptors from the process through pidfd_getfd.
PROCESS_SET_INFORMATION0x0200Change priority, CPU affinity, I/O priority, resource limits, process group membership where Linux permits it, timer slack, memory-placement policy or pages, and mutable /proc/<pid> task state — sched, autogroup, timens_offsets, timerslack_ns, coredump_filter, oom_adj, oom_score_adj, make-it-fail, fail-nth, latency and clear_refs, plus write intent on the coupled uid_map, gid_map, projid_map and setgroups seq files.
PROCESS_QUERY_INFORMATION0x0400Inspect the process's token; read the detailed /proc/<pid>/* files — cmdline, status, io, limits, sched, autogroup, timens_offsets, personality, syscall, latency, timers, timerslack_ns, mounts, mountinfo, mountstats, coredump_filter, oom_adj, oom_score_adj, loginuid, make-it-fail, fail-nth, seccomp_cache, ksm_merging_pages and ksm_stat — plus read intent on the coupled uid_map, gid_map, projid_map and setgroups seq files; query Linux compatibility capability state through capget(pid); and query detailed scheduler, CPU-affinity and I/O-priority state.
PROCESS_SUSPEND_RESUME0x0800Send signals whose default action is to stop or continue.
PROCESS_QUERY_LIMITED0x1000Read basic process information: PID, process group ID, session ID, image name, state, CPU and memory usage — stat, statm, comm, wchan, schedstat, cpuset, cgroup, cpu_resctrl_groups, oom_score, sessionid, patch_state, stack_depth, arch_status and psb. This is what ps and top show, it covers /proc/<pid>/stat, and it is the right required for pidfd_open() and for kill(pid, 0) existence probes.
READ_CONTROL0x20000Read the process's own descriptor.
WRITE_DAC0x40000Modify the process's DACL.
WRITE_OWNER0x80000Change the descriptor's owner.

Three /proc entries are not where the right names suggest. maps, fd and environ are not gated by PROCESS_QUERY_INFORMATION: they keep their upstream PTRACE_MODE_READ_FSCREDS gating, which maps to PROCESS_VM_READ — reading a process's memory map is treated as reading its memory, which is defensible but is not what the right's name implies. And cgroup sits in the PROCESS_QUERY_LIMITED set rather than the detailed one.

psb is the process's PSB, read under PROCESS_QUERY_LIMITED with no PIP dominance (PSB Fields). It is the one /proc entry whose check is KACS's own rather than the metadata rule's.

Signal classification #

Each Linux signal maps to a process access right according to its default action.

Signal 0 is not delivered at all. A kill(), tkill(), or tgkill() call with signal 0 is an existence and permission probe, requiring PROCESS_QUERY_LIMITED on the target plus PIP dominance.

PROCESS_TERMINATE — default action terminate, or terminate with a core dump:

Signal#DefaultNotes
SIGHUP1TerminateSession hangup
SIGINT2TerminateCtrl-C
SIGQUIT3Terminate + coreQuit request
SIGILL4Terminate + coreIllegal instruction
SIGTRAP5Terminate + coreDebug trap
SIGABRT6Terminate + coreAbort
SIGBUS7Terminate + coreBus error
SIGFPE8Terminate + coreFloating point exception
SIGKILL9TerminateForced kill, cannot be caught
SIGUSR110TerminateUser-defined
SIGSEGV11Terminate + coreSegfault
SIGUSR212TerminateUser-defined
SIGPIPE13TerminateBroken pipe
SIGALRM14TerminateAlarm timer
SIGTERM15TerminateGraceful termination request
SIGSTKFLT16TerminateStack fault
SIGXCPU24Terminate + coreCPU time exceeded
SIGXFSZ25Terminate + coreFile size exceeded
SIGVTALRM26TerminateVirtual timer
SIGPROF27TerminateProfiling timer
SIGIO29TerminateI/O possible
SIGPWR30TerminatePower failure
SIGSYS31Terminate + coreBad syscall

PROCESS_SUSPEND_RESUME — default action stop or continue:

Signal#DefaultNotes
SIGSTOP19StopForced stop, cannot be caught
SIGTSTP20StopTerminal stop, Ctrl-Z
SIGTTIN21StopBackground read from terminal
SIGTTOU22StopBackground write to terminal
SIGCONT18ContinueResume a stopped process

PROCESS_SIGNAL — default action ignore:

Signal#DefaultNotes
SIGCHLD17IgnoreChild status change
SIGURG23IgnoreUrgent socket data
SIGWINCH28IgnoreWindow resize

The real-time signals, SIGRTMIN through SIGRTMAX (32–64), default to terminate and therefore require PROCESS_TERMINATE.

What bypasses the check #

This classification applies only to signals sent by userspace through kill(), tkill(), and tgkill(). Kernel-generated signals — hardware faults such as SIGSEGV, SIGBUS and SIGFPE, SIGCHLD from a child exiting, SIGPIPE from a broken pipe — are delivered by the kernel and bypass the process descriptor check entirely, because the task_kill LSM hook does not fire for kernel-originated delivery.

Terminal-generated job control signals are kernel-originated under that rule and bypass the check the same way: SIGINT, SIGQUIT and SIGTSTP from the tty driver's isig handling, and SIGHUP on hangup. This is intentional. Authorization for keyboard-driven signals is possession of the controlling terminal, which was gated by the terminal's file descriptor at open time — so Ctrl-C reaches the whole foreground process group even when a member of it is more privileged or more PIP-trusted than whoever holds the terminal. A process that cannot accept that exposure must not attach to an untrusted controlling terminal.

The si_uid in a delivered signal's siginfo_t is the sender's projected UID (Credential Projection), captured at send time. Like every projected credential surface it is informational only and is not an authorization input; si_pid carries the same caveat and is subject to PID reuse besides.

Generic mapping #

Generic rightMaps to
GENERIC_READPROCESS_QUERY_INFORMATION | PROCESS_VM_READ | READ_CONTROL
GENERIC_WRITEPROCESS_SET_INFORMATION | PROCESS_VM_WRITE | WRITE_DAC
GENERIC_EXECUTEPROCESS_TERMINATE | PROCESS_SUSPEND_RESUME | PROCESS_QUERY_LIMITED
GENERIC_ALLevery process right above, together with READ_CONTROL, WRITE_DAC and WRITE_OWNER

The default process descriptor #

Every process receives a default descriptor at creation:

Owner: <creator's primary token user SID>
Group: <creator's primary token primary group SID>
DACL:
  ALLOW  <process's own user SID>   GENERIC_ALL
  ALLOW  BUILTIN\Administrators     GENERIC_ALL
  ALLOW  SYSTEM                     GENERIC_ALL
  ALLOW  Everyone                   PROCESS_QUERY_LIMITED

A process can therefore do anything to itself; Administrators and SYSTEM have full control over every process; everyone can see basic process information, which is what makes ps and top work for all users; and detailed inspection — token, memory, environment — is restricted to the process itself, administrators, and SYSTEM.

A service can modify its own descriptor at runtime with kacs_set_sd, which requires WRITE_DAC — granted to the process itself by the default DACL. Requesting a custom descriptor at launch through a service definition is not implemented: the only descriptor creation path always builds the default template, so every process starts from it and any deviation is a subsequent write.

How PIP relates to it #

PIP and the process descriptor are complementary, and both checks have to pass. The descriptor controls who may operate on the process; PIP controls what trust level is required for invasive access to a protected one. AccessCheck evaluates the caller's token against the target's descriptor for the requested right, and PIP evaluates the caller's trust against the target's pip_type and pip_trust for operations crossing the process boundary.

The two are genuinely independent. A process may have a permissive descriptor granting Administrators GENERIC_ALL and still be PIP-protected, so administrators pass the descriptor check and are stopped only by insufficient PIP trust.

The converse — a process with no PIP protection carrying a restrictive descriptor that denies even administrators — holds with one qualification. When a descriptor check denies access and PIP was not the deciding factor, an enabled SeDebugPrivilege on the caller grants the access anyway and is marked used. The privilege therefore rescues a descriptor denial while remaining unable to cross a PIP boundary, which is exactly the split Privilege Catalogue describes for it.

Peios Learn — documentation for Peios software.

Built with Trail.