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

KACS

Single-page view · as markdown

KACS

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Use these articles to understand kacs in the Peios kernel.

  • Mount policy syscalls
  • Generated syscall index
  • Generated token and session ABI
  • Generated access-check and descriptor ABI
  • Generated file and mount ABI
  • Generated socket and IPC ABI
  • Generated process and PSB ABI
  • Generated diagnostic constants
  • MS-DTYP compatibility and divergences
  • ABI status and naming differences
  • Descriptor and ACE semantics
  • Token query semantics
  • Socket ABI compatibility

Mount policy syscalls

Peios Kernel / Userspace interfaces / Native interfaces / KACS

These syscall notes preserve the argument and error descriptions from the operator guide. For the kernel contract, use File Descriptor Storage.

Warning

The privilege gate has been source-verified below, but other descriptions retained from the operator guide still differ. The kernel contract allows templates only with synthesising classes, caps them at 65,535 bytes, and rejects non-empty templates for deny-missing. The SDK wrapper documents different small-buffer handling from the raw syscall error table below. These differences need implementation verification; do not use these notes to infer a broader grant of access or a safe retry.

kacs_set_mount_policy #

The write syscall:

result = kacs_set_mount_policy(fd, args)

Where fd is a file descriptor referring to any object on the target superblock (the kernel uses the fd to identify which superblock — the file itself does not need to be the root of the mount). args is a kacs_mount_policy_args struct:

FieldMeaning
policyThe new policy class (one of KACS_MOUNT_POLICY_DENY_MISSING, KACS_MOUNT_POLICY_SYNTHESIZE_EPHEMERAL, KACS_MOUNT_POLICY_SYNTHESIZE_PERSISTENT).
flagsReserved; must be zero.
generation(Output) The new generation counter value after the change.
template_sd_ptr, template_sd_lenOptional mount-level SD template. Max 64 KiB.

The kernel:

  1. Validates the fd and identifies the superblock.
  2. Validates the policy value. Attempts to set KACS_MOUNT_POLICY_UNMANAGED (which is not settable via this ABI) are rejected with -EINVAL.
  3. Validates the template SD if provided — must parse, must be within size limits.
  4. Checks the caller's privileges. Enabled SeManageVolumePrivilege or SeTcbPrivilege is required, and marking the privilege as used must succeed.
  5. Atomically updates the superblock's policy class, the template SD, and increments the generation counter.
  6. Writes the new generation to args.generation.
  7. Returns 0.

The change is atomic at the superblock level — every future access against any inode on this superblock sees the new policy. There is no transitional state where some inodes are under the old policy and others under the new.

Privilege requirement #

Important

In kernel source 8e0e22de3a59cad506bbbf8873de456e16ad272d, both policy reads and writes use the volume-management gate: enabled SeManageVolumePrivilege or SeTcbPrivilege, with successful privilege-use marking. Administrator membership alone is insufficient. The write gate and read gate establish this for the pinned source, not a deployed build or a historical release boundary.

Changing a mount's policy affects the entire filesystem's access semantics. SeManageVolumePrivilege can author synthesised policy and shadow existing paths; see its authority warning. The SDK wrappers at libpeios de0018bdcaed14abb796aeccec9c8387fd30e452 add no TCB-only gate despite their comments. The mount command's diagnostic also retains a TCB-only hint. Do not automatically grant TCB or globally remap CAP_SYS_ADMIN. A ready-to-use operator interface for changing an existing policy is not established here.

The generated KACS ABI trace table retains the KACS_MP_TCB_DENIED name and TCB-only descriptions. Those labels do not override the source-verified gate; this clarification leaves the generated table unchanged.

The template SD #

The optional template SD is the default SD used during synthesis when the parent's inheritance does not yield one. The kernel stores the template on the superblock; subsequent synthesis-on-missing calls use it.

The template is a complete self-relative SD — owner, primary group, DACL, optional SACL. The kernel validates the template at policy-set time:

  • Must be in self-relative format.
  • Must include an owner (an SD without one is malformed and rejected).
  • Must fit within 65,535 bytes total; the template specifically is capped at 64 KiB.
  • ACLs and ACEs must parse.

A bad template at policy-set time is rejected with -EINVAL; the current policy and template are unchanged.

The template can be omitted entirely (zero pointers) for mounts that don't need one. The synthesis chain then falls through to the hardcoded fallback for any file whose parent doesn't yield an SD.

kacs_get_mount_policy #

The read syscall:

result = kacs_get_mount_policy(fd, args)

Same fd and args semantics, returning the current policy class, current template (if buffer provided), and current generation counter.

The kernel:

  1. Validates the fd, identifies the superblock.
  2. Checks the caller's privileges. Enabled SeManageVolumePrivilege or SeTcbPrivilege is required, with successful privilege-use marking.
  3. Writes the policy class, generation, and template to args (template only if a buffer was provided).
  4. Returns 0.

Like the write syscall, this uses the pinned-source volume-management gate. A successful policy query does not grant authority to bypass any other mount or file-access checks.

This is the kernel's read-back-the-current-policy interface. A management tool reads the policy, perhaps applies a transformation, and writes the new value back. The read-modify-write pattern is what most policy management code uses.

Reading the generation #

Compare the value from kacs_get_mount_policy with your earlier read to detect a change. Initial values are implementation-defined, and values from different superblocks are unrelated. The counter identifies changes, not a wall-clock change time. See the kernel administration contract for generation increments and cache invalidation.

Errors #

Possible failures from kacs_set_mount_policy:

ErrorCause
-EBADFThe fd is invalid.
-EPERMNeither accepted privilege is enabled, or privilege-use marking failed.
-EINVALSetting an unmanaged policy via the public ABI; setting an unknown policy value; non-zero reserved flags; malformed template SD; template size exceeded.

Possible failures from kacs_get_mount_policy:

ErrorCause
-EBADFThe fd is invalid.
-EPERMNeither accepted privilege is enabled, or privilege-use marking failed.
-ERANGEA template buffer was provided but is smaller than the template. The required size is written to the output.

In normal operation both calls succeed. Failures are typically privilege issues or malformed inputs.

Generated syscall index

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Every name, value, offset and size in this appendix is generated from include/uapi/pkm/ by tools/docs/peios-reference/generators/gen-kacs-abi.py, with struct layouts measured by compiling a probe against the real headers. Regenerate it whenever the ABI changes; do not edit it by hand.

The names here are the ones a program actually compiles against. Everything about the ABI a compiler cannot measure -- token query payload shapes, the specification spellings that differ from these names, what is documented elsewhere, and the kernel configuration -- is in the notes appendix, KACS ABI Notes, which this generator does not touch.

Syscall numbers #

Signatures are read from the SYSCALL_DEFINE sites in security/pkm/kacs/. The PKM UAPI exports the uppercase constants in <pkm/syscall.h>. Peios glibc 2.44-5 and later exports the standard lowercase SYS_kacs_* aliases in <sys/syscall.h>; each alias has the same number as its PKM constant.

NumberPKM constantglibc aliasSignature
1000SYS_KACS_OPEN_SELF_TOKENSYS_kacs_open_self_tokenkacs_open_self_token(unsigned int flags, u32 access_mask)
1001SYS_KACS_OPEN_PROCESS_TOKENSYS_kacs_open_process_tokenkacs_open_process_token(int pidfd, u32 access_mask)
1002SYS_KACS_OPEN_THREAD_TOKENSYS_kacs_open_thread_tokenkacs_open_thread_token(int pidfd, int tid, u32 access_mask)
1003SYS_KACS_CREATE_TOKENSYS_kacs_create_tokenkacs_create_token(const void __user *spec, size_t spec_len)
1004SYS_KACS_CREATE_LOGON_SESSIONSYS_kacs_create_logon_sessionkacs_create_logon_session(const void __user *spec, size_t spec_len)
1005SYS_KACS_SET_PSBSYS_kacs_set_psbkacs_set_psb(int pidfd, u32 mitigations)
1006SYS_KACS_DESTROY_EMPTY_LOGON_SESSIONSYS_kacs_destroy_empty_logon_sessionkacs_destroy_empty_logon_session(u64 auth_id)
1012SYS_KACS_REVERTSYS_kacs_revertkacs_revert(void)
1020SYS_KACS_OPENSYS_kacs_openkacs_open(int dirfd, const char __user *path, struct kacs_open_how __user *uhow, size_t howsize, u32 __user *status_out)
1021SYS_KACS_GET_SDSYS_kacs_get_sdkacs_get_sd(int dirfd, const char __user *path, u32 security_info, void __user *buf, u32 buf_len, u32 flags)
1022SYS_KACS_SET_SDSYS_kacs_set_sdkacs_set_sd(int dirfd, const char __user *path, u32 security_info, const void __user *sd_buf, u32 sd_len, u32 flags)
1023SYS_KACS_ACCESS_CHECKSYS_kacs_access_checkkacs_access_check(const void __user *uargs)
1024SYS_KACS_ACCESS_CHECK_LISTSYS_kacs_access_check_listkacs_access_check_list(const void __user *uargs, struct kacs_node_result __user *results, u32 results_count)
1025SYS_KACS_SET_CAAPSYS_kacs_set_caapkacs_set_caap(const void __user *policy_sid, u32 policy_sid_len, const void __user *spec, u32 spec_len)
1026SYS_KACS_GET_MOUNT_POLICYSYS_kacs_get_mount_policykacs_get_mount_policy(int fd, struct kacs_mount_policy_args __user *uargs, size_t argsize)
1027SYS_KACS_SET_MOUNT_POLICYSYS_kacs_set_mount_policykacs_set_mount_policy(int fd, struct kacs_mount_policy_args __user *uargs, size_t argsize)
1028SYS_KACS_ACCESS_CHECK_SUBJECTSYS_kacs_access_check_subjectkacs_access_check_subject(const void __user *request, size_t request_len, void __user *result)
1029SYS_KACS_QUERY_OPENSYS_kacs_query_openkacs_query_open(int fd, struct kacs_open_info __user *uinfo, size_t size)
1030SYS_KACS_SET_DISPOSITIONSYS_kacs_set_dispositionkacs_set_disposition(int fd, u32 flags)
1031SYS_KACS_RENAMESYS_kacs_renamekacs_rename(int fd, int newdirfd, const char __user *newpath, u32 flags)
1032SYS_KACS_LOCKSYS_kacs_lockkacs_lock(int fd, const struct kacs_lock_args __user *uargs, size_t size)
1033SYS_KACS_CREATE_LEASE_MANAGERSYS_kacs_create_lease_managerkacs_create_lease_manager(u32 flags, u32 timeout_ms)
1034SYS_KACS_LEASESYS_kacs_leasekacs_lease(int fd, int manager_fd, struct kacs_lease_args __user *uargs, size_t size)

uapi/pkm/syscall.h also registers the KMES and LCS numbers, 1090–1104, documented in their own chapters.

Structure layouts #

Related explanations #

  • Generated token and session ABI
  • Generated access-check and descriptor ABI
  • Generated file and mount ABI
  • Generated socket and IPC ABI
  • Generated process and PSB ABI
  • Generated diagnostic constants

Generated token and session ABI

Peios Kernel / Userspace interfaces / Native interfaces / KACS

struct kacs_query_args #

Total size 16 bytes.

OffsetSizeTypeField
04__u32token_class
44__u32buf_len
88__u64buf_ptr

struct kacs_adjust_privs_args #

Total size 24 bytes.

OffsetSizeTypeField
04__u32count
44__u32_pad
88__u64data_ptr
168__u64previous_enabled

struct kacs_priv_entry #

Total size 8 bytes.

OffsetSizeTypeField
04__u32luid
44__u32attributes

struct kacs_adjust_groups_args #

Total size 144 bytes.

OffsetSizeTypeField
04__u32count
44__u32_pad
88__u64data_ptr
16128__u64``[16]previous_state

struct kacs_duplicate_args #

Total size 16 bytes.

OffsetSizeTypeField
04__u32access_mask
44__u32token_type
84__u32impersonation_level
124__s32result_fd

struct kacs_group_entry #

Total size 8 bytes.

OffsetSizeTypeField
04__u32index
44__u32enable

struct kacs_adjust_default_args #

Total size 16 bytes.

OffsetSizeTypeField
08__u64dacl_ptr
84__u32dacl_len
122__u16owner_index
142__u16group_index

struct kacs_restrict_args #

Total size 40 bytes.

OffsetSizeTypeField
08__u64privs_to_delete
84__u32num_deny_indices
124__u32num_restrict_sids
164__u32data_len
204__u32flags
248__u64data_ptr
324__s32result_fd
364__u32_pad

struct kacs_link_tokens_args #

Total size 16 bytes.

OffsetSizeTypeField
04__s32elevated_fd
44__s32filtered_fd
88__u64logon_session_id

struct kacs_get_linked_token_args #

Total size 4 bytes.

OffsetSizeTypeField
04__s32result_fd

Token constants #

From uapi/pkm/token.h.

kacs_open_self_token (SYS_KACS_OPEN_SELF_TOKEN) flags.

ConstantValue
KACS_TOKEN_OPEN_REAL0x01 (1)

Per-handle token rights (the low 16 bits of a token access mask).

ConstantValue
KACS_TOKEN_ASSIGN_PRIMARY0x0001 (1)
KACS_TOKEN_DUPLICATE0x0002 (2)
KACS_TOKEN_IMPERSONATE0x0004 (4)
KACS_TOKEN_QUERY0x0008 (8)
KACS_TOKEN_QUERY_SOURCE0x0010 (16)
KACS_TOKEN_ADJUST_PRIVS0x0020 (32)
KACS_TOKEN_ADJUST_GROUPS0x0040 (64)
KACS_TOKEN_ADJUST_DEFAULT0x0080 (128)
KACS_TOKEN_ADJUST_INTERACTIVITY_SCOPE0x0100 (256)
KACS_TOKEN_ALL_ACCESS0x000F01FF

Token ioctl interface identifier.

ConstantValue
KACS_IOC_MAGIC0x4B (75)

kacs_priv_entry.attributes bits.

ConstantValue
KACS_PRIVILEGE_ATTR_ENABLED0x00000002 (2)
KACS_PRIVILEGE_ATTR_REMOVED0x00000004 (4)

kacs_adjust_privs bulk-reset flag (not a per-entry attribute).

ConstantValue
KACS_PRIVILEGE_RESET_ALL_DEFAULTS0x80000000

kacs_restrict_args.flags bits.

ConstantValue
KACS_TOKEN_RESTRICT_WRITE_RESTRICTED0x00000001 (1)

Token type (KACS_TOKEN_CLASS_TYPE).

ConstantValue
KACS_TOKEN_TYPE_PRIMARY0x01 (1)
KACS_TOKEN_TYPE_IMPERSONATION0x02 (2)

Impersonation level (KACS_TOKEN_CLASS_IMPERSONATION_LEVEL).

ConstantValue
KACS_IMLEVEL_ANONYMOUS0x00 (0)
KACS_IMLEVEL_IDENTIFICATION0x01 (1)
KACS_IMLEVEL_IMPERSONATION0x02 (2)
KACS_IMLEVEL_DELEGATION0x03 (3)

Elevation type (KACS_TOKEN_CLASS_ELEVATION_TYPE).

ConstantValue
KACS_ELEVATION_DEFAULT0x01 (1)
KACS_ELEVATION_FULL0x02 (2)
KACS_ELEVATION_LIMITED0x03 (3)

Mandatory-policy bits (KACS_TOKEN_CLASS_MANDATORY_POLICY).

ConstantValue
KACS_TOKEN_MANDATORY_POLICY_NO_WRITE_UP0x00000001 (1)
KACS_TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN0x00000002 (2)

Per-token audit-policy bits — the create-token spec audit_policy field (KACS_TOKEN_SPEC_OFF_AUDIT_POLICY). They select which access-check outcomes the token's object accesses generate audit events for.

ConstantValue
KACS_AUDIT_POLICY_OBJECT_ACCESS_SUCCESS0x00000001 (1)
KACS_AUDIT_POLICY_OBJECT_ACCESS_FAILURE0x00000002 (2)
KACS_AUDIT_POLICY_PRIVILEGE_USE_SUCCESS0x00000004 (4)
KACS_AUDIT_POLICY_PRIVILEGE_USE_FAILURE0x00000008 (8)

Logon type (KACS_TOKEN_CLASS_LOGON_TYPE).

ConstantValue
KACS_LOGON_TYPE_INTERACTIVE2
KACS_LOGON_TYPE_NETWORK3
KACS_LOGON_TYPE_BATCH4
KACS_LOGON_TYPE_SERVICE5
KACS_LOGON_TYPE_NETWORK_CLEARTEXT8
KACS_LOGON_TYPE_NEW_CREDENTIALS9
KACS_LOGON_TYPE_REMOTE_INTERACTIVE10

Maximum number of groups a token may carry.

ConstantValue
KACS_TOKEN_MAX_GROUPS1024

Number of 64-bit words in a group enabled-state bitmask (KACS_TOKEN_MAX_GROUPS / 64).

ConstantValue
KACS_TOKEN_GROUP_MASK_WORDS16

kacs_create_token (SYS_KACS_CREATE_TOKEN) spec wire format.

The (spec, len) buffer the syscall consumes is a fixed KACS_TOKEN_SPEC_HEADER_BYTES-byte header followed by variable-length sections at header-specified byte offsets. An offset/length (or offset/count) pair that is both zero means the section is absent. Sections may appear in any order; every offset+length is validated to fall within the buffer. The header is not a C struct (it carries packed mixed-width fields and crosses the syscall boundary as raw bytes); read each field at its KACS_TOKEN_SPEC_OFF_* offset. Its fields, in order: __u32 version must be KACS_TOKEN_SPEC_VERSION _u8 token_type KACS_TOKEN_TYPE _u8 impersonation_level KACS_IMLEVEL __u8 _reserved0[2] must be 0 __u32 integrity_rid integrity-level RID _u32 mandatory_policy KACS_TOKEN_MANDATORY_POLICY* bits _u64 privs_present privilege bitmask (KACS_SE*_PRIVILEGE) __u64 privs_enabled initially enabled privileges (subset) __u32 _reserved1 must be 0 (elevation set only by LINK_TOKENS) __u32 projected_uid Linux UID for credential projection __u32 projected_gid Linux GID for credential projection __u32 audit_policy per-token audit flags __u64 expiration expiry timestamp (0 = none) __u64 logon_session_id logon session ID (auth_id) __u32 owner_sid_index 0 = user SID, 1..N = caller group __u32 primary_group_index 0 = user SID, 1..N = caller group __u8 source_name[8] token source name __u64 source_id token source LUID __u32 user_sid_offset byte offset to the user SID __u32 groups_offset byte offset to the groups array __u32 groups_count number of group entries __u32 default_dacl_offset byte offset to the default DACL (0 = none) __u32 default_dacl_len default DACL byte length (0 = none) __u32 user_claims_offset byte offset to user claims (0 = none) __u32 user_claims_len user claims byte length (0 = none) __u32 device_claims_offset byte offset to device claims (0 = none) __u32 device_claims_len device claims byte length (0 = none) __u32 device_groups_offset byte offset to device groups (0 = none) __u32 device_groups_count number of device-group entries (0 = none) __u32 restricted_sids_offset byte offset to restricted SIDs (0 = none) __u32 restricted_sids_count number of restricted-SID entries (0 = none) __u32 confinement_sid_offset byte offset to confinement SID (0 = none) __u32 confinement_sid_len confinement SID byte length (0 = none) __u32 confinement_caps_offset byte offset to confinement caps (0 = none) __u32 confinement_caps_count number of confinement-cap entries (0 = none) __u8 confinement_exempt 1 = exempt from confinement __u8 write_restricted 1 = write-restricted mode __u8 user_deny_only 1 = user SID matches deny ACEs only __u8 isolation_boundary 1 = enable namespace filtering __u32 supp_gids_offset byte offset to supplementary GIDs (0 = none) __u32 supp_gids_count number of supplementary-GID entries (0 = none) __u32 restricted_device_groups_offset byte offset (0 = none) __u32 restricted_device_groups_count entry count (0 = none) __u64 origin originating logon-session LUID (0 = none) __u32 interactivity_scope interactive session number __u32 lcs_credentials_offset byte offset to the LCS extension (0 = none) A group/device-group/restricted- SID/confinement-cap/restricted-device-group entry is [__u32 sid_len][__u8 sid[sid_len]][__u32 attributes]. A supplementary-GIDs section is supp_gids_count little-endian __u32 GIDs. All multi-byte header and section scalars are little-endian.

ConstantValue
KACS_TOKEN_SPEC_VERSION2
KACS_TOKEN_SPEC_HEADER_BYTES192
KACS_TOKEN_SPEC_MIN_BYTES192
KACS_TOKEN_SPEC_MAX_BYTES65536

Byte offsets of the fixed token-spec header fields.

ConstantValue
KACS_TOKEN_SPEC_OFF_VERSION0
KACS_TOKEN_SPEC_OFF_TOKEN_TYPE4
KACS_TOKEN_SPEC_OFF_IMPERSONATION_LEVEL5
KACS_TOKEN_SPEC_OFF_RESERVED06
KACS_TOKEN_SPEC_OFF_INTEGRITY_RID8
KACS_TOKEN_SPEC_OFF_MANDATORY_POLICY12
KACS_TOKEN_SPEC_OFF_PRIVS_PRESENT16
KACS_TOKEN_SPEC_OFF_PRIVS_ENABLED24
KACS_TOKEN_SPEC_OFF_RESERVED132
KACS_TOKEN_SPEC_OFF_PROJECTED_UID36
KACS_TOKEN_SPEC_OFF_PROJECTED_GID40
KACS_TOKEN_SPEC_OFF_AUDIT_POLICY44
KACS_TOKEN_SPEC_OFF_EXPIRATION48
KACS_TOKEN_SPEC_OFF_LOGON_SESSION_ID56
KACS_TOKEN_SPEC_OFF_OWNER_SID_INDEX64
KACS_TOKEN_SPEC_OFF_PRIMARY_GROUP_INDEX68
KACS_TOKEN_SPEC_OFF_SOURCE_NAME72
KACS_TOKEN_SPEC_OFF_SOURCE_ID80
KACS_TOKEN_SPEC_OFF_USER_SID_OFFSET88
KACS_TOKEN_SPEC_OFF_GROUPS_OFFSET92
KACS_TOKEN_SPEC_OFF_GROUPS_COUNT96
KACS_TOKEN_SPEC_OFF_DEFAULT_DACL_OFFSET100
KACS_TOKEN_SPEC_OFF_DEFAULT_DACL_LEN104
KACS_TOKEN_SPEC_OFF_USER_CLAIMS_OFFSET108
KACS_TOKEN_SPEC_OFF_USER_CLAIMS_LEN112
KACS_TOKEN_SPEC_OFF_DEVICE_CLAIMS_OFFSET116
KACS_TOKEN_SPEC_OFF_DEVICE_CLAIMS_LEN120
KACS_TOKEN_SPEC_OFF_DEVICE_GROUPS_OFFSET124
KACS_TOKEN_SPEC_OFF_DEVICE_GROUPS_COUNT128
KACS_TOKEN_SPEC_OFF_RESTRICTED_SIDS_OFFSET132
KACS_TOKEN_SPEC_OFF_RESTRICTED_SIDS_COUNT136
KACS_TOKEN_SPEC_OFF_CONFINEMENT_SID_OFFSET140
KACS_TOKEN_SPEC_OFF_CONFINEMENT_SID_LEN144
KACS_TOKEN_SPEC_OFF_CONFINEMENT_CAPS_OFFSET148
KACS_TOKEN_SPEC_OFF_CONFINEMENT_CAPS_COUNT152
KACS_TOKEN_SPEC_OFF_CONFINEMENT_EXEMPT156
KACS_TOKEN_SPEC_OFF_WRITE_RESTRICTED157
KACS_TOKEN_SPEC_OFF_USER_DENY_ONLY158
KACS_TOKEN_SPEC_OFF_ISOLATION_BOUNDARY159
KACS_TOKEN_SPEC_OFF_SUPP_GIDS_OFFSET160
KACS_TOKEN_SPEC_OFF_SUPP_GIDS_COUNT164
KACS_TOKEN_SPEC_OFF_RESTRICTED_DEVICE_GROUPS_OFFSET168
KACS_TOKEN_SPEC_OFF_RESTRICTED_DEVICE_GROUPS_COUNT172
KACS_TOKEN_SPEC_OFF_ORIGIN176
KACS_TOKEN_SPEC_OFF_INTERACTIVITY_SCOPE184
KACS_TOKEN_SPEC_OFF_LCS_CREDENTIALS_OFFSET188

Byte length of the fixed token-source-name field.

ConstantValue
KACS_TOKEN_SPEC_SOURCE_NAME_BYTES8

Optional LCS registry-credentials extension, located at the token-spec header's lcs_credentials_offset. The section is a fixed KACS_TOKEN_LCS_EXT_HEADER_BYTES-byte header bounded by the next active variable-section offset or the end of the spec; it is consumed exactly (trailing bytes are malformed). Header fields, in order: __u32 version must be KACS_TOKEN_LCS_EXT_VERSION __u32 _reserved must be 0 __u32 scope_count private hive scope GUIDs (<= max) __u32 private_layer_count private layer names (<= max) Payload: scope_count raw 16-byte GUIDs, then private_layer_count little-endian __u32 name byte lengths, then the concatenated UTF-8 layer names. Scope GUIDs must be non-nil and unique; layer names must be 1.. KACS_TOKEN_LCS_MAX_LAYER_NAME_BYTES bytes, must not contain '\', '/', or NUL, and must be unique under case-insensitive matching.

ConstantValue
KACS_TOKEN_LCS_EXT_VERSION1
KACS_TOKEN_LCS_EXT_HEADER_BYTES16
KACS_TOKEN_LCS_SCOPE_GUID_BYTES16
KACS_TOKEN_LCS_MAX_SCOPE_GUIDS256
KACS_TOKEN_LCS_MAX_PRIVATE_LAYERS256
KACS_TOKEN_LCS_MAX_LAYER_NAME_BYTES255

Byte offsets of the fixed LCS-extension header fields.

ConstantValue
KACS_TOKEN_LCS_EXT_OFF_VERSION0
KACS_TOKEN_LCS_EXT_OFF_RESERVED4
KACS_TOKEN_LCS_EXT_OFF_SCOPE_COUNT8
KACS_TOKEN_LCS_EXT_OFF_PRIVATE_LAYER_COUNT12

kacs_create_logon_session (SYS_KACS_CREATE_LOGON_SESSION) spec wire format.

The (spec, len) buffer the syscall consumes is, in order: _u8 logon_type one of KACS_LOGON_TYPE* above __le16 auth_pkg_len byte length of the auth-package name __u8 auth_pkg[auth_pkg_len] auth-package name (valid UTF-8) __le32 user_sid_len byte length of the user SID __u8 user_sid[user_sid_len] binary SID of the authenticated user The buffer is consumed exactly: 7 + auth_pkg_len + user_sid_len must equal len. The kernel assigns the session ID and derives the logon SID from it.

ConstantValue
KACS_LOGON_SESSION_SPEC_MIN_BYTES15
KACS_LOGON_SESSION_SPEC_MAX_BYTES4096

Byte offsets of the fixed-position session-spec fields.

ConstantValue
KACS_LOGON_SESSION_SPEC_OFF_LOGON_TYPE0
KACS_LOGON_SESSION_SPEC_OFF_AUTH_PKG_LEN1
KACS_LOGON_SESSION_SPEC_OFF_AUTH_PKG3

Token-handle ioctls.

ConstantValue
KACS_IOC_QUERY0xC0104B00
KACS_IOC_ADJUST_PRIVS0x40184B01
KACS_IOC_DUPLICATE0xC0104B02
KACS_IOC_INSTALL0x00004B03
KACS_IOC_RESTRICT0xC0284B04
KACS_IOC_LINK_TOKENS0x40104B05
KACS_IOC_GET_LINKED_TOKEN0xC0044B06
KACS_IOC_ADJUST_GROUPS0x40904B07
KACS_IOC_IMPERSONATE0x00004B08
KACS_IOC_ADJUST_DEFAULT0x40104B09
KACS_IOC_ADJUST_INTERACTIVITY_SCOPE0x40044B0A

Token information classes (kacs_query_args.token_class).

GUID returns 16 immutable raw bytes in the same order as KMES headers.

ConstantValue
KACS_TOKEN_CLASS_USER0x01 (1)
KACS_TOKEN_CLASS_GROUPS0x02 (2)
KACS_TOKEN_CLASS_PRIVILEGES0x03 (3)
KACS_TOKEN_CLASS_TYPE0x04 (4)
KACS_TOKEN_CLASS_INTEGRITY_LEVEL0x05 (5)
KACS_TOKEN_CLASS_OWNER0x06 (6)
KACS_TOKEN_CLASS_PRIMARY_GROUP0x07 (7)
KACS_TOKEN_CLASS_INTERACTIVITY_SCOPE0x08 (8)
KACS_TOKEN_CLASS_RESTRICTED_SIDS0x09 (9)
KACS_TOKEN_CLASS_SOURCE0x0A (10)
KACS_TOKEN_CLASS_STATISTICS0x0B (11)
KACS_TOKEN_CLASS_ORIGIN0x0C (12)
KACS_TOKEN_CLASS_ELEVATION_TYPE0x0D (13)
KACS_TOKEN_CLASS_DEVICE_GROUPS0x0E (14)
KACS_TOKEN_CLASS_APPCONTAINER_SID0x0F (15)
KACS_TOKEN_CLASS_CAPABILITIES0x10 (16)
KACS_TOKEN_CLASS_MANDATORY_POLICY0x11 (17)
KACS_TOKEN_CLASS_LOGON_TYPE0x12 (18)
KACS_TOKEN_CLASS_LOGON_SID0x13 (19)
KACS_TOKEN_CLASS_DEFAULT_DACL0x14 (20)
KACS_TOKEN_CLASS_IMPERSONATION_LEVEL0x15 (21)
KACS_TOKEN_CLASS_USER_CLAIMS0x16 (22)
KACS_TOKEN_CLASS_DEVICE_CLAIMS0x17 (23)
KACS_TOKEN_CLASS_PROJECTED_SUPPLEMENTARY_GIDS0x18 (24)
KACS_TOKEN_CLASS_GUID0x19 (25)

Privileges, as single-bit masks within a token's 64-bit privilege word (present / enabled / enabled-by-default / used are each one such word). Named for the Windows privilege identifiers (SeTcbPrivilege, …).

ConstantValue
KACS_SE_CREATE_TOKEN_PRIVILEGE4
KACS_SE_ASSIGN_PRIMARY_TOKEN_PRIVILEGE8
KACS_SE_LOCK_MEMORY_PRIVILEGE16
KACS_SE_INCREASE_QUOTA_PRIVILEGE32
KACS_SE_TCB_PRIVILEGE128
KACS_SE_SECURITY_PRIVILEGE256
KACS_SE_TAKE_OWNERSHIP_PRIVILEGE512
KACS_SE_LOAD_DRIVER_PRIVILEGE1024
KACS_SE_SYSTEM_PROFILE_PRIVILEGE2048
KACS_SE_SYSTEMTIME_PRIVILEGE4096
KACS_SE_PROFILE_SINGLE_PROCESS_PRIVILEGE8192
KACS_SE_INCREASE_BASE_PRIORITY_PRIVILEGE16384
KACS_SE_BACKUP_PRIVILEGE131072
KACS_SE_RESTORE_PRIVILEGE262144
KACS_SE_SHUTDOWN_PRIVILEGE524288
KACS_SE_DEBUG_PRIVILEGE0x100000 (1048576)
KACS_SE_AUDIT_PRIVILEGE0x200000 (2097152)
KACS_SE_CHANGE_NOTIFY_PRIVILEGE0x800000 (8388608)
KACS_SE_REMOTE_SHUTDOWN_PRIVILEGE0x1000000 (16777216)
KACS_SE_MANAGE_VOLUME_PRIVILEGE0x10000000 (268435456)
KACS_SE_IMPERSONATE_PRIVILEGE0x20000000 (536870912)
KACS_SE_RELABEL_PRIVILEGE0x100000000 (4294967296)
KACS_SE_CREATE_SYMBOLIC_LINK_PRIVILEGE0x800000000 (34359738368)
KACS_SE_LOCK_PARENTAGE_PRIVILEGE0x2000000000000000 (2305843009213693952)

Generated access-check and descriptor ABI

Peios Kernel / Userspace interfaces / Native interfaces / KACS

struct kacs_subject_request #

Total size 152 bytes.

OffsetSizeTypeField
04__u32version
44__u32total_bytes
84__u32flags
124__u32known_groups
164__u32desired_access
204__u32mapping_read
244__u32mapping_write
284__u32mapping_execute
324__u32mapping_all
364__u32object_index
404__u32complete_claims
444__u32reserved
48104__u32``[26]sections

struct kacs_subject_result #

Total size 12 bytes.

OffsetSizeTypeField
04__u32decision
44__u32granted
84__u32missing

struct kacs_access_check_args #

Total size 136 bytes.

OffsetSizeTypeField
04__u32caller_size
44__s32token_fd
88__u64sd_ptr
164__u32sd_len
204__u32desired_access
244__u32mapping_read
284__u32mapping_write
324__u32mapping_execute
364__u32mapping_all
408__u64self_sid_ptr
484__u32self_sid_len
524__u32privilege_intent
568__u64object_tree_ptr
644__u32object_tree_count
684__u32_pad0
728__u64local_claims_ptr
804__u32local_claims_len
844__u32_pad1
888__u64granted_out_ptr
964__u32pip_type
1004__u32pip_trust
1048__u64audit_context_ptr
1124__u32audit_context_len
1164__u32_pad2
1208__u64continuous_audit_out_ptr
1288__u64staging_mismatch_out_ptr

struct kacs_object_type_entry #

Total size 20 bytes.

OffsetSizeTypeField
02__u16level
22__u16_reserved
416__u8``[16]guid

struct kacs_node_result #

Total size 8 bytes.

OffsetSizeTypeField
04__u32granted
44__s32status

struct kacs_generic_mapping #

Total size 16 bytes.

OffsetSizeTypeField
04__u32read
44__u32write
84__u32execute
124__u32all

AccessCheck constants #

From uapi/pkm/access.h.

Full size of kacs_access_check_args the current kernel copies.

ConstantValue
KACS_ACCESS_CHECK_ARGS_SIZE136

Minimum caller_size the kernel accepts (the v1 / v0.20 layout).

ConstantValue
KACS_ACCESS_CHECK_ARGS_V1_SIZE40

Byte size of one kacs_object_type_entry in the object-type tree array.

ConstantValue
KACS_OBJECT_TYPE_ENTRY_SIZE20

Largest object-audit-context buffer the kernel accepts.

ConstantValue
KACS_ACCESS_CHECK_MAX_AUDIT_CONTEXT_LEN4096

Largest @Local claims blob the kernel accepts (local_claims_ptr).

ConstantValue
KACS_ACCESS_CHECK_MAX_LOCAL_CLAIMS_LEN65536

Largest object-type tree entry count the kernel accepts.

ConstantValue
KACS_ACCESS_CHECK_MAX_OBJECT_TYPE_COUNT1024

Supplied-subject query, syscall 1028.

No token is created or adopted. One LE buffer contains this 152-byte header followed by packed sections in table order. Each pair is {offset, byte_length}; empty sections use {0,0}. Sections: SD, user SID, groups, device groups, user/device/local claims, user/device/local known-absent names, SELF SID, object tree, audit context. Groups use repeated {u32 sid_len, SID bytes, u32 attributes}; claims use repeated {u32 entry_len, typed claim entry}; absent names use {u32 len, UTF8}. Known bits 0/1 distinguish known-empty user/device groups from unknown. Coverage bits 0/1/2 mark complete user/device/local claim sets; otherwise omitted claim names remain unknown unless listed explicitly as absent. Unknown flags/bits, nonzero reserved fields, gaps/overlap/trailing bytes, invalid or excessive collections fail the entire request. No truncation. Typed claims are at most 64 KiB per namespace, 1024 values per attribute; the sum of entry_bytes * max(value_count, 1), including SD resource claims, is at most 1 MiB, bounding repeated-offset decoding before allocation. Absent names are 1..255 UTF8 bytes; each collection has at most 1024 items.

ConstantValue
KACS_SUBJECT_VERSION1
KACS_SUBJECT_HEADER_BYTES152
KACS_SUBJECT_MAX_BYTES0x100000 (1048576)
KACS_SUBJECT_MAX_ITEMS1024
KACS_SUBJECT_NO_AUDIT1

Claim value types — the discriminant of one attribute in the @Local claims array (local_claims_ptr).

ConstantValue
KACS_CLAIM_TYPE_INT640x0001 (1)
KACS_CLAIM_TYPE_UINT640x0002 (2)
KACS_CLAIM_TYPE_STRING0x0003 (3)
KACS_CLAIM_TYPE_SID0x0005 (5)
KACS_CLAIM_TYPE_BOOLEAN0x0006 (6)
KACS_CLAIM_TYPE_OCTET0x0010 (16)

Claim attribute flags.

ConstantValue
KACS_CLAIM_ATTR_CASE_SENSITIVE0x0002 (2)
KACS_CLAIM_ATTR_USE_FOR_DENY_ONLY0x0004 (4)
KACS_CLAIM_ATTR_DISABLED0x0010 (16)

Central Access Policy (CAAP) spec wire format — the (spec, spec_len) buffer kacs_set_caap (SYS_KACS_SET_CAAP) consumes. A non-empty spec replaces the policy identified by the call's policy SID; a NULL/zero spec removes it. The buffer is a fixed prefix followed by rule_count per-rule sections, and is consumed exactly (trailing bytes are rejected). It is not a C struct (the rule sections are variable-length); read it as raw bytes: __u8 version must be KACS_CAAP_SPEC_VERSION __le32 rule_count number of rules that follow (<= max) rule_count * { __le32 applies_to_len [__u8 applies_to[applies_to_len]] conditional-expression bytecode; 0 = always __le32 effective_dacl_len [__u8 effective_dacl[...]] binary ACL; length MUST be nonzero __le32 effective_sacl_len [__u8 effective_sacl[...]] (0 = none) __le32 staged_dacl_len [__u8 staged_dacl[...]] (0 = none) __le32 staged_sacl_len [__u8 staged_sacl[...]] (0 = none) } Every length- prefixed field uses a little-endian __u32 length and is bounded by KACS_CAAP_MAX_FIELD_BYTES; ACL payloads additionally parse under the security-descriptor size limit (KACS_CAAP_MAX_ACL_BYTES). ACLs use the binary ACL format from <pkm/sd.h>; applies_to is conditional-ACE bytecode.

ConstantValue
KACS_CAAP_SPEC_VERSION0x01 (1)
KACS_CAAP_MAX_SPEC_BYTES262144
KACS_CAAP_MAX_RULE_COUNT256
KACS_CAAP_MAX_FIELD_BYTES65536
KACS_CAAP_MAX_ACL_BYTES65535

Byte offsets of the fixed CAAP-spec prefix fields.

ConstantValue
KACS_CAAP_SPEC_OFF_VERSION0
KACS_CAAP_SPEC_OFF_RULE_COUNT1

Byte length of the fixed CAAP-spec prefix (version + rule_count).

ConstantValue
KACS_CAAP_SPEC_PREFIX_BYTES5

Security descriptor constants #

From uapi/pkm/sd.h.

Byte length of the self-relative security-descriptor header.

ConstantValue
KACS_SD_HEADER_BYTES20

SECURITY_INFORMATION selector bits — which components of a security descriptor a kacs_get_sd / kacs_set_sd call reads or writes.

ConstantValue
KACS_SECINFO_OWNER0x00000001 (1)
KACS_SECINFO_GROUP0x00000002 (2)
KACS_SECINFO_DACL0x00000004 (4)
KACS_SECINFO_SACL0x00000008 (8)
KACS_SECINFO_LABEL0x00000010 (16)

SECURITY_DESCRIPTOR_CONTROL bits — the SD header control field.

ConstantValue
KACS_SD_OWNER_DEFAULTED0x0001 (1)
KACS_SD_GROUP_DEFAULTED0x0002 (2)
KACS_SD_DACL_PRESENT0x0004 (4)
KACS_SD_DACL_DEFAULTED0x0008 (8)
KACS_SD_SACL_PRESENT0x0010 (16)
KACS_SD_SACL_DEFAULTED0x0020 (32)
KACS_SD_DACL_TRUSTED0x0040 (64)
KACS_SD_SERVER_SECURITY0x0080 (128)
KACS_SD_DACL_AUTO_INHERIT_REQ0x0100 (256)
KACS_SD_SACL_AUTO_INHERIT_REQ0x0200 (512)
KACS_SD_DACL_AUTO_INHERITED0x0400 (1024)
KACS_SD_SACL_AUTO_INHERITED0x0800 (2048)
KACS_SD_DACL_PROTECTED0x1000 (4096)
KACS_SD_SACL_PROTECTED0x2000 (8192)
KACS_SD_RM_CONTROL_VALID0x4000 (16384)
KACS_SD_SELF_RELATIVE0x8000 (32768)

Access-mask bits — standard rights (bits 16-24) and generic rights (bits 28-31).

The low 16 bits of a mask are object-class specific; see <pkm/file.h> and <pkm/token.h> for those.

ConstantValue
KACS_ACCESS_DELETE0x00010000 (65536)
KACS_ACCESS_READ_CONTROL0x00020000
KACS_ACCESS_WRITE_DAC0x00040000
KACS_ACCESS_WRITE_OWNER0x00080000
KACS_ACCESS_SYNCHRONIZE0x00100000
KACS_ACCESS_ACCESS_SYSTEM_SECURITY0x01000000
KACS_ACCESS_MAXIMUM_ALLOWED0x02000000
KACS_ACCESS_GENERIC_ALL0x10000000
KACS_ACCESS_GENERIC_EXECUTE0x20000000
KACS_ACCESS_GENERIC_WRITE0x40000000
KACS_ACCESS_GENERIC_READ0x80000000

ACE types — the ace_type byte of an ACE header (MS-DTYP 2.4.4.1).

ConstantValue
KACS_ACE_TYPE_ACCESS_ALLOWED0x00 (0)
KACS_ACE_TYPE_ACCESS_DENIED0x01 (1)
KACS_ACE_TYPE_SYSTEM_AUDIT0x02 (2)
KACS_ACE_TYPE_SYSTEM_ALARM0x03 (3)
KACS_ACE_TYPE_ACCESS_ALLOWED_COMPOUND0x04 (4)
KACS_ACE_TYPE_ACCESS_ALLOWED_OBJECT0x05 (5)
KACS_ACE_TYPE_ACCESS_DENIED_OBJECT0x06 (6)
KACS_ACE_TYPE_SYSTEM_AUDIT_OBJECT0x07 (7)
KACS_ACE_TYPE_SYSTEM_ALARM_OBJECT0x08 (8)
KACS_ACE_TYPE_ACCESS_ALLOWED_CALLBACK0x09 (9)
KACS_ACE_TYPE_ACCESS_DENIED_CALLBACK0x0A (10)
KACS_ACE_TYPE_ACCESS_ALLOWED_CALLBACK_OBJECT0x0B (11)
KACS_ACE_TYPE_ACCESS_DENIED_CALLBACK_OBJECT0x0C (12)
KACS_ACE_TYPE_SYSTEM_AUDIT_CALLBACK0x0D (13)
KACS_ACE_TYPE_SYSTEM_ALARM_CALLBACK0x0E (14)
KACS_ACE_TYPE_SYSTEM_AUDIT_CALLBACK_OBJECT0x0F (15)
KACS_ACE_TYPE_SYSTEM_ALARM_CALLBACK_OBJECT0x10 (16)
KACS_ACE_TYPE_SYSTEM_MANDATORY_LABEL0x11 (17)
KACS_ACE_TYPE_SYSTEM_RESOURCE_ATTRIBUTE0x12 (18)
KACS_ACE_TYPE_SYSTEM_SCOPED_POLICY_ID0x13 (19)
KACS_ACE_TYPE_SYSTEM_PROCESS_TRUST_LABEL0x14 (20)
KACS_ACE_TYPE_SYSTEM_ACCESS_FILTER0x15 (21)

ACE header ace_flags byte — inheritance and audit control.

ConstantValue
KACS_ACE_FLAG_OBJECT_INHERIT0x01 (1)
KACS_ACE_FLAG_CONTAINER_INHERIT0x02 (2)
KACS_ACE_FLAG_NO_PROPAGATE_INHERIT0x04 (4)
KACS_ACE_FLAG_INHERIT_ONLY0x08 (8)
KACS_ACE_FLAG_INHERITED0x10 (16)
KACS_ACE_FLAG_SUCCESSFUL_ACCESS0x40 (64)
KACS_ACE_FLAG_FAILED_ACCESS0x80 (128)

Mandatory-label policy bits — the __le32 access mask of a KACS_ACE_TYPE_SYSTEM_MANDATORY_LABEL ACE. They control which DACL- granted rights a caller whose integrity level does not dominate the object's label (the "up" direction) is denied. Each bit suppresses the rights mapped from the corresponding generic class; unknown bits MUST be ignored.

ConstantValue
KACS_SYSTEM_MANDATORY_LABEL_NO_READ_UP0x00000001 (1)
KACS_SYSTEM_MANDATORY_LABEL_NO_WRITE_UP0x00000002 (2)
KACS_SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP0x00000004 (4)

Object-ACE body Flags field — the __le32 at object-ACE body offset 8, distinct from the 1-byte ace_flags header field above. Indicates which optional GUIDs the object-ACE body carries.

ConstantValue
KACS_ACE_OBJECT_TYPE_PRESENT0x00000001 (1)
KACS_ACE_INHERITED_OBJECT_TYPE_PRESENT0x00000002 (2)

SID constants #

From uapi/pkm/sid.h.

Largest sub_authority_count a valid SID may declare.

ConstantValue
KACS_SID_MAX_SUB_AUTHORITIES15

Encoded byte length of a SID with the given sub-authority count.

ConstantValue
KACS_SID_BYTE_LEN(count)(8 + 4 * (count))

SID_AND_ATTRIBUTES "Attributes" bits (MS-DTYP 2.4.4).

These describe how a group or restricted SID participates in an access check. MS-DTYP names them for groups; they apply to any SID_AND_ATTRIBUTES entry.

ConstantValue
KACS_SID_GROUP_MANDATORY0x00000001 (1)
KACS_SID_GROUP_ENABLED_BY_DEFAULT0x00000002 (2)
KACS_SID_GROUP_ENABLED0x00000004 (4)
KACS_SID_GROUP_OWNER0x00000008 (8)
KACS_SID_GROUP_USE_FOR_DENY_ONLY0x00000010 (16)
KACS_SID_GROUP_INTEGRITY0x00000020 (32)
KACS_SID_GROUP_INTEGRITY_ENABLED0x00000040 (64)
KACS_SID_GROUP_RESOURCE0x20000000
KACS_SID_GROUP_LOGON_ID0xC0000000

Generated file and mount ABI

Peios Kernel / Userspace interfaces / Native interfaces / KACS

struct kacs_open_how #

Total size 56 bytes.

OffsetSizeTypeField
04__u32desired_access
44__u32create_disposition
84__u32create_options
124__u32flags
168__u64sd_ptr
244__u32sd_len
284__u32share_access
3216__u8``[16]lease_key
484__s32lease_fd
524__u32__pad2

struct kacs_open_info #

Total size 16 bytes.

OffsetSizeTypeField
04__u32granted_access
44__u32share_access
84__u32flags
124__u32__pad

struct kacs_lock_args #

Total size 32 bytes.

OffsetSizeTypeField
08__u64offset
88__u64length
164__u32op
204__u32flags
248__u64cookie

struct kacs_lease_args #

Total size 32 bytes.

OffsetSizeTypeField
016__u8``[16]lease_key
164__u32state
204__u32flags
248__u64__pad

struct kacs_lease_break #

Total size 48 bytes.

OffsetSizeTypeField
016__u8``[16]lease_key
168__u64dev
248__u64ino
324__u32current_state
364__u32new_state
404__u32reason
444__u32epoch

struct kacs_mount_policy_args #

Total size 32 bytes.

OffsetSizeTypeField
04__u32policy
44__u32flags
84__u32generation
124__u32__pad0
168__u64template_sd_ptr
244__u32template_sd_len
284__u32__pad1

struct kacs_sattr #

Total size 32 bytes.

OffsetSizeTypeField
04__u32version
44__u32valid
84__u32attributes
124__u32flags
168__s64created_at_sec
244__u32created_at_nsec
284__u32__pad

mntns.h #

From uapi/pkm/mntns.h.

KACS access rights for mount namespaces.

ConstantValueNotes
KACS_MNTNS_MOUNT0x00000001 (1)change the mount table
KACS_MNTNS_ENTER0x00000002 (2)join the namespace with setns(2)
KACS_MNTNS_ALL_ACCESS917507

File and open constants #

From uapi/pkm/file.h.

The value of the special-attributes extended attribute, as read and as written.

valid names the fields a write changes; a read sets every bit. Other fields a write does not name are ignored, and __pad must be zero.

ConstantValue
KACS_SATTR_XATTR_NAME109012802569580

Minimum caller-supplied size accepted for each argument block.

ConstantValue
KACS_OPEN_HOW_MIN_SIZE16
KACS_MOUNT_POLICY_ARGS_MIN_SIZE16
KACS_OPEN_INFO_MIN_SIZE4
KACS_LOCK_ARGS_MIN_SIZE24
KACS_LEASE_ARGS_MIN_SIZE24

Sizes of each published version of kacs_open_how.

ConstantValue
KACS_OPEN_HOW_SIZE_VER032
KACS_OPEN_HOW_SIZE_VER156

Create dispositions (kacs_open_how.create_disposition).

ConstantValue
KACS_DISPOSITION_SUPERSEDE0
KACS_DISPOSITION_OPEN1
KACS_DISPOSITION_CREATE2
KACS_DISPOSITION_OPEN_IF3
KACS_DISPOSITION_OVERWRITE4
KACS_DISPOSITION_OVERWRITE_IF5

Create options (kacs_open_how.create_options).

ConstantValue
KACS_CREATE_OPT_DIRECTORY0x0001 (1)
KACS_CREATE_OPT_DELETE_ON_CLOSE0x0002 (2)

kacs_open_how.flags bits.

ConstantValue
KACS_BACKUP_INTENT0x00000001 (1)
KACS_RESTORE_INTENT0x00000002 (2)
KACS_OPEN_SHARE_ACCESS0x00000004 (4)
KACS_OPEN_LEASE_KEY0x00000008 (8)
KACS_OPEN_PIN_ANCESTORS0x00000010 (16)

Share access (kacs_open_how.share_access, kacs_open_info.share_access).

ConstantValue
KACS_FILE_SHARE_READ0x00000001 (1)
KACS_FILE_SHARE_WRITE0x00000002 (2)
KACS_FILE_SHARE_DELETE0x00000004 (4)

kacs_open_info.flags bits.

ConstantValue
KACS_OPEN_INFO_MANAGED0x00000001 (1)
KACS_OPEN_INFO_DELETE_PENDING0x00000002 (2)
KACS_OPEN_INFO_DELETE_ON_CLOSE0x00000004 (4)
KACS_OPEN_INFO_ANCESTORS_PINNED0x00000008 (8)

kacs_set_disposition flags, as FILE_DISPOSITION_INFORMATION_EX.

ConstantValue
KACS_DISPOSITION_DELETE0x00000001 (1)
KACS_DISPOSITION_POSIX_SEMANTICS0x00000002 (2)
KACS_DISPOSITION_ON_CLOSE0x00000008 (8)
KACS_DISPOSITION_IGNORE_READONLY0x00000010 (16)

kacs_rename flags, as FILE_RENAME_INFORMATION_EX.

ConstantValue
KACS_RENAME_REPLACE_IF_EXISTS0x00000001 (1)
KACS_RENAME_POSIX_SEMANTICS0x00000002 (2)
KACS_RENAME_IGNORE_READONLY0x00000040 (64)

kacs_lock_args.op values.

ConstantValue
KACS_LOCK_SHARED1
KACS_LOCK_EXCLUSIVE2
KACS_LOCK_UNLOCK3
KACS_LOCK_CANCEL4

kacs_lock_args.flags bits.

ConstantValue
KACS_LOCK_FAIL_IMMEDIATELY0x00000001 (1)

Lease states: the NT caching bits.

ConstantValue
KACS_LEASE_READ0x00000001 (1)
KACS_LEASE_HANDLE0x00000002 (2)
KACS_LEASE_WRITE0x00000004 (4)

kacs_lease_args.flags bits.

ConstantValue
KACS_LEASE_ACKNOWLEDGE0x00000001 (1)

kacs_lease_break.reason values: the operation that broke the lease.

ConstantValue
KACS_LEASE_BREAK_OPEN1
KACS_LEASE_BREAK_SHARING2
KACS_LEASE_BREAK_WRITE3
KACS_LEASE_BREAK_SIZE4
KACS_LEASE_BREAK_LOCK5
KACS_LEASE_BREAK_NAMESPACE6
KACS_LEASE_BREAK_DELETE7
KACS_LEASE_BREAK_SECURITY8
KACS_LEASE_BREAK_ATTRIBUTES9
KACS_LEASE_BREAK_CHILD10
KACS_LEASE_BREAK_TIMEOUT11

kacs_create_lease_manager flags.

ConstantValue
KACS_LEASE_MANAGER_CLOEXEC0x00000001 (1)
KACS_LEASE_MANAGER_NONBLOCK0x00000002 (2)

Break timeout applied when kacs_create_lease_manager is given zero.

ConstantValue
KACS_LEASE_DEFAULT_BREAK_TIMEOUT_MS35000

kacs_sattr.version.

ConstantValue
KACS_SATTR_VERSION1

kacs_sattr.valid bits.

ConstantValue
KACS_SATTR_VALID_ATTRIBUTES0x00000001 (1)
KACS_SATTR_VALID_CREATED_AT0x00000002 (2)

kacs_sattr.attributes bits.

ConstantValue
KACS_SATTR_READONLY0x00000001 (1)

kacs_sattr.flags bits.

On a read, CREATED_AT_SET says Created At was set explicitly rather than taken from the birth time. On a write naming KACS_SATTR_VALID_CREATED_AT, CREATED_AT_CLEAR unsets it.

ConstantValue
KACS_SATTR_CREATED_AT_SET0x00000001 (1)
KACS_SATTR_CREATED_AT_CLEAR0x00000002 (2)

File and directory object-specific access rights (the low 16 bits of a file access mask).

The directory aliases name the same bit as the file right it acts as for a directory object.

ConstantValue
KACS_FILE_READ_DATA0x00000001 (1)
KACS_FILE_WRITE_DATA0x00000002 (2)
KACS_FILE_APPEND_DATA0x00000004 (4)
KACS_FILE_READ_EA0x00000008 (8)
KACS_FILE_WRITE_EA0x00000010 (16)
KACS_FILE_EXECUTE0x00000020 (32)
KACS_FILE_DELETE_CHILD0x00000040 (64)
KACS_FILE_READ_ATTRIBUTES0x00000080 (128)
KACS_FILE_WRITE_ATTRIBUTES0x00000100 (256)
KACS_FILE_LIST_DIRECTORY1
KACS_FILE_TRAVERSE32
KACS_FILE_ADD_FILE2
KACS_FILE_ADD_SUBDIRECTORY4

Mount-policy values (kacs_mount_policy_args.policy).

ConstantValue
KACS_MOUNT_POLICY_UNMANAGED1
KACS_MOUNT_POLICY_DENY_MISSING2
KACS_MOUNT_POLICY_SYNTHESIZE_EPHEMERAL3
KACS_MOUNT_POLICY_SYNTHESIZE_PERSISTENT4

Status word kacs_open writes back, describing what happened to the file.

ConstantValue
KACS_STATUS_OPENED1
KACS_STATUS_CREATED2
KACS_STATUS_OVERWRITTEN3
KACS_STATUS_SUPERSEDED4

Status word kacs_open writes back when it fails, naming the NT condition behind the errno where one errno covers several.

ConstantValue
KACS_STATUS_SHARING_VIOLATION0x10 (16)
KACS_STATUS_DELETE_PENDING0x11 (17)
KACS_STATUS_CANNOT_DELETE0x12 (18)

Generated socket and IPC ABI

Peios Kernel / Userspace interfaces / Native interfaces / KACS

socket.h #

From uapi/pkm/socket.h.

KACS socket options — peer identity on local sockets.

KACS captures a connecting client's identity onto the accepted end of an AF_UNIX SOCK_STREAM / SOCK_SEQPACKET connection at connect(). This header is the setsockopt(2)/getsockopt(2) surface through which that identity is bounded and read back. Every option lives under one option level, SOL_KACS, which the kernel dispatches ahead of the protocol's own setsockopt/getsockopt (net/socket.c), so the options behave identically on every socket family that supports them. SOL_KACS is 4096: far above the upstream SOL_* range, which grows by one per new protocol, so it cannot collide with a future Linux level. Errors: -ENOPROTOOPT for an option this level does not define (or a get-only option passed to setsockopt); -EOPNOTSUPP on a socket family KACS does not carry identity on (and, for the register, on a socket type that has none); -EINVAL for a short optlen or an out-of-range value; -EFAULT for an unreadable/unwritable optval.

ConstantValue
SOL_KACS4096

getsockopt only.

optval: int — a new token fd, carrying fixed TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE access and opened O_CLOEXEC, for this end's conveyed-identity register: the peer identity associated with the data this end has consumed so far. The register is initialised at connect() — on the accepted end with the client's identity, on the connecting end with the listener's identity as captured at listen() (at KACS_IMLEVEL_IDENTIFICATION unless the listener set its own level) — and advanced by each KACS_SCM_TOKEN the reader's position passes (a token still queued but unread is not yet visible). Every call returns a fresh fd to an immutable snapshot; two calls may name different tokens, but no token ever changes. -ENOTCONN if the socket is not connected; -ENODATA if nothing has been conveyed yet.

ConstantValue
KACS_SO_PEER_TOKEN1

getsockopt / setsockopt.

optval: _u32 KACS_IMLEVEL* — the maximum impersonation level at which identity leaving this end may be captured: at connect(), and at each send that conveys identity. The default is KACS_IMLEVEL_IMPERSONATION. May be changed at any time; a change bounds captures from then on and never rewrites one already made.

ConstantValue
KACS_SO_IMPERSONATION_LEVEL2

getsockopt / setsockopt.

optval: int (0/1) — sender-side automation: while set, every send from this end carries the sender's effective identity as a KACS_SCM_TOKEN, derived at this end's impersonation level. Costs nothing at the trust level: the sender can always attest to what it is. Default 0.

ConstantValue
KACS_SO_PASS_TOKEN3

setsockopt only.

optval: int, ignored. Self-gated: a process can always attest to what it is. On a listening AF_UNIX socket: replaces the identity the listener conveys to connecting clients — captured when listen() was called — with the caller's current effective identity, at the listener's level. For a process that receives a listener it did not create (from a descriptor store after a restart, or from a broker), so that clients see the process actually accepting. -EINVAL if the socket is not listening. On an AF_INET / AF_INET6 socket, in any state: replaces the identity that governs the socket's traffic for network policy — stamped at creation, bind, listen, connect and accept — with the caller's current effective identity, so a socket handed to another program (socket activation, descriptor passing) is governed as that program's. The identity is read by the network policy engine at the first judgment of each flow and fixed for that flow's life.

ConstantValue
KACS_SO_RESTAMP4

Ancillary message type, at cmsg_level SOL_KACS.

Data: one int. Received: a token fd (TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE, O_CLOEXEC) for the identity the kernel attests sent the accompanying data. Delivered when the receive buffer has room for it and the conveyed identity differs from the reader's register; a receiver that reads no ancillary data still has the register (KACS_SO_PEER_TOKEN). Sent: a token fd the sender wishes to attach to the data. The kernel gates the send as if the sender were impersonating that token: the two-gate model runs with the sender as installer, and an attach that would lower the token's level fails with -EPERM rather than downgrading. A primary token is derived to an impersonation token at this end's level. The fd must carry TOKEN_IMPERSONATE (-EACCES otherwise); at most one per message (-EINVAL). Attaching is exactly equivalent to impersonating the token for the duration of the send.

ConstantValue
KACS_SCM_TOKEN1

ipc.h #

From uapi/pkm/ipc.h.

KACS access rights for System V IPC objects — message queues, shared memory segments and semaphore arrays. Every SysV object carries a security descriptor, created from the creator's token at *get time and enforced through the LSM IPC hooks; the nine-bit ipc_perm mode is never consulted (CAP_IPC_OWNER is in KACS's always-allow set). The key namespace is claim-on-create: the descriptor protects the object, nothing protects the name. Object-specific rights (low 16 bits); the standard rights (DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER — <pkm/access.h>) apply as on every KACS object.

ConstantValueNotes
KACS_IPC_READ0x00000001 (1)msgrcv, shmat read-only, semop without alter, GETVAL/GETALL
KACS_IPC_WRITE0x00000002 (2)msgsnd, shmat read-write, semop with alter, SETVAL/SETALL
KACS_IPC_QUERY_INFORMATION0x00000004 (4)IPC_STAT and the *_STAT variants
KACS_IPC_SET_INFORMATION0x00000008 (8)SHM_LOCK / SHM_UNLOCK
KACS_IPC_ALL_ACCESS983055

ipcctl gates: IPC_RMID needs DELETE; IPC_SET needs WRITE_DAC and WRITE_OWNER (one command carries mode, uid and gid); the mode, uid and gid it writes are informational (ipcs, IPC_STAT) and never decide access. Addressing a SysV object's descriptor with kacs_get_sd / kacs_set_sd: pass one of these in flags, the object id in dirfd, and a NULL path. The object is looked up in the caller's IPC namespace.

ConstantValue
KACS_SD_AT_SYSV_SHM0x01000000
KACS_SD_AT_SYSV_MSG0x02000000
KACS_SD_AT_SYSV_SEM0x04000000
KACS_SD_AT_SYSV_MASK117440512

Generated process and PSB ABI

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Process access rights #

From uapi/pkm/process.h.

KACS process object-specific access rights (the low 16 bits of a process access mask).

Named for the Windows process rights; an access check folds the generic bits (<pkm/sd.h>) into these via the process generic mapping.

ConstantValue
KACS_PROCESS_TERMINATE0x00000001 (1)
KACS_PROCESS_SIGNAL0x00000002 (2)
KACS_PROCESS_VM_READ0x00000010 (16)
KACS_PROCESS_VM_WRITE0x00000020 (32)
KACS_PROCESS_DUP_HANDLE0x00000040 (64)
KACS_PROCESS_SET_INFORMATION0x00000200 (512)
KACS_PROCESS_QUERY_INFORMATION0x00000400 (1024)
KACS_PROCESS_SUSPEND_RESUME0x00000800 (2048)
KACS_PROCESS_QUERY_LIMITED0x00001000 (4096)

Process mitigation bits #

From uapi/pkm/psb.h.

Process Security Block (PSB) process-mitigation bits.

The mitigations argument of kacs_set_psb (SYS_KACS_SET_PSB) is a bitmask of these flags. Setting a bit is activation-backed: KACS either places the target process in the protected state (or verifies it already satisfies the invariant) before committing, and rejects later operations that would disable the protection. Each mitigation is enforced at its own enforcement point and persists across exec. See Kernel TRM section 3.3 (Process Security Block). Only the bits in KACS_MIT_ALL are valid; any other bit set in the request is rejected. KACS_MIT_CFI is a legacy alias: requesting it sets both KACS_MIT_CFIF and KACS_MIT_CFIB, and the alias bit itself is not retained.

ConstantValueNotes
KACS_MIT_WXP0x001 (1)Write-XOR-Execute protection
KACS_MIT_TLP0x002 (2)Trusted Library Paths
KACS_MIT_LSV0x004 (4)Library Signature Verification
KACS_MIT_CFI0x008 (8)legacy alias: CFIF | CFIB
KACS_MIT_UI_ACCESS0x010 (16)UI interaction (reserved)
KACS_MIT_NO_CHILD0x020 (32)cannot fork (one-way)
KACS_MIT_CFIF0x040 (64)forward-edge CFI (Intel IBT)
KACS_MIT_CFIB0x080 (128)backward-edge CFI (shadow stack)
KACS_MIT_PIE0x100 (256)reject non-PIE binaries at exec
KACS_MIT_SML0x200 (512)speculation mitigation lock

All valid mitigation bits OR'd together — the accepted-request mask.

ConstantValue
KACS_MIT_ALL0x3FF (1023)

Generated diagnostic constants

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Tracepoint diagnostic codes #

From uapi/pkm/trace.h.

kacs_access_decision reason — why a KACS access hook took the return path it did.

Emitted by the kacs:kacs_file_access / _file_open / _native_open _inode_file_access / _inode_permission events. Verdict (allow vs deny) is a separate signal, read from the ret field (0 == allow).

ConstantValueNotes
KACS_TR_DECISION0resolved allow/deny
KACS_TR_BAD_ARGS1NULL/zero argument guard
KACS_TR_NO_ISEC2inode has no i_security blob
KACS_TR_UNMANAGED3superblock mount policy UNMANAGED
KACS_TR_PIP_CONTEXT4current PIP context unavailable
KACS_TR_NO_TOKEN5no effective subject token
KACS_TR_NO_DENTRY_ALIAS6inode has no dentry alias yet
KACS_TR_DELETE_ON_CLOSE_PENDING7open of a delete-on-close file
KACS_TR_NATIVE_STAMP8native-open granted-access stamp
KACS_TR_NATIVE_ARM9native-open delete-on-close arm
KACS_TR_STAMP10legacy-open granted-access stamp
KACS_TR_LAZY_DENTRY_RELOOKUP11native create lazy re-lookup
KACS_TR_NEGATIVE_AFTER_CREATE12negative dentry after create
KACS_TR_CHANGE_NOTIFY_PRIV13traverse via CHANGE_NOTIFY priv
KACS_TR_CHANGE_NOTIFY_PRIV_EXHAUSTED14CHANGE_NOTIFY priv use exhausted
KACS_TR_NT_SHARE15NT share registration refused the open
KACS_TR_NT_SHARE_OVERRIDE16backup/restore intent set a share denial aside

kacs_sd_cache reason — the inode security-descriptor cache outcome.

The lookup miss codes disambiguate the three cache-absent paths that were previously an indistinguishable NULL return (no cache / stale generation missing-but-synthesis-required); the corrupt codes name why a stored SD was rejected. Emitted by kacs:kacs_sd_cache_lookup / _corrupt.

ConstantValueNotes
KACS_SDC_HIT0current, valid cache present
KACS_SDC_MISS_NONE1no cache attached
KACS_SDC_MISS_STALE_GEN2cache present but stale generation
KACS_SDC_MISS_NEEDS_SYNTH3missing SD requires synthesis
KACS_SDC_CORRUPT_EMPTY_OR_OVERSIZE4stored SD zero-length or oversize
KACS_SDC_CORRUPT_VALIDATE_FAIL5stored SD failed validation

kacs_process_access reason — the outcome of a cross-process access decision (signal, ptrace, scheduler/attribute, prlimit). The reason distinguishes the paths that all surface as -EACCES: an SD denial, a PIP-based denial, a denial rescued (or not) by SeDebugPrivilege, and a PIP-dominance failure. Emitted by kacs:kacs_process_access.

ConstantValueNotes
KACS_PA_ALLOW0access granted
KACS_PA_BAD_ARGS1NULL subject/target guard
KACS_PA_NO_TARGET2target has no process state/SD
KACS_PA_NO_SD3target process SD unavailable
KACS_PA_SD_ERROR4SD check failed (non-EACCES)
KACS_PA_PIP_DENIED5denied by process-integrity policy
KACS_PA_DEBUG_RESCUE6SD denial rescued by SeDebugPrivilege
KACS_PA_DEBUG_DENIED7denied; no usable SeDebugPrivilege
KACS_PA_PIP_DOMINANCE8caller PIP does not dominate target

kacs_exec reason — an exec/bprm credential or PIP transition.

Distinguishes the uid/gid-change gate outcomes, the exec primary-token derivation paths and their failures, the exec file integrity-label lookup failures, and the two commit-time transitions. Verdict is the ret field. Emitted by kacs:kacs_exec.

ConstantValueNotes
KACS_EXEC_CREDS_ALLOW0exec cred transition allowed
KACS_EXEC_BAD_ARGS1NULL cred/token guard
KACS_EXEC_ID_CHANGE_NO_TOKEN2uid/gid change, no subject token
KACS_EXEC_ID_CHANGE_PRIV_UNSUPPORTED3id change + ASSIGN_PRIMARY_TOKEN priv
KACS_EXEC_TOKEN_NPM_DERIVED4exec token derived via new-process-min
KACS_EXEC_TOKEN_CLONE5exec token via primary clone fallback
KACS_EXEC_NPM_NO_FILE6new-process-min needs file, none supplied
KACS_EXEC_NPM_DERIVE_FAIL7new_process_min_exec derivation failed
KACS_EXEC_TOKEN_INSTALL_FAIL8install token ref on new cred failed
KACS_EXEC_TOKEN_CLONE_FAIL9primary token clone returned NULL
KACS_EXEC_INTEGRITY_NO_ISEC10exec file inode has no i_security
KACS_EXEC_INTEGRITY_NO_CACHE11exec file SD cache absent
KACS_EXEC_INTEGRITY_INVALID_SD12exec file cached SD invalid/empty
KACS_EXEC_IMPERSONATION_REVERT_FAIL13bprm impersonation revert failed
KACS_EXEC_PIP_COMMITTED14pending exec PIP committed at commit
KACS_EXEC_UMH_NOT_TCB15usermodehelper exec below PeiosTcb trust
KACS_EXEC_SIGNATURE_UNVERIFIABLE16exec refused: signature could not be verified
KACS_EXEC_PIP_CAPPED_UNSAFE17exec PIP label capped at the current one: traced or no_new_privs

kacs_signing reason — code-signature verification outcomes and the distinct reject reasons of the signing-material probe. Only source enum, verified flag, PIP tier codes, file length, reason, and ret are recorded — never key, signature, xattr, or file bytes. Emitted by kacs:kacs_signing_verify _crypto / _probe.

ConstantValueNotes
KACS_SIG_UNSIGNED0material source NONE (unsigned)
KACS_SIG_BAD_KEY_TABLE1key table malformed / bad args
KACS_SIG_NO_KEY_MATCH2no key verified the signature
KACS_SIG_VERIFIED3a key verified; trust assigned
KACS_SIG_CRYPTO_UNAVAILABLE4mldsa65 tfm allocation failed
KACS_SIG_CRYPTO_MISMATCH5set-pubkey/verify returned nonzero
KACS_SIG_PROBE_FOUND6valid signature material committed
KACS_SIG_ELF_MAGIC_READ7failed reading ELF magic
KACS_SIG_ELF_SHORT_EHDR8file too short for Elf64_Ehdr
KACS_SIG_ELF_EHDR_READ9failed reading ELF header
KACS_SIG_ELF_BAD_IDENT10unsupported e_ident class/data/version
KACS_SIG_ELF_BAD_SHTABLE11bad shentsize/shstrndx
KACS_SIG_ELF_SHDRS_RANGE12section-header table offset/len out of range
KACS_SIG_ELF_SHSTR_READ13failed reading shstrtab section header
KACS_SIG_ELF_STRTAB_RANGE14shstrtab offset/len out of range
KACS_SIG_ELF_SHDR_READ15failed reading a section header
KACS_SIG_ELF_NAME_READ16failed reading a section name
KACS_SIG_ELF_BAD_SIG_SECTION17sig section wrong type/size/range
KACS_SIG_ELF_BAD_BLOB18sig blob read failed or invalid
KACS_SIG_ELF_HASH_FAIL19hashing failed for ELF sig
KACS_SIG_XATTR_BAD_BLOB20xattr sig blob invalid
KACS_SIG_XATTR_HASH_FAIL21hashing failed for xattr sig
KACS_SIG_SIZE_CHANGED22file size changed during probe (TOCTOU)

kacs_firmware reason — why a kernel-initiated firmware read was allowed or refused (kacs/firmware.c, PEI-493). Firmware is code that runs on a device with DMA into host memory, so it is held to the PeiosTcb tier: the same bar as a usermodehelper exec. ret is the verdict handed to the loader; under log mode it is 0 whatever the reason. Emitted by kacs:kacs_firmware_load. No path, key, or signature bytes are recorded.

ConstantValueNotes
KACS_FW_ALLOWED0verified at PeiosTcb
KACS_FW_UNSIGNED1no signature material on the file
KACS_FW_NO_KEY_MATCH2signed, but no built-in key verified it
KACS_FW_BELOW_TCB3verified, but the key's tier is below PeiosTcb
KACS_FW_UNVERIFIABLE4verification could not run (crypto unavailable)
KACS_FW_PROBE_FAILED5reading the signature material failed

kacs_socket reason — the outcome of an AF_UNIX socket SD / impersonation hook.

Distinguishes the guard, not-applicable, and verdict paths that otherwise collapse into an indistinguishable -EACCES. Verdict is the ret field. No address, pathname, or SD bytes are recorded.

ConstantValueNotes
KACS_SOCK_BAD_ARGS0NULL/guard argument rejected
KACS_SOCK_NOT_UNIX1not AF_UNIX / unsupported type
KACS_SOCK_NO_SECURITY2sock has no sk_security blob
KACS_SOCK_NO_TOKEN3no effective subject/client token
KACS_SOCK_BAD_LEVEL4invalid impersonation level
KACS_SOCK_WRONG_STATE5socket state forbids the op
KACS_SOCK_NO_PEER_TOKEN6no captured peer token present
KACS_SOCK_PIP_CONTEXT7caller PIP context unavailable
KACS_SOCK_SD_DECISION8socket-SD check produced verdict
KACS_SOCK_NO_SD9no socket SD; allowed without check
KACS_SOCK_HAVE_SD10socket SD present; check performed
KACS_SOCK_ALREADY_BOUND11socket SD already installed
KACS_SOCK_BIND12abstract-socket SD bind result
KACS_SOCK_CONNECT13unix_stream_connect result
KACS_SOCK_LEVEL_SET14impersonation level updated
KACS_SOCK_OPEN_TOKEN15open peer-token fd result

16 was KACS_SOCK_IMPERSONATE (kacs_impersonate_peer); retired, not reused.

ConstantValueNotes
KACS_SOCK_ATTACH17identity attached to a send
KACS_SOCK_GATE18explicit KACS_SCM_TOKEN send-gate verdict
KACS_SOCK_REGISTER19conveyed-identity register advanced
KACS_SOCK_DELIVER20KACS_SCM_TOKEN delivered to a receiver
KACS_SOCK_LISTEN21listener identity captured at listen()
KACS_SOCK_RESTAMP22listener identity replaced by KACS_SO_RESTAMP
KACS_SOCK_PORT_BIND23inet bind: port reservation SD verdict
KACS_SOCK_PORT_TABLE24port reservation table load result
KACS_SOCK_OWNER25governing identity stamped on an inet socket

kacs_ipc reason — a System V IPC object SD decision (ipc.c).

ConstantValueNotes
KACS_IPC_ALLOC0default SD stamped at *get creation
KACS_IPC_PERMISSION1ipc_permission: read/write access to the object
KACS_IPC_CTL2*ctl command gate (RMID/SET/STAT/...)
KACS_IPC_SD_QUERY3kacs_get_sd on the object
KACS_IPC_SD_SET4kacs_set_sd on the object
KACS_IPC_NO_SD5object carries no SD; fail closed

kacs_namespace stage — which sub-decision of a namespace-mutation hook a record describes.

Single-decision ops report PRIMARY; multi-stage ops (link, rename, delete fallback) tag each distinct verdict. Verdict is the ret field. Never records a pathname. Emitted by the kacs:kacs_inode_* events.

ConstantValueNotes
KACS_NS_PRIMARY0the op's principal decision
KACS_NS_PARENT_FALLBACK1delete: parent DELETE_CHILD fallback
KACS_NS_SOURCE2link/rename source-side decision
KACS_NS_DEST3link/rename destination-parent add
KACS_NS_DELETE_EXISTING4rename: delete pre-existing dest

kacs_psb reason — which process-security-baseline path an event marks: mitigation activation (apply) or a W^X / LSV / PIE / prctl-lock enforcement denial. The ok-vs-deny verdict is read from ret. Emitted by kacs:kacs_psb_*.

ConstantValueNotes
KACS_PSB_APPLY_OK0mitigations applied; result_bits set
KACS_PSB_APPLY_NORMALIZE1requested mask bad or unsupported (EINVAL/ENODEV)
KACS_PSB_APPLY_MM_ACQUIRE2could not acquire target mm (EACCES)
KACS_PSB_APPLY_CFIF3forward-CFI (IBT) activation failed
KACS_PSB_APPLY_SML4speculative-mitigation-lock activation failed
KACS_PSB_APPLY_CFIB5backward-CFI (shadow stack) activation failed
KACS_PSB_WXP_MMAP6W^X blocked a W+X mmap
KACS_PSB_WXP_MPROTECT7W^X blocked an mprotect transition
KACS_PSB_WXP_EXISTING_VMA8W^X activation blocked by an existing W+X vma
KACS_PSB_LSV_PROBE9LSV signing probe of the image failed
KACS_PSB_LSV_VERIFY10LSV signature not verified/trusted
KACS_PSB_LSV_PIP_DOMINANCE11LSV image PIP does not dominate process PIP
KACS_PSB_PIE_ET_EXEC12PIE blocked a non-PIE ET_EXEC image
KACS_PSB_PRCTL_SML13prctl blocked by SML lock
KACS_PSB_PRCTL_CFIB14prctl blocked by shadow-stack (CFIB) lock
KACS_PSB_PRCTL_PIP15prctl set-dumpable blocked by process PIP

kacs_token_ioctl cmd — which token-fd ioctl verb a record describes.

The verdict (allow vs deny) is read from the ret field (0 == allow); the access-mask-gate rejections surface as ret == -EACCES. token is an opaque numeric id (never token bytes). Emitted by kacs:kacs_token_ioctl.

ConstantValueNotes
KACS_TOK_QUERY0KACS_IOC_QUERY
KACS_TOK_ADJUST_PRIVS1KACS_IOC_ADJUST_PRIVS
KACS_TOK_ADJUST_GROUPS2KACS_IOC_ADJUST_GROUPS
KACS_TOK_DUPLICATE3KACS_IOC_DUPLICATE
KACS_TOK_INSTALL4KACS_IOC_INSTALL
KACS_TOK_RESTRICT5KACS_IOC_RESTRICT
KACS_TOK_LINK6KACS_IOC_LINK_TOKENS
KACS_TOK_GET_LINKED7KACS_IOC_GET_LINKED_TOKEN
KACS_TOK_IMPERSONATE8KACS_IOC_IMPERSONATE
KACS_TOK_ADJUST_DEFAULT9KACS_IOC_ADJUST_DEFAULT
KACS_TOK_ADJUST_INTERACTIVITY_SCOPE10KACS_IOC_ADJUST_INTERACTIVITY_SCOPE
KACS_TOK_UNKNOWN11unrecognised ioctl verb (-ENOTTY)

kacs_token_ref reason — a token-fd reference lifecycle transition.

TO_FD is a token installed into a fresh anon-inode handle; RELEASE is the handle teardown that drops the token ref; BIND clones a token onto an existing file; OPEN is the checked/fixed-access open path that clones the target token. token is an opaque numeric id, never token bytes. Emitted by kacs:kacs_token_ref.

ConstantValueNotes
KACS_TREF_TO_FD0token installed into a new fd (ret == fd)
KACS_TREF_RELEASE1token-fd released; ref dropped
KACS_TREF_BIND2token cloned + bound onto an existing file
KACS_TREF_OPEN3token cloned for a token-open path

kacs_logon_session reason — a session/token creation-surface outcome.

The *_DENIED codes name the privilege-gate rejections (the value); the plain op codes mark the successful op. Verdict is also in ret. No token/spec bytes are recorded. Emitted by kacs:kacs_logon_session.

ConstantValueNotes
KACS_SES_CREATE0create_logon_session published a session
KACS_SES_CREATE_PRIV_DENIED1create_logon_session: TCB privilege gate denied
KACS_SES_DESTROY2destroy_empty_logon_session outcome
KACS_SES_DESTROY_PRIV_DENIED3destroy: TCB privilege gate denied
KACS_SES_CREATE_TOKEN4create_token issued a token fd
KACS_SES_CREATE_TOKEN_PRIV_DENIED5create_token: CREATE_TOKEN privilege denied

kacs_cred reason — a credential-security lifecycle transition: LSM cred prepare/transfer/alloc/free, explicit token-ref install, the clone-time primary-token lifecycle (CLONE_THREAD share vs fork deep-copy), and the project-linux-cred rejection paths. old_token/new_token are opaque token pointer ids (0 when absent); clone_flags is set only on the clone paths. Verdict/outcome is the ret field. Emitted by kacs:kacs_cred.

ConstantValueNotes
KACS_CRED_PREPARE0cred_prepare token clone
KACS_CRED_TRANSFER1cred_transfer token clone
KACS_CRED_ALLOC_BLANK2cred_alloc_blank cleared sec
KACS_CRED_FREE3cred_free released token/state
KACS_CRED_INSTALL_TOKEN_REF4install token ref on a cred
KACS_CRED_CLONE_THREAD_SHARE5CLONE_THREAD shares parent primary cred
KACS_CRED_CLONE_FORK_COPY6fork deep-copies parent primary token
KACS_CRED_PROJECT_UID0_BLOCKED7uid0 projection not allowed by token
KACS_CRED_PROJECT_GROUPS_ALLOC_FAIL8groups_alloc failed (ENOMEM)
KACS_CRED_PROJECT_E2BIG9supplementary gid count > NGROUPS_MAX

kacs_setid reason — the KACS gate on a Linux setid projection (task_fix_setuid / _setgid / setgroups). Each op has two distinct denials that otherwise collapse: NO_TOKEN (-EACCES, no effective subject token) and PRIV_GATE (-EOPNOTSUPP, holder of ASSIGN_PRIMARY_TOKEN privilege). flags is the LSM_SETID* mask (0 for setgroups). Emitted by kacs:kacs_setid.

ConstantValueNotes
KACS_SETID_SETUID_NO_TOKEN0setuid gate: no subject token
KACS_SETID_SETUID_PRIV_GATE1setuid gate: ASSIGN_PRIMARY priv
KACS_SETID_SETGID_NO_TOKEN2setgid gate: no subject token
KACS_SETID_SETGID_PRIV_GATE3setgid gate: ASSIGN_PRIMARY priv
KACS_SETID_SETGROUPS_NO_TOKEN4setgroups gate: no subject token
KACS_SETID_SETGROUPS_PRIV_GATE5setgroups gate: ASSIGN_PRIMARY priv

kacs_task reason — a task-security lifecycle transition.

task_alloc reports a NO_CHILD-mitigation clone block, a process-state inherit ENOMEM, or success; task_free marks teardown. process_state is an opaque process-state pointer id (0 when absent); clone_flags is set on the alloc paths. Outcome is ret. Emitted by kacs:kacs_task.

ConstantValueNotes
KACS_TASK_ALLOC_NO_CHILD_BLOCKED0clone blocked by NO_CHILD mitigation
KACS_TASK_ALLOC_INHERIT_ENOMEM1process-state inherit failed (ENOMEM)
KACS_TASK_ALLOC2task_alloc completed
KACS_TASK_FREE3task_free teardown

kacs_primary_install reason — a primary-token / impersonation credential transition.

Distinguishes the install commit, the user-SID-change process-SD reallocation and its ENOMEM, the commit_creds apply, the impersonation override/revert, and the sibling-thread taskwork requeue/failure. old_primary and new_primary are opaque token identity ids (never token bytes). Verdict is the ret field. Emitted by kacs:kacs_primary_install.

ConstantValueNotes
KACS_PRIM_INSTALL_OK0primary token install committed
KACS_PRIM_SD_REALLOC1user-SID changed; process SD reallocated
KACS_PRIM_SD_ALLOC_FAIL2process SD realloc failed (ENOMEM)
KACS_PRIM_APPLY_COMMIT3new real creds committed (commit_creds)
KACS_PRIM_IMPERSONATE_INSTALL4impersonation token installed (override_creds)
KACS_PRIM_IMPERSONATE_REVERT5impersonation reverted (revert_creds)
KACS_PRIM_SIBLING_REQUEUE6queued sibling install re-queued on ENOMEM
KACS_PRIM_SIBLING_FAILED7queued sibling install failed after apply

kacs_process_token_open reason — the outcome of opening a process/thread primary or effective token (kacs_open_process_token / _thread_token and the proc inspection files). Distinguishes the bad access-mask reject, the no-target-token path, the process access-check denial, the self vs cross inspection verdicts, and the successful open. subject_token/target_token are opaque token identity ids (0 when unknown at the emit site); access_mask is the requested mask. Verdict is ret (>=0 fd == allow). Emitted by kacs:kacs_process_token_open.

ConstantValueNotes
KACS_PTO_OPEN_OK0token fd opened
KACS_PTO_BAD_ARGS1NULL subject/state/task guard
KACS_PTO_NO_TARGET2target has no token
KACS_PTO_BAD_ACCESS3invalid access mask rejected
KACS_PTO_ACCESS_DENIED4process access check denied
KACS_PTO_SELF5self-target inspection allowed
KACS_PTO_CROSS6cross-process inspection authorized

kacs_process_state reason — a process-state / process-SD lifecycle or PIP transition.

Covers process-state alloc/free, the CLONE_THREAD share vs fork inheritance split, the no-child clone block, the pending-exec-PIP stage/commit and dumpable hardening, and the process-SD alloc/wrap/replace primitives. process_state is an opaque state-object id (0 when none in scope, e.g. the process-SD primitives); pip_type/pip_trust carry the PIP tier. ret is the outcome (0 == ok). No token or SD bytes. Emitted by kacs:kacs_process_state.

ConstantValueNotes
KACS_PST_ALLOC0process state allocated
KACS_PST_ALLOC_FAIL1process state alloc failed (ENOMEM)
KACS_PST_FREE2process state freed (refcount hit 0)
KACS_PST_INHERIT_SHARE3CLONE_THREAD: parent state shared
KACS_PST_INHERIT_FORK4fork: new state allocated from parent
KACS_PST_EXEC_PIP_STAGE5pending exec PIP staged
KACS_PST_EXEC_PIP_COMMIT6pending exec PIP committed to state
KACS_PST_DUMPABLE7exec dumpable hardened by PIP
KACS_PST_CLONE_BLOCKED_NOCHILD8clone blocked by NO_CHILD mitigation
KACS_PST_SD_ALLOC9default process SD allocated
KACS_PST_SD_ALLOC_FAIL10process/socket SD alloc failed
KACS_PST_SD_WRAP_FAIL11process SD wrapper alloc failed (ENOMEM)
KACS_PST_SD_REPLACE12process SD replaced on state
KACS_PST_SOCKET_SD_ALLOC13default socket SD allocated

kacs_mount_policy reason — the outcome of a mount-policy set (TCB-gated) or get.

SET_OK marks a committed policy change (generation bumped); the guard codes name the pre-commit rejects that otherwise collapse into a bare -EINVAL/-EOPNOTSUPP/-EPERM. GET_OK/GET_NO_SECURITY are the snapshot paths. Verdict is also in ret. Emitted by kacs:kacs_mount_policy_set / _get.

ConstantValueNotes
KACS_MP_SET_OK0policy committed; generation bumped
KACS_MP_BAD_ARGS1NULL subject/sb/args guard (EINVAL)
KACS_MP_NO_SECURITY2superblock has no s_security (EOPNOTSUPP)
KACS_MP_UNMANAGED3magic-derived UNMANAGED; not settable (EOPNOTSUPP)
KACS_MP_VALIDATE4mount-policy args validation failed (EINVAL)
KACS_MP_TEMPLATE_INVALID5template SD bytes failed validation (EINVAL)
KACS_MP_TCB_DENIED6SeTcbPrivilege gate denied (EPERM)
KACS_MP_GET_OK7policy snapshot returned
KACS_MP_GET_NO_SECURITY8get: no s_security; magic-derived policy returned
KACS_MP_FIXED_POLICY9filesystem fixes its policy class (EOPNOTSUPP)

kacs_sd_syscall target_kind — which SD-bearing object a query/set record describes, resolved by the get_sd/set_sd syscall target-kind fallthrough. ACCESS_CHECK tags the AccessCheck ingress events (kacs_access_check*), whose other scalar fields are 0 at the ingress boundary.

ConstantValueNotes
KACS_SDS_KIND_TOKEN0token-fd target
KACS_SDS_KIND_FILE1file/inode target
KACS_SDS_KIND_PROCESS2pidfd process target
KACS_SDS_KIND_PATH3path-resolved file target
KACS_SDS_KIND_ACCESS_CHECK4AccessCheck ingress (not an SD get/set)

kacs_sd_syscall reason — the outcome of an SD query/set core.

QUERY_OK/SET_OK are the success paths; the remaining codes name the guard / denial paths that otherwise surface as an indistinguishable -EINVAL/-EACCES/-EOPNOTSUPP. Verdict is also in ret. Emitted by kacs:kacs_sd_query / _set.

ConstantValueNotes
KACS_SDS_QUERY_OK0SD subset extracted and returned
KACS_SDS_SET_OK1SD merged/replaced
KACS_SDS_BAD_ARGS2NULL/zero argument guard (EINVAL)
KACS_SDS_UNMANAGED3superblock UNMANAGED (EOPNOTSUPP)
KACS_SDS_ACCESS_DENIED4SD access check denied (EACCES)
KACS_SDS_NO_SD5target has no usable SD (EACCES)
KACS_SDS_RESTORE_BYPASS6set via SeRestorePrivilege bypass
KACS_SDS_QUERY_FAIL7subset extraction failed after auth

kacs_access_check reason — the AccessCheck kernel-ingress outcome, above the closed Slice 15 ABI bridge. OK is a completed ingress; the remaining codes name the ingress-time rejects (token-eval-context gate, token resolution, and caap-cache lock acquisition). Verdict is also in ret. Emitted by kacs:kacs_access_check / _list.

ConstantValueNotes
KACS_ACK_OK0ingress dispatched to the ABI bridge
KACS_ACK_EVAL_CONTEXT1token-eval-context gate denied (EACCES)
KACS_ACK_TOKEN_RESOLVE2token/args resolution failed
KACS_ACK_CAAP_LOCK_FAIL3caap-cache lock acquisition failed

kacs_file_snapshot op — which snapshot-grant file operation an event marks.

The allow-vs-deny verdict is read from ret; reason names why a deny path was taken. Emitted by kacs:kacs_file_snapshot (file_access.c).

ConstantValueNotes
KACS_FSOP_ACCESS0generic snapshot-grant access check
KACS_FSOP_PERMISSION1file_permission hook
KACS_FSOP_IOCTL2file ioctl snapshot
KACS_FSOP_LOCK3file lock snapshot
KACS_FSOP_FCNTL4file fcntl snapshot
KACS_FSOP_TRUNCATE5file truncate snapshot
KACS_FSOP_FALLOCATE6file fallocate snapshot
KACS_FSOP_MMAP7file mmap snapshot
KACS_FSOP_MPROTECT8file mprotect snapshot
KACS_FSOP_WRITE_INTENT9write-intent snapshot
KACS_FSOP_SYSFS_WRITE_GATE10unmanaged sysfs write gate

kacs_file_snapshot reason — why a snapshot-grant op took its return path.

DECISION is the resolved allow/deny (verdict in ret); the remaining codes name the distinct deny causes. Emitted by kacs:kacs_file_snapshot.

ConstantValueNotes
KACS_FSR_DECISION0resolved allow/deny (grant compare)
KACS_FSR_SIGNED_EXEC1signed-exec content mutation denied
KACS_FSR_GRANT_DENY2granted access lacked required right
KACS_FSR_APPEND_DENY3append/write intent lacked write grant
KACS_FSR_UNMANAGED_SYSFS4unmanaged fd: sysfs write gate applied
KACS_FSR_AUDIT_EMIT_FAIL5kacs.audit.handle.used emit failed

kacs_metadata reason — the file-metadata (getattr/setattr/xattr/getsecurity) decision path.

DECISION/CONSUME_HIT/BEGIN_BUSY mark the begin/consume decision lifecycle; the remaining codes name the distinct deny reasons of the xattr setattr hooks. op_class carries the internal PKM_KACS_METADATA_OP_* value; matched is the consume match flag. Emitted by kacs:kacs_metadata (file_metadata.c).

ConstantValueNotes
KACS_META_DECISION0generic metadata decision
KACS_META_CONSUME_HIT1consumed a pre-staged decision
KACS_META_BEGIN_BUSY2begin failed: a decision already active
KACS_META_CANONICAL_SD3canonical SD xattr access denied
KACS_META_CAPS_XATTR4capability xattr mutation denied (EPERM)
KACS_META_ACL5POSIX ACL xattr denied
KACS_META_SIGNED_EXEC6signed-exec xattr/size mutation denied
KACS_META_BAD_ARGS7NULL name / dentry guard
KACS_META_INTERNAL_SD8internal SD read/write re-entry allowed
KACS_META_GETSECURITY9inode_getsecurity outcome

kacs_native_open_ext reason — a widening decision inside the native (kacs_open) create/open machinery. The PREPARE_* codes name the arg- validation reject buckets of pkm_kacs_prepare_native_open; RESOLVE / BUILD_CREATED_SD DELETE_ON_CLOSE_ARM name the later stage outcomes (verdict in ret). Emitted by kacs:kacs_native_open_ext (native_open.c).

ConstantValueNotes
KACS_NOX_PREPARE_OK0prepare accepted the request
KACS_NOX_PREPARE_BAD_FLAGS1flags/create_options/__pad rejected
KACS_NOX_PREPARE_BAD_SD_ARGS2sd_ptr/sd_len/disposition-sd combo bad
KACS_NOX_PREPARE_BAD_DISPOSITION3create_disposition out of range
KACS_NOX_PREPARE_BAD_ACCESS4desired-access mask invalid/empty
KACS_NOX_PREPARE_UNSUPPORTED5valid but unsupported combination
KACS_NOX_RESOLVE6resolve-existing-path outcome
KACS_NOX_BUILD_CREATED_SD7build-created-file-SD outcome
KACS_NOX_DELETE_ON_CLOSE_ARM8delete-on-close arm outcome

kacs_object reason — which object-lifecycle verdict a record marks.

Only the high-value transitions are traced (pure inode/file/sb alloc/free are not). ret is the outcome (0 == ok). Emitted by kacs:kacs_object.

ConstantValueNotes
KACS_OBJ_DELETE_ON_CLOSE_UNLINK0file_release delete-on-close unlink attempt
KACS_OBJ_SIGNED_EXEC_PIN1inode pinned as signed-exec (immutable)
KACS_OBJ_SIGNED_EXEC_MUTATION_BLOCKED2content mutation of a signed-exec-pinned inode denied

kacs_securityfs reason — which securityfs endpoint path a record marks.

The sessions_read codes disambiguate the deny rungs that otherwise collapse into an errno; open_self / init report the endpoint outcome. Verdict is ret. Emitted by kacs:kacs_securityfs.

ConstantValueNotes
KACS_SFS_LOGON_SESSIONS_NO_TOKEN0sessions read: no effective subject token
KACS_SFS_LOGON_SESSIONS_PIP_CONTEXT1sessions read: caller PIP context unavailable
KACS_SFS_LOGON_SESSIONS_ACCESS_CHECK2sessions read: rust access check denied
KACS_SFS_OPEN_SELF3open of kacs/self self-token file outcome
KACS_SFS_INIT4securityfs kacs/ endpoint init outcome

kacs_caap reason — which CAAP policy-cache path a record marks.

SET carries the post-set cache_len (an insert grows it; an evict/replace may shrink it); INIT/DESTROY are cache lifecycle; TCB_GATE is the SeTcbPrivilege gate deny. Emitted by kacs:kacs_caap. No SID or spec bytes — lengths only.

ConstantValueNotes
KACS_CAAP_TCB_GATE0SeTcbPrivilege gate denied the caller
KACS_CAAP_SET1cache set (insert/evict); cache_len is post-set count
KACS_CAAP_INIT2CAAP cache created
KACS_CAAP_DESTROY3CAAP cache destroyed

kacs_capability reason — the capability->privilege gate verdicts and the capability LSM-hook outcomes. ALLOW_GRANT is an auto-granted allow-cap; HARD_DENY is the SETPCAP/SETFCAP/MAC_OVERRIDE hard block; PRIV_NOT_ENABLED USE_MARK_FAIL are the mapped-privilege gate failures; CAPSET / PRCTL_GUARD CAPABLE / CAPGET report the corresponding hook outcome. Emitted by kacs:kacs_capability. Verdict is ret.

ConstantValueNotes
KACS_CAP_ALLOW_GRANT0allow-cap auto-granted (no privilege needed)
KACS_CAP_HARD_DENY1SETPCAP/SETFCAP/MAC_OVERRIDE hard-denied
KACS_CAP_PRIV_NOT_ENABLED2mapped privilege not enabled on token
KACS_CAP_USE_MARK_FAIL3privilege use-mark failed
KACS_CAP_CAPSET4capset core outcome
KACS_CAP_PRCTL_GUARD5prctl capability-guard outcome
KACS_CAP_CAPABLE6capable() hook guard-deny outcome
KACS_CAP_CAPGET7capget for-task outcome

kacs_privilege reason — the require_enabled_privilege gate rungs plus two standalone privilege-path markers. NULL_OR_ZERO is a null- token/zero-mask guard; NOT_ENABLED / USE_MARK_FAIL are the gate failures; CHANGE_NOTIFY marks the open_by_handle_at SeChangeNotifyPrivilege check outcome; RCU_ENOMEM_ FALLBACK marks the deferred-free ENOMEM synchronize_rcu fallback. Emitted by kacs:kacs_privilege. Verdict is ret.

ConstantValueNotes
KACS_PRIV_NULL_OR_ZERO0null token or zero privilege mask
KACS_PRIV_NOT_ENABLED1privilege not enabled on token
KACS_PRIV_USE_MARK_FAIL2privilege use-mark failed
KACS_PRIV_CHANGE_NOTIFY3open_by_handle_at CHANGE_NOTIFY gate outcome
KACS_PRIV_RCU_ENOMEM_FALLBACK4deferred-free kmalloc failed; sync-rcu fallback

kacs_tlp reason — the trusted-launch-path decisions.

CHECK_PATH marks a no-prefix-match executable-transition deny (path_len

  • prefix_count only, NEVER path or prefix bytes); REPLACE marks a prefix-table replacement. Emitted by kacs:kacs_tlp. Verdict is ret.
ConstantValueNotes
KACS_TLP_CHECK_PATH0executable transition denied: no prefix match
KACS_TLP_REPLACE1TLP prefix table replaced

kacs_mntns reason — mount-namespace object lifecycle and the mount gate.

SD_ALLOC / SD_ALLOC_FAIL mark a namespace minted with (or without) its creator descriptor; the gate reasons say which rung admitted or refused a mount-table change: PRIVILEGE is SeManageVolume / SeTcb, NO_SD is a namespace with no descriptor (the initial one), OP_NOT_ADMITTED is an operation the descriptor can never grant, SD_DECISION is the access check against the namespace descriptor, PIP_CONTEXT a failure to read the caller's PIP state. Emitted by kacs:kacs_mntns. Verdict is ret.

ConstantValueNotes
KACS_MNTNS_SD_ALLOC0namespace minted with a creator descriptor
KACS_MNTNS_SD_ALLOC_FAIL1descriptor could not be built
KACS_MNTNS_GATE_PRIVILEGE2admitted by SeManageVolume / SeTcb
KACS_MNTNS_GATE_NO_SD3namespace has no descriptor; refused
KACS_MNTNS_GATE_OP_NOT_ADMITTED4op needs the privilege whatever the SD says
KACS_MNTNS_GATE_SD_DECISION5access check against the namespace SD
KACS_MNTNS_GATE_PIP_CONTEXT6caller PIP context unavailable
KACS_MNTNS_GATE_FS_NOT_ADMITTED7filesystem type not on the unprivileged allowlist
KACS_MNTNS_SB_STAMP8unprivileged tmpfs stamped synth-ephemeral, creator template
KACS_MNTNS_SB_STAMP_FAIL9creator template could not be built

MS-DTYP compatibility and divergences

Peios Kernel / Userspace interfaces / Native interfaces / KACS

KACS uses the binary formats MS-DTYP specifies, so a descriptor authored by a Windows domain controller and replicated through Samba is evaluated without translation. PCDS specifies those formats normatively.

Evaluator behaviour is a separate question. Given the same token, descriptor and desired mask, KACS generally reaches the same decision MS-DTYP describes — which is what makes policy authored in an AD environment behave predictably here — but it departs deliberately in the following places.

AreaDepartureWhy
Conditional ACE @Local.Resolved from an AccessCheck parameter rather than a token fieldThe context is per-call and varies between checks.
Virtual groups in expressionsMember_of({S-1-3-4}) returns true for the ownerKeeps the SID matcher and the expression evaluator semantically consistent.
INT64/UINT64 promotionRelational operators promote between the twoWithout promotion, UINT64 claims cannot be used in conditions at all.
Member_of filteringFiltered by ACE polarity, so deny-only groups do not satisfy allow-ACE conditionsConsistent with deny-only group semantics everywhere else.
Exists scopeExtended to all four attribute namespacesNo reason to restrict existence tests to Local and Resource.
ACE mask mappingACE masks are mapped through GenericMapping at evaluation timeRequired for GENERIC_ALL in central access policy recovery ACEs (Central Access and Auditing Policy).
MAXIMUM_ALLOWEDFirst-writer-wins for targeted and maximum-allowed requestsEliminates disagreement between "what can I do?" and "can I do this?" on a non-canonically ordered DACL.
Zero desired maskSucceeds rather than returning access denied"Asked for nothing, got nothing" is a valid answer.
Alarm ACEsRepurposed for continuous per-operation auditing, recorded as kacs.audit.handle.used (Auditing in AccessCheck)Reserved but never implemented in the reference model.
Multiple scoped policy ACEsSeveral permitted per SACLAND semantics make composition safe.
Mandatory policy mutabilitymandatory_policy is immutable on the token (Token Structure)A mutable policy reduces MIC to advisory.
Impersonation integrity ceilingEnforced unconditionally; SeImpersonatePrivilege does not bypass it (Impersonation Gates)MIC is a real boundary precisely because the mandatory policy is immutable.
Impersonation origin checkDroppedEliminates hidden impersonation paths.
Impersonation level on primariesMeaningful and queryable: a ratchet every token carries, bounding everything derived from it (Impersonation Levels). Windows rejects TokenImpersonationLevel on a primary.Delegation here is a flag authd enforces rather than a property of the credential cache, so the flag itself has to be unforgeable across duplication.
PIP determinationKernel-only, from the binary signature, with no parent input (PSB Fields)One input, one answer, no ambiguity.
Object type list validationDuplicate GUIDs and level gaps rejected (Object ACEs and Property-Level Access)Prevents node lookup returning the wrong node and propagation becoming undefined.
Object type list depthNo limit on levels; the tree is bounded only by the node count the access-check interface accepts. MS-DTYP limits a list to four levels.A depth limit would reject lists the validation rules already make well-defined, and nothing in propagation depends on depth.

Features handled elsewhere #

Several capabilities relevant to a complete security posture are not KACS's, and are named here so their absence is not mistaken for a gap. Kerberos and NTLM authentication, S4U, and credential storage and protection belong to authd, as do Resource-Based Constrained Delegation and Authentication Policies and Silos through the KDC. Active Directory replication is Samba's. Group Policy distribution goes through the registry and roles. Network share permissions belong to the Samba SMB layer. An Encrypting File System is a future service.

ABI status and naming differences

Peios Kernel / Userspace interfaces / Native interfaces / KACS

KACS ABI Reference is generated from include/uapi/pkm/ and holds only what a compiler can measure. This appendix holds the rest: the two ACE types that have a constant and no behaviour, the payload shapes behind the token query classes, the specification spellings a reader may arrive holding, what is deliberately documented elsewhere, and the kernel configuration KACS is built by.

The split is structural rather than editorial. gen-kacs-abi.py overwrites KACS ABI Reference wholesale on every run, so anything written there is lost the next time the ABI changes — which is exactly what happened to two sections of this one before they were moved here.

Names that differ from the specifications #

This manual uses the names include/uapi/pkm/ declares, and the generated tables of KACS ABI Reference are authoritative for them. A reader may instead arrive holding the name PCDS uses, which is MS-DTYP's — a legitimate spelling, not an obsolete one, and the one a third party implementing PCDS will have. This table maps those onto the headers.

PCDS / MS-DTYPuapi name
ACCESS_ALLOWED_ACE_TYPE, SYSTEM_AUDIT_ACE_TYPE, ...KACS_ACE_TYPE_ACCESS_ALLOWED, KACS_ACE_TYPE_SYSTEM_AUDIT, ... (the qualifier moves to the front)
KACS_REAL_TOKENKACS_TOKEN_OPEN_REAL
KACS_LEVEL_*KACS_IMLEVEL_*
KACS_FILE_SUPERSEDE, _OPEN, ...KACS_DISPOSITION_*
OWNER_SECURITY_INFORMATION, ...KACS_SECINFO_*
SE_PRIVILEGE_ENABLED / _REMOVEDKACS_PRIVILEGE_ATTR_ENABLED / _REMOVED
KACS_PRIV_RESET_ALL_DEFAULTSKACS_PRIVILEGE_RESET_ALL_DEFAULTS
KACS_RESTRICT_WRITE_RESTRICTEDKACS_TOKEN_RESTRICT_WRITE_RESTRICTED
SE_GROUP_*KACS_SID_GROUP_*
TOKEN_CLASS_*KACS_TOKEN_CLASS_*

The PIP tiers have no public names at all. The Protected type (512) and the PeiosTcb trust level (8192) exist only as kernel-private constants, and nothing in include/uapi/pkm/ defines None, Protected or Isolated. A program reasoning about tiers compares the numbers (Process Integrity Protection).

Open-interface documentation discrepancies #

The comparison below records historical documentation differences. The pinned source findings resolve specific creator-SD, create-option and no-follow questions; they do not reconcile every group below. No runtime behavior or historical release boundary was tested or established. The generated ABI supplies layouts and constants; it does not settle these behavioral questions.

Source labels and line numbers refer to the learn snapshot 4b119864d7f51c569ae1ac1932e4430f06731cf2:

  • O: the former Security Fundamentals Opening files source, retained in that revision's history.
  • N: KACS-Native Open, TRM KACS-Native Open.
  • L: Legacy Open Compatibility, TRM Legacy Open Compatibility.
  • D: Opening a file, SDK reference.
  • G: Securing files, SDK guide.

The links reach the current references; the line numbers identify the comparison snapshot above.

The PEI-1720 change has since replaced the native-open contract that groups 1, 5 and 7 compare against. MAXIMUM_ALLOWED may be named alone, and no data right is required. Delete-on-close follows NT, deleting at the last close of any open. kacs_open_how carries a share mode. The current behaviour is in KACS-Native Open and Sharing and Deletion; those groups record the historical differences only.

  1. Maximum allowed. O:116–127 says MAXIMUM_ALLOWED returns the maximum mask without checking the other requested bits, which it calls hints; N:14–19 says the concrete data/execute bits must be granted. Both require a concrete bit and reject MAXIMUM_ALLOWED alone. The general DACL walk describes a separate AccessCheck layer and cannot settle open validity by analogy.

  2. Legacy masks. O:135–145 maps O_RDONLY to FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | READ_CONTROL | SYNCHRONIZE, O_WRONLY to FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | READ_CONTROL | SYNCHRONIZE, and O_RDWR to their union. O:154–158 makes only FILE_READ_DATA core for read-only opens and allows FILE_READ_ATTRIBUTES to be dropped. L:16–37 instead makes FILE_READ_ATTRIBUTES core with read data, write data, or both according to the flag; L:39–49 lists broader compat rights. O:138 says O_APPEND adds FILE_APPEND_DATA; L:30–33 replaces core FILE_WRITE_DATA with it, then re-adds write data for O_TRUNC. L:44–45 also requests write data as optional compat access on append opens. These are different mappings, not interchangeable summaries.

  3. Creator descriptors. O:96–97 groups open-existing branches under EINVAL and lists SUPERSEDE only for an absent target. N:133–144 distinguishes FILE_OPEN (EOPNOTSUPP) from existing FILE_OPEN_IF, FILE_OVERWRITE and FILE_OVERWRITE_IF (EINVAL); N:82–89 also permits a caller-supplied SD on replacement by FILE_SUPERSEDE. D:36–46 and G:19–36 show OPEN_IF with a non-null creator SD and imply that the existing-file branch succeeds, despite O and N rejecting it. The SDK examples have now been changed to create-only. The pinned source findings below settle these existing-object rejections; this pass does not settle the separate SUPERSEDE comparison.

  4. Replacement and status. O:71 says SUPERSEDE removes the inode and recommends it for atomic-replace patterns. N:82–89 replaces the pathname while preserving old hardlinks and already-open references. O:112 claims nonconditional dispositions predict the status; N:176–179 says an absent-target FILE_SUPERSEDE reports CREATED, with SUPERSEDED only for actual replacement. No atomicity guarantee follows from this comparison.

  5. Delete-on-close. O:80 describes deletion on the last fd referencing the file. N:112–129 instead specifies final close of one file-description lineage, preserved by dup, fork and SCM_RIGHTS; later opens fail closed, and only regular files are supported. Generic inode last-reference semantics and this no-share lineage boundary differ.

  6. Unverified raw details. O:88 claims native AT_EMPTY_PATH opens an empty path against the directory referenced by dirfd; N:66–69 discusses that flag for get/set-security, not native open. O:140–143 maps O_CREAT to OPEN_IF with parent FILE_ADD_FILE, O_CREAT | O_EXCL to CREATE, and O_NOFOLLOW to AT_SYMLINK_NOFOLLOW. Their exact legacy translation and parent-right timing are not established by N/L/D. O:170 attributes legacy creation to umask-based defaults plus parent inheritable ACEs; Inheritance describes parent, creator and token SD sources without establishing that umask contribution. O:183,185 also lists path-component ENOTDIR and invalid-disposition EINVAL. These remain earlier, unverified claims; omission from another reference does not prove rejection or support. O:180 distinguishes a failed open access check from an unreachable path component; directory traversal is a separate authorization check.

  7. SDK destination caveats. D:3 mentions share mode; D:28 describes no-follow, write-through and the rest of the NtCreateFile option set. N:111–120 instead lists two supported create-option bits, reserves all others, and says the ABI has no share-mode field. D:26 calls the native result a “granted subset,” while N:6–19 distinguishes strict requests from maximum-allowed requests. The SDK reference is a programming entry point, not evidence that every difference has been reconciled. The current SDK page no longer advertises share mode or unsupported create options; the pinned source below verifies the accepted option bits and their SDK field mapping. The granted-subset wording versus strict/maximum semantics remains part of the unresolved comparison.

Pinned source findings #

A bounded source check used kernel 8e0e22de3a59cad506bbbf8873de456e16ad272d and libpeios 0.5.8 de0018bdcaed14abb796aeccec9c8387fd30e452. These are implementation findings for those commits, not proof about a deployed kernel or the release where a behavior began. Referenced KUnit tests are definitions; they were not executed.

  • Creator SDs (part of group 3). Argument validation rejects OPEN plus creator SD with EOPNOTSUPP and OVERWRITE plus creator SD with EINVAL. Existing-path handling rejects OPEN_IF and OVERWRITE_IF plus creator SD with EINVAL when the object exists. The OPEN_IF test records that expectation. SDK marshalling forwards the disposition and SD, rather than stripping the SD on an existing path. Use create-only with an explicit SD or open-existing with NULL SD; an EEXIST retry is a separate operation, not an atomic transaction.
  • Create options (part of group 7). The accepted-bit mask contains only DIRECTORY and DELETE_ON_CLOSE; unsupported bits return EINVAL. The same SDK marshalling copies options to create_options and flags to flags, so AT_SYMLINK_NOFOLLOW belongs in the latter.
  • No-follow is operation-specific. Native open rejects a terminal symlink with ELOOP. The by-path SD query instead selects the link itself through its lookup flags and path resolver, as recorded by a link-query test. The SDK query path forwards the flags; its buffer-size adaptation does not impose a terminal-link rejection. This query finding does not verify a successful link-SD write or remove the set-security component and storage checks.

Groups 1, 2, 4, 5 and 6 remain unresolved by this check, as do the other behavioral claims in groups 3 and 7. Do not treat the TRM, SDK or generated ABI as a blanket resolution of those differences.

What is not here #

Required rights, error codes and validation rules are properties of the implementation rather than of the headers, so they are documented with the operations themselves: token rights and the per-ioctl requirements in Token Access Rights, the file rights in The Handle Model, the process rights in Process Security Descriptors, and the privileges in Privilege Catalogue.

Two neighbouring ABIs are generated or documented separately. include/uapi/pkm/trace.h is a versioned, append-only ABI of tracepoint reason, operation and state codes intended for tooling. include/uapi/pkm/kmes.h and include/uapi/pkm/lcs.h belong to their own chapters.

Descriptor and ACE semantics

Peios Kernel / Userspace interfaces / Native interfaces / KACS

ACE types with no evaluator behaviour #

Two of the ACE type constants in KACS ABI Reference have a constant and nothing behind it. The ACE parser in kacs-core dispatches on 0x00–0x03, 0x05–0x14 and classifies every other value as opaque, so an ACE of type 0x04 or 0x15 is skipped during evaluation and written back byte-for-byte on serialisation. The constants exist so that a decoder can put a name to the byte. libpeios' SDDL codec does, printing 0x15 as SYSTEM_ACCESS_FILTER; the sd utility does not, and renders both as OTHER(0x04) and OTHER(0x15). PCDS ACE types records the same state normatively.

Token query semantics

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Querying a token handle #

The ioctl is straightforward in shape:

ioctl(token_fd, KACS_IOC_QUERY, &args)

Where args is a kacs_query_args struct:

FieldMeaning
token_classThe numeric class identifying what to return (1–24 in v0.20).
buf_lenInput: the size of the output buffer in bytes. Output: the actual number of bytes the query needed.
buf_ptrUserspace pointer to the output buffer.

The kernel:

  1. Validates the class against the catalog. Unknown classes return -EINVAL.
  2. Checks that the fd grants TOKEN_QUERY. If not, returns -EACCES.
  3. Computes the size the response needs.
  4. If buf_ptr is zero or buf_len is zero — this is a size query — writes the required size to buf_len and returns 0.
  5. If buf_ptr is non-zero but buf_len is smaller than required, returns -ERANGE with the required size still written to buf_len.
  6. Otherwise writes the response to the buffer and returns 0.

The "two-call pattern" — size query then fetch — is the standard way to handle variable-length output:

  1. Call once with buf_ptr = NULL (or buf_len = 0). The kernel writes the required size into buf_len and returns 0.
  2. Allocate a buffer of the indicated size.
  3. Call again with buf_ptr set to the buffer and buf_len set to its size. The kernel writes the response.

For classes with a fixed-size response, a single call with a buffer of the known size works in one go. The two-call pattern is needed only for classes whose response size depends on the token's contents (the groups class, the restricted-SIDs class, the default-DACL class, the claims classes).

The ioctl is idempotent — multiple queries for the same class produce the same result as long as the token has not been modified. Tokens carry a modified_id counter that increments on adjustment; if a query is part of a pipeline that depends on consistency across multiple queries, the modified_id can be queried first to detect mid-pipeline changes.

Token query payloads #

The class numbers come from the header and are tabulated in KACS ABI Reference; these are the payloads each one returns. Sizes are in bytes; a variable-length payload uses the shapes below. An invalid class returns EINVAL.

Two repeating shapes appear throughout. A SID array is [count:u32le] followed by count entries of [sid_len:u32le][sid_bytes][attributes:u32le], and reports a count of zero when the array is empty rather than an empty payload. A claims array is [count:u32le] followed by count entries of [entry_len:u32le][entry_bytes]. A bare SID is the SID bytes alone, and an absent optional SID or ACL is zero bytes.

ClassPayload
USERBare SID.
GROUPSSID array.
PRIVILEGES32 bytes: present, enabled, enabled-by-default and used, four u64 in that order.
TYPEu32, 4 bytes.
INTEGRITY_LEVELThe mandatory-label SID S-1-16-<level>, 12 bytes.
OWNERBare SID, resolved through the owner index: 0 is the user SID, N is groups[N-1].
PRIMARY_GROUPBare SID, resolved the same way.
INTERACTIVITY_SCOPEu32, 4 bytes.
RESTRICTED_SIDSSID array; count 0 on an unrestricted token.
SOURCE16 bytes: an 8-byte name followed by a u64 LUID.
STATISTICS40 bytes: token id, LogonSession id, modified id, token type, a reserved zero, and expiration.
ORIGINu64, 8 bytes.
ELEVATION_TYPEu32, 4 bytes.
DEVICE_GROUPSSID array.
APPCONTAINER_SIDBare SID; empty when the token is unconfined.
CAPABILITIESSID array.
MANDATORY_POLICYu32, 4 bytes.
LOGON_TYPEu32, 4 bytes, read from the LogonSession.
LOGON_SIDBare SID, derived from the LogonSession id.
DEFAULT_DACLBinary ACL; empty when none is set.
IMPERSONATION_LEVELu32, 4 bytes.
USER_CLAIMSClaims array.
DEVICE_CLAIMSClaims array.
PROJECTED_SUPPLEMENTARY_GIDS[count:u32le] followed by count u32 GIDs.
GUID16 raw bytes: the immutable token instance GUID, in the same byte order as KMES headers.

KACS_TOKEN_CLASS_GUID (0x19) uses the standard query contract: a size probe reports 16, a non-probe buffer smaller than 16 returns ERANGE without a partial payload, and every query requires TOKEN_QUERY. TOKEN_QUERY_SOURCE alone does not grant it.

Adjusting a token preserves its GUID; duplicating or restricting it creates a distinct token with a new GUID. Reopening the same token returns the same GUID. The STATISTICS payload remains 40 bytes and its token id is a LUID, not this GUID.

Querying the effective token returns the bytes stamped as KMES effective_token_guid; querying the real primary token returns true_token_guid. Impersonation changes which token the effective open selects, not either token's identity.

Several token fields have no query class at all: created_at, audit_policy, write_restricted, user_deny_only, isolation_boundary, confinement_exempt, the projected UID and GID — only the supplementary GIDs are reportable — restricted_device_groups, and the LCS registry credentials.

Socket ABI compatibility

Peios Kernel / Userspace interfaces / Native interfaces / KACS

Socket options and retired syscall numbers #

Peer identity on AF_UNIX sockets is read and bounded through socket options rather than syscalls. include/uapi/pkm/socket.h defines the option level SOL_KACS (4096), its options KACS_SO_PEER_TOKEN, KACS_SO_IMPERSONATION_LEVEL, KACS_SO_PASS_TOKEN and KACS_SO_RESTAMP, and the ancillary message type KACS_SCM_TOKEN, which travels at cmsg_level SOL_KACS (KACS ABI Reference). The kernel dispatches the option level in net/socket.c ahead of the protocol's own handlers (patch net/socket.c), so the options reach KACS on every socket family and KACS decides which it supports. The ancillary message is carried per skb on AF_UNIX: net/core/scm.c gives struct scm_cookie a counted token reference and parses SOL_KACS control messages; net/unix/af_unix.c carries the reference on struct unix_skb_parms, stops a stream read at an identity boundary, and advances the register at the point of consumption. Everything KACS-specific behind those hooks lives in security/pkm/kacs/socket.c. The semantics and error codes are in Impersonation Lifecycle.

System V IPC objects carry descriptors of their own (Objects and Their Descriptors); their rights are include/uapi/pkm/ipc.h, and the same header defines the KACS_SD_AT_SYSV_* flags that let kacs_get_sd and kacs_set_sd address such an object by kind and id (dirfd carries the id, the path is NULL). The lookup is ipc_lsm_with_object, exported from ipc/util.c by ipc/util-lsm-with-object.patch; the hooks themselves are the LSM's own IPC hooks and need no patch.

Three syscall numbers are retired and left as permanent holes: 1010 (kacs_open_peer_token), 1011 (kacs_impersonate_peer) and 1013 (kacs_set_impersonation_level). A binary built against them gets ENOSYS. The first became getsockopt(SOL_KACS, KACS_SO_PEER_TOKEN), the third setsockopt(SOL_KACS, KACS_SO_IMPERSONATION_LEVEL), and the second was a fusion of the first with KACS_IOC_IMPERSONATE that now lives in libpeios as peios_token_impersonate_peer.

Peios Learn — documentation for Peios software.

Built with Trail.