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

Security

Single-page view · as markdown

Security

Peios Kernel / Internals / LCS / Security

Use these articles to understand security in the Peios kernel.

  • The Access Flow
  • Access Rights
  • Inheritance and Hive Roots
  • Audit

The Access Flow

Peios Kernel / Internals / LCS / Security

The registry's security model is KACS applied to keys. LCS defines no access control mechanism of its own: the same AccessCheck, the same Security Descriptors, the same tokens and SIDs that every other Peios subsystem uses. What this section describes is how those primitives attach to registry operations.

Every open follows the same five steps.

  1. Token capture. LCS takes the calling thread's effective token — the impersonation token if one is set, otherwise the process primary token. This is the same capture KACS performs for every syscall.

  2. Path resolution. LCS walks the path through the layer stack, following symlinks. No access check happens during the walk. Intermediate keys are not evaluated; only the final key matters.

  3. AccessCheck. LCS calls KACS AccessCheck with the captured token, the final key's Security Descriptor as returned by the source, and the desired access mask. Every requested right must be granted or the open fails with EACCES. There is no partial grant: the caller gets what it asked for or nothing.

    MAXIMUM_ALLOWED is the exception, and the only way to ask for whatever is available. AccessCheck computes the full allowed set and that becomes the granted mask.

  4. The granted mask is stored on the fd. It never changes.

  5. Per-ioctl checks are bitmask tests. Each ioctl has a required right; LCS tests the fd's granted mask against it and returns EACCES without contacting the source if it is absent. The Security Descriptor is not re-read and AccessCheck is not re-evaluated.

No traverse checking #

LCS checks nothing on the way down. A process can open Machine\System\Services\Jellyfin without holding any access to Machine\System\Services or Machine\System.

This matches the Windows registry and is a deliberate difference from filesystem path semantics, where every directory in a path is checked for traverse. It means a key's Security Descriptor is the whole story about who can reach it, and that an ancestor's descriptor confers no protection on its descendants.

Symlinks #

Opening a symlink follows it, and AccessCheck runs on the target key, not the link. REG_OPEN_LINK opens the link itself instead — but only for the final path component. A symlink encountered part-way through a path is followed regardless.

Creating a symlink is privileged: KEY_CREATE_SUB_KEY and KEY_CREATE_LINK on the parent, plus either SeTcbPrivilege or membership of Administrators (Symlinks).

Fds are capabilities #

A key fd can be passed over a Unix socket with SCM_RIGHTS, and it carries its granted mask with it. The recipient gets the access the original opener was granted, whether or not its own token would have passed AccessCheck.

This is explicit delegation and it is consistent with how fds work everywhere else in Peios. Passing a KEY_WRITE fd hands over write access.

Opening relative to a parent fd skips path parsing and AccessCheck for the parent portion — the caller already proved its access when it obtained the parent fd. This is the ordinary way to traverse a subtree.

Changing a descriptor does not revoke a handle #

A Security Descriptor change takes effect for future opens. An fd that already exists keeps the mask it was granted at open, because that is what semantic rule 5 says (Overview). The recourse for genuinely revoking access is to restart the process holding the fd.

Descriptor changes are also not layer-qualified. They are direct mutations on the key object, and deleting a layer does not undo one (Overview, rule 4).

The second check nobody expects #

Every layer-qualified mutation runs a second AccessCheck, against a different object: the metadata key of the layer being written to. That check is for KEY_SET_VALUE and it is in addition to the fd's granted mask on the target key. Both must pass. Writing Into a Layer covers it.

Access Rights

Peios Kernel / Internals / LCS / Security

Registry rights occupy the Windows bit positions, so a Security Descriptor carrying registry ACEs is binary-compatible with one written by Windows tooling. That is a registry.pol and Samba requirement, not an aesthetic choice.

The values are in LCS ABI Reference. In summary: six specific rights in bits 0–5 (KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, KEY_CREATE_LINK), the four standard rights DELETE, READ_CONTROL, WRITE_DAC and WRITE_OWNER, and ACCESS_SYSTEM_SECURITY for the SACL, which is itself gated by SeSecurityPrivilege.

There is no execute right on a key.

Convenience masks and generic mapping #

KEY_READ, KEY_WRITE and KEY_ALL_ACCESS are concrete masks, not generic bits — they are unions of the rights above and are usable directly.

Separately, LCS accepts the raw KACS generic bits GENERIC_READ, GENERIC_WRITE, GENERIC_EXECUTE and GENERIC_ALL in a caller's desired_access and in ACE masks in a Security Descriptor. Those are mapped through the registry generic mapping before AccessCheck sees them.

GENERIC_READ maps to KEY_READ, GENERIC_WRITE to KEY_WRITE, GENERIC_ALL to KEY_ALL_ACCESS, and GENERIC_EXECUTE maps to zero, because there is nothing to execute.

Validating what a caller asks for #

desired_access is validated before path resolution or AccessCheck.

  • Zero is EINVAL. A caller must ask for something.
  • Any bit outside the valid caller mask is EINVAL.
  • MAXIMUM_ALLOWED may appear alone or combined with anything else.
  • SYNCHRONIZE (0x00100000) is not a registry right, so it is an unknown bit and fails EINVAL.

The valid caller mask is a single constant, REG_VALID_DESIRED_ACCESS_MASK (LCS ABI Reference): the six specific rights, the four standard rights, ACCESS_SYSTEM_SECURITY, MAXIMUM_ALLOWED and the four generic bits.

Validating what a source returns #

Source-supplied Security Descriptors are validated too, because a source is trusted for its data but not for its arithmetic (Validation).

An ACE mask may contain concrete registry rights and raw generic bits. It may not contain MAXIMUM_ALLOWED — that is a request, not a grant, and it is meaningless in an ACE.

After generic mapping, an ACE mask must be a subset of the concrete registry rights plus ACCESS_SYSTEM_SECURITY.

A descriptor that breaks either rule is malformed source data: the operation fails closed with EIO and an lcs.source.response.rejected audit event is emitted (Audit).

Two further constants, REG_VALID_MAPPED_ACCESS_MASK and REG_VALID_ACE_ACCESS_MASK, express those two bounds.

Which right each operation needs #

OperationRequired
REG_IOC_QUERY_VALUE, QUERY_VALUES_BATCH, ENUM_VALUESKEY_QUERY_VALUE
REG_IOC_SET_VALUE, DELETE_VALUE, BLANKET_TOMBSTONE, FLUSHKEY_SET_VALUE
REG_IOC_ENUM_SUBKEYSKEY_ENUMERATE_SUB_KEYS
REG_IOC_QUERY_KEY_INFOREAD_CONTROL
REG_IOC_DELETE_KEY, HIDE_KEYDELETE
REG_IOC_NOTIFYKEY_NOTIFY
REG_IOC_GET_SECURITYREAD_CONTROL for owner, group, DACL and label; ACCESS_SYSTEM_SECURITY for the SACL
REG_IOC_SET_SECURITYWRITE_OWNER for owner, group or label; WRITE_DAC for the DACL; ACCESS_SYSTEM_SECURITY for the SACL; raising a label above the caller additionally requires enabled SeRelabelPrivilege
REG_IOC_BACKUPSeBackupPrivilege, no per-key check
REG_IOC_RESTORESeRestorePrivilege, no per-key check
creating a keyKEY_CREATE_SUB_KEY on the parent
creating a symlink keyKEY_CREATE_SUB_KEY and KEY_CREATE_LINK on the parent, plus SeTcbPrivilege or Administrators

Where a REG_IOC_SET_SECURITY or GET_SECURITY request names several components, every right those components imply must be present before the source is contacted.

REG_IOC_FLUSH requires KEY_SET_VALUE because a flush is only meaningful to a caller that wrote something and wants it durable. Requiring a write right stops an unprivileged reader using flush as a disk-I/O amplifier.

Enumeration exposes names, not contents #

REG_IOC_ENUM_SUBKEYS performs no per-child access check. Every visible child is returned, whatever the caller's access to it. The caller learns names, and must open each child separately — with a real AccessCheck — to read anything.

Subtree watches work the same way: a watcher is told a descendant was created without a check on that descendant. Structure visibility is deliberately weaker than content visibility, matching RegNotifyChangeKeyValue and RegEnumKeyEx.

Inheritance and Hive Roots

Peios Kernel / Internals / LCS / Security

Inheritance at creation #

When reg_create_key creates a key, its initial Security Descriptor is computed from the parent's by the KACS inheritance algorithm. LCS supplies the parent descriptor, the creating token, the registry generic mapping and the valid-mask bound, and hands the result to the source to persist. It implements no inheritance logic of its own.

Three things about registry inheritance are worth stating.

It is static. The computation happens once, at creation. A later change to the parent's descriptor does not propagate to children that already exist. Re-propagating is an explicit administrative action — a client-side tree walk — not a kernel operation, and there is no code anywhere in LCS that walks a tree to re-propagate.

Only CONTAINER_INHERIT_ACE matters. Every registry object is a container: keys hold subkeys and values. Values are not independent security objects and have no descriptors of their own; they inherit their key's access control.

OBJECT_INHERIT_ACE is never used to select an ACE for inheritance. The child copy clears OBJECT_INHERIT_ACE, CONTAINER_INHERIT_ACE and NO_PROPAGATE_INHERIT_ACE when NO_PROPAGATE_INHERIT_ACE applies.

A parent with no inheritable ACEs falls back to the creating token's default DACL.

That fallback covers the DACL only; there is no default SACL.

Creator SIDs and generic rights survive to the next generation #

An inheritable ACE naming CREATOR OWNER or CREATOR GROUP, or carrying generic rights, is resolved for each new key. When it also propagates to further subkeys, the child receives two ACEs:

  • An effective copy with the child's owner/group substituted and generic rights mapped to registry rights. It has INHERITED_ACE and no propagation flags.
  • An inherit-only copy retaining the original SID and generic mask, with INHERITED_ACE and its propagation flags. This copy resolves afresh when the next subkey is created.

This applies to both DACL and SACL entries. An ordinary concrete ACE remains one copy. NO_PROPAGATE_INHERIT_ACE ends the rule at the immediate child, so it receives only the effective copy. Existing stored descriptors are not rewritten by upgrading the kernel; an explicit propagation operation is needed to repair an already-created subtree.

Hive roots #

A hive root has no parent, so it is the top of every inheritance chain below it and cannot inherit anything itself. Its descriptor is created by the source, on first boot, and LCS enforces whatever the source stored.

LCS holds no template. There are no hardcoded SIDs, no default hive root descriptors, and no code that would construct one — searching for them finds nothing. The defaults that follow are what loregd writes; they are conventions of the source, not properties of the kernel.

Machine\:

PrincipalRightsInheritance
SYSTEMKEY_ALL_ACCESSContainer-inherit
AdministratorsKEY_ALL_ACCESSContainer-inherit
Authenticated UsersKEY_READContainer-inherit

Users\<SID>\:

PrincipalRightsInheritance
the user's SIDKEY_ALL_ACCESSContainer-inherit
SYSTEMKEY_ALL_ACCESSContainer-inherit
AdministratorsKEY_ALL_ACCESSContainer-inherit

These mirror Windows HKLM and HKU. A subsystem needing something tighter — Machine\Security\, say — sets an explicit descriptor on its own subtree root at creation, overriding what it inherited.

Because there is no traverse checking (The Access Flow), a restrictive descriptor high in the tree protects only the key it is on. Protection of a subtree comes from the descriptors its keys inherited at creation, which is exactly why an administrator changing a parent's descriptor and expecting the subtree to follow will be disappointed.

Reading and writing descriptors #

REG_IOC_GET_SECURITY and REG_IOC_SET_SECURITY take a security_info bitmask naming which components to act on: owner, group, DACL, SACL, or mandatory integrity label (LABEL_SECURITY_INFORMATION).

Zero is EINVAL, and so is any unknown flag; both are rejected before the source is contacted, before transaction enlistment and before any mutation.

The rights required are computed from every component named. Reading owner, group, the DACL or the label needs READ_CONTROL; reading the SACL needs ACCESS_SYSTEM_SECURITY. Setting owner or group needs WRITE_OWNER, as does setting the label; setting the DACL needs WRITE_DAC; setting the SACL needs ACCESS_SYSTEM_SECURITY. A request naming several components must hold all the corresponding rights.

A set is a merge, not a replacement. LCS reads only the components security_info names from the supplied self-relative descriptor and preserves the existing ones.

Component selection includes its control flags even when the component has no bytes. A null ACL remains PRESENT clear, but its defaulted, inheritance and protection flags survive a query or an update to another component. Replacing a selected DACL or SACL takes that ACL's flags from the input descriptor, including for a null ACL; unselected component flags are preserved. An empty ACL remains present with zero ACEs and is not converted to null. The same preservation rule applies to a defaulted null group.

LABEL_SECURITY_INFORMATION reads only the first effective mandatory-label ACE from the SACL, omitting inherit-only labels and every non-label ACE. If there is no effective label, the returned subset has no SACL. Reading this subset needs READ_CONTROL; writing it needs WRITE_OWNER. Neither operation needs ACCESS_SYSTEM_SECURITY or SeSecurityPrivilege.

A label update removes the existing mandatory-label ACEs and inserts the supplied label before the remaining SACL entries. An input descriptor with no SACL clears the explicit label. Non-label SACL entries, SACL inheritance and protection flags, and all unselected descriptor components are preserved, including flags on a null DACL. Clearing the last SACL entry clears SE_SACL_PRESENT while retaining the other SACL flags.

For a label-only subset, a supplied SACL must contain exactly one mandatory-label ACE with an S-1-16-<level> SID and without INHERIT_ONLY_ACE; an empty ACL, an audit ACE, or multiple labels is EINVAL. SACL_SECURITY_INFORMATION and LABEL_SECURITY_INFORMATION cannot be combined. These input errors are rejected before source contact or transaction enlistment.

An explicit label above the current caller's integrity level requires enabled SeRelabelPrivilege, checked before source contact or transaction enlistment; otherwise the update fails with EACCES. Labels at or below the caller's level do not require that privilege. The same rule applies to an explicit label inside a whole-SACL write: SeSecurityPrivilege does not substitute for SeRelabelPrivilege. Existing fd rights remain cached, but this privilege check uses the caller performing the update.

The result must still have an owner; a merge that would leave the descriptor ownerless is EINVAL.

A null group SID stays valid.

Enlisting a descriptor change in a transaction gives it atomicity with the rest of the transaction's operations. It does not make it layer-qualified: the change is still a direct mutation on the key, is still not reverted by deleting a layer, and is simply not applied at all if the transaction aborts.

Audit

Peios Kernel / Internals / LCS / Security

LCS emits audit events through KMES. Fifteen events exist.

EventEmitted when
lcs.audit.key.openedA key open matched a SACL audit ACE.
lcs.audit.value.setA value write through a handle whose audit mask covers KEY_SET_VALUE.
lcs.audit.value.deletedA value delete through a handle whose audit mask covers KEY_SET_VALUE.
lcs.audit.key.tombstonedA blanket tombstone set or cleared through a handle whose audit mask covers KEY_SET_VALUE.
lcs.audit.key.deletedA key deleted through a handle whose audit mask covers DELETE.
lcs.audit.key.hiddenA key hidden through a handle whose audit mask covers DELETE.
lcs.audit.key.createdA key create that made a key matched a SACL audit ACE on the parent.
lcs.audit.key.descriptor.changedA descriptor change included the SACL, or its right is covered by the handle's audit mask.
lcs.audit.transaction.committedA transaction that staged an audited write ended.
lcs.audit.backup.startedAfter admission checks and before REG_IOC_BACKUP requests its read-only snapshot or reads any subtree data.
lcs.audit.backup.endedAfter a backup completes or fails after starting.
lcs.audit.restore.startedBefore REG_IOC_RESTORE modifies any source state.
lcs.audit.restore.endedAfter a restore completes or fails after starting.
lcs.source.response.rejectedLCS rejected malformed source data.
lcs.config.value.rejectedLCS rejected an invalid self-configuration value.

A registry open that a privilege contributed to is also recorded, as KACS's kacs.audit.privilege.used; see Privilege use on opens.

Backup and restore are audited unconditionally, whatever the SACL on the target key says. They are privilege-gated bulk operations that bypass per-key access checks entirely, so the audit trail is the only record that they happened.

Every payload is a single MessagePack map with string keys. Each field path is written as nested maps, one per segment, so object.key.guid is {object: {key: {guid: …}}}. A value LCS does not have is left out rather than written as nil, and every map counts only the keys actually written (PGSS Evaluation).

The key GUID, object.key.guid, is a 16-byte binary value, and the caller's SID is a binary KACS encoding. The token and process GUIDs are not payload fields at all: they ride in the KMES event header, so the payload never repeats them.

The caller summary #

Every event except lcs.source.response.rejected and lcs.config.value.rejected describes the effective token used for the operation under subject.token. It has six fields and no more: sid, integrity, id (the token's LUID), auth-id (its logon session's LUID), type (primary or impersonation) and impersonation, the impersonation level.

The bound is deliberate. Group lists, privilege arrays, claims and default DACLs are unbounded and are never included. The summary carries enough to correlate an event with a caller, and nothing that could make one event arbitrarily large. lcs.source.response.rejected and lcs.config.value.rejected carry no caller: neither is a principal acting.

A primary token reports an impersonation level of 0. An Anonymous impersonation token also reports 0, which is why subject.token.type is recorded beside it.

Key opens #

lcs.audit.key.opened carries the caller summary, then object.kind (always key, which names the table the masks decode against), object.key.guid, the requested and granted masks as access.requested and access.granted, outcome.success (true when the open was allowed), and trigger.sacl-match — bit 0 for a success-audit match, bit 1 for a failure-audit match, no other bits.

access.granted is forced to zero on a denial, and that is enforced rather than merely intended: a denied event carrying a non-zero granted mask is rejected as a malformed payload.

access.requested is the mask after registry generic mapping, with MAXIMUM_ALLOWED re-added if the caller asked for it.

SACL evaluation follows the KACS AccessCheck algorithm — the SACL is evaluated alongside the DACL, not separately.

Reading or modifying a SACL requires ACCESS_SYSTEM_SECURITY, which is itself gated by SeSecurityPrivilege.

A request of MAXIMUM_ALLOWED alone maps to a desired mask of zero, so AccessCheck's SACL walk matches each audit ACE against the granted mask instead. An audit ACE says "audit when someone gets this right", and with MAXIMUM_ALLOWED they did get it.

Such an open therefore always audits as a success, which is correct: MAXIMUM_ALLOWED returns whatever is available and never fails, so a failure ACE has nothing to record.

An ACE naming a right the caller did not receive still does not match.

Registry writes #

Writes are audited through the key handle, as file operations are through a file handle. When a key is opened, the access check evaluates the key's SYSTEM_ALARM* ACEs against the caller, and the union of the masks of the ones that match becomes the handle's continuous-audit mask. Success and failure SYSTEM_AUDIT ACEs do not contribute; they govern the open itself. This is the continuous auditing of Auditing in AccessCheck with LCS as the enforcement point, except in two respects: LCS writes records named for the operation rather than kacs.audit.handle.used, and a record it cannot write does not fail the operation (see below).

The mask is fixed for the life of the handle. A later change to the key's SACL neither adds to it nor takes from it, so a handle that removes the alarm ACE is still audited for the change it makes, and handles opened before an alarm ACE was added are not.

A write through the handle is recorded when the right it needs overlaps the mask, and not otherwise. The right is the one the handle's own gate checks:

EventOperationRight
lcs.audit.value.setREG_IOC_SET_VALUEKEY_SET_VALUE
lcs.audit.value.deletedREG_IOC_DELETE_VALUEKEY_SET_VALUE
lcs.audit.key.tombstonedREG_IOC_BLANKET_TOMBSTONEKEY_SET_VALUE
lcs.audit.key.deletedREG_IOC_DELETE_KEYDELETE
lcs.audit.key.hiddenREG_IOC_HIDE_KEYDELETE

A write that fails is recorded too, with outcome.success false and outcome.errno the negative errno the caller received. That includes a write the handle's own gate refuses because the handle lacks the right: the mask comes from the SACL, not the grant, so it can cover rights the handle was not given.

Every write record carries the caller summary; object.kind (key), object.key.guid and object.key.path, the handle's key and its resolved path; object.key.layer.name, the layer written; the masks access.requested (the right above), access.granted (the handle's grant), access.matched and access.audit-mask; transaction.id when the write was staged in a transaction; and outcome.success, with outcome.errno on a failure. A failure also carries request.timed-out. Value records add object.key.value.name; a value write adds the value's type and length and a digest of its data, and mutation.sequence, with mutation.sequence-expected on a compare-and-swap; a tombstone change adds operation.name (set or clear); a hide adds mutation.sequence. A field the operation had not reached when it failed is left out.

A value's data is never recorded. In its place a record carries the data's type, its length and its SHA-256 digest, so two records can be compared without either holding the data. Every digest LCS records, of a value or of a security descriptor, is SHA-256.

A value write outside a transaction also records the value it replaced, as object.key.value.type-previous, .length-previous and .digest-previous: the effective value before the write, across every layer. A value delete records the value it removed the same way.

A write whose source does not answer before the request timeout fails with ETIMEDOUT, and its record carries request.timed-out true. The source is not told to cancel, so the change may still land; for a value write or descriptor change outside a transaction, LCS also applies the write's kernel-side effects when the late reply arrives, and nothing records who made the write then. Read a timed-out record as "may have been applied later".

A write made in a transaction is recorded when it is staged, with transaction.id. Its outcome.success then says the source accepted it into the transaction, not that it took effect.

Transaction ends #

A transaction that staged at least one recorded write — a write or a key creation whose record was emitted — writes one lcs.audit.transaction.committed when it ends, and only one: at a REG_IOC_COMMIT that leaves it committed or otherwise finished, at its timeout, or when its fd is closed without a commit. A commit that fails and leaves the transaction open writes nothing yet.

It carries the caller summary, transaction.id and transaction.state, the state it ended in, and outcome.success, true only for committed. A failure adds transaction.commit-outstanding and outcome.reason: aborted (closed without a commit, or a layer it wrote was deleted), timed-out or source-error; and outcome.errno when a REG_IOC_COMMIT call failed.

On REG_IOC_COMMIT the subject is the caller who committed, not the one who staged the writes. A transaction that ended by timeout or by its fd closing has nobody acting, and names the subject that staged its first recorded write. The timer that ends a transaction runs in softirq context, which cannot build a record; the record is written from the work item that aborts the transaction at the source.

A commit whose reply does not arrive in time reports timed-out with transaction.commit-outstanding true: the source may have committed it before the reply was lost.

Key creation #

lcs.audit.key.created records a key a create made. Creating a key checks only KEY_CREATE_SUB_KEY on its parent, so the parent's SACL decides, by the rule that decides lcs.audit.key.opened: a success audit ACE on the parent that matches the caller.

Only a key that was made is recorded. A create that found the key already present and opened it instead writes nothing here. The record is written once the key exists, or is staged in a transaction, so a create whose handle then fails to reach the caller is still recorded.

It carries the caller summary; object.kind; the new key's object.key.guid, object.key.path and object.key.layer.name; object.key.created (true), object.key.volatile, object.key.volatile-requested and object.key.symlink; the new key's descriptor as object.sd.length and object.sd.owner; access.requested (KEY_CREATE_SUB_KEY) and access.granted, from the parent check; transaction.id when staged; and outcome.success.

Descriptor changes #

lcs.audit.key.descriptor.changed records REG_IOC_SET_SECURITY through a key handle.

A change that includes the SACL is recorded whatever the handle's mask says. It is recorded once the handle's own gate has admitted it, which takes ACCESS_SYSTEM_SECURITY: a handle without that right is refused first, and asking for a SACL change writes no record.

Any other change is recorded when the right it needs — WRITE_OWNER for the owner or group, WRITE_DAC for the DACL — overlaps the handle's mask, and then failures are recorded as writes' are.

The record carries what a write record does, without a layer, and the descriptors: object.sd.components, the security_info bits asked for; and for the descriptor written and the one it replaced, object.sd.length and object.sd.length-previous, their SHA-256 digests object.sd.digest and object.sd.digest-previous, and their owners object.sd.owner and object.sd.owner-previous. access.requested is every right the change needs, and access.matched is zero when only the SACL made the record exist.

Privilege use on opens #

A registry open whose access check used a privilege — SeSecurityPrivilege for ACCESS_SYSTEM_SECURITY, SeTakeOwnershipPrivilege for WRITE_OWNER — writes KACS's kacs.audit.privilege.used when the caller's token audit policy asks for privilege use, in the shape KACS uses for its own access checks, with object.kind key. The key's identity is not carried. The checks LCS makes for layer writes and on a create's parent record none.

Backup and restore #

lcs.audit.backup.started and lcs.audit.restore.started carry the caller summary, object.key.guid for the subtree root, and operation.fd, the descriptor the stream is written to or read from.

lcs.audit.backup.ended and lcs.audit.restore.ended carry the caller summary, object.key.guid and outcome.success. When the operation failed they also carry outcome.errno, the error as a negative errno; on success it is absent.

Source validation failures #

lcs.source.response.rejected carries the source slot as source.rsi.slot and then, where each is known, the hive name as source.rsi.hive, the RSI request id and operation code as request.id and request.op-code, and the key GUID as object.key.guid. outcome.reason names what was wrong. There are twelve:

malformed-security-descriptor, malformed-layer-name, unknown-rsi-status-code, future-sequence-number, duplicate-winning-sequence-tie, malformed-layer-metadata-security-descriptor, malformed-key-name, malformed-value-name, malformed-response-payload, malformed-key-metadata, malformed-value-payload, malformed-delete-layer-orphan-list.

The three name classes are field-specific: layer-name fields, key component or child-name fields, and value-name fields respectively.

The structural classes cover a response whose operation-specific payload has the wrong shape or trailing bytes; a lookup or enumeration whose metadata block is incomplete, duplicated, unreferenced or nil; a value payload with an invalid type, a tombstone/data mismatch or oversized data; and an invalid orphan GUID array from RSI_DELETE_LAYER.

Configuration #

lcs.config.value.rejected has the same shape as KMES's kmes.config.value.rejected, with every field under one config map. It carries the offending parameter's key and name as config.key.path and config.name; the expected type and numeric range as config.expected.type, config.expected.min and config.expected.max; what was actually received as config.received.kind — one of missing, wrong-type or out-of-range — with config.received.type for a value of the wrong type or config.received.value for one out of range; and, as config.value, the value LCS retained instead.

Because missing counts as invalid, a first boot before seed restore emits one of these per parameter on each refresh: nineteen events against an empty Registry\ key. That is correct and expected, but it is a noticeable share of the boot audit stream.

What happens when emission fails #

The policy differs per event, and the differences are the point.

  • lcs.audit.key.opened. If LCS cannot construct a valid payload — corrupt internal state, allocation failure, anything on the LCS side — the open fails with EIO and no key fd is published. If the payload is valid but KMES cannot retain the event — unavailable, ring drops, capacity pressure, no consumer — the access decision and the fd publication are unaffected. Loss accounting is KMES's problem.
  • lcs.audit.backup.started, lcs.audit.restore.started. Emission failure returns EIO and the operation does not start. Nothing is read and nothing is written.
  • lcs.audit.backup.ended, lcs.audit.restore.ended. The operation has already finished. Emission is attempted; failure does not change the result.
  • lcs.source.response.rejected. The triggering operation is already failing with EIO. Emission is attempted; failure does not change that.
  • lcs.config.value.rejected. The invalid value has already been ignored and the previous known-good value retained. Emission is attempted; failure leaves the retained configuration in force.
  • The write, creation, descriptor-change and transaction records. Each is written after the source has applied or refused the operation, or after the transaction's state is final. Emission is attempted; a record that cannot be built or retained leaves the caller's result as it was. These records fire no lcs:lcs_audit_emit or lcs:lcs_audit_emit_failed tracepoint; the tracepoints' event-type codes cover the other seven.

The rule underneath them all: an audit failure blocks an operation only where the audit record is the point of the operation being permitted. A privileged bulk export whose start could not be recorded does not happen. A key open whose decision could not be recorded does not happen. Everything downstream of an already-determined outcome records what it can.

LCS constructs the payload and attempts to enqueue it before continuing past the audit point. It never waits for a userspace consumer to observe or retain the event.

Peios Learn — documentation for Peios software.

Built with Trail.