Generated syscall and common ABI

Every name, value, offset and size in this appendix is generated from include/uapi/pkm/lcs.h by tools/docs/peios-reference/generators/gen-lcs-abi.py, with ioctl encodings and struct layouts measured by compiling a probe against the real header. Regenerate it whenever the ABI changes; do not edit it by hand. The names here are the ones a program actually compiles against.

What a compiler cannot measure -- which properties belong with their operations rather than here, and the kernel configuration -- is in the notes appendix, LCS ABI Notes, which this generator does not touch.

Syscall numbers #

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

NumberPKM constantglibc aliasSignature
1100SYS_REG_OPEN_KEYSYS_reg_open_keyreg_open_key(int parent_fd, const char __user *path, u32 desired_access, u32 flags)
1101SYS_REG_CREATE_KEYSYS_reg_create_keyreg_create_key(const struct reg_create_key_args __user *args)
1102SYS_REG_BEGIN_TRANSACTIONSYS_reg_begin_transactionreg_begin_transaction(void)
1103SYS_REG_BEGIN_READ_TRANSACTIONSYS_reg_begin_read_transactionreg_begin_read_transaction(void)
1104SYS_REG_OPEN_KEY_TRANSACTEDSYS_reg_open_key_transactedreg_open_key_transacted(int parent_fd, const char __user *path, u32 desired_access, u32 flags, int txn_fd)

Ioctls #

The type byte is 'R'. Ioctl number namespaces are per fd type, so REG_SRC_REGISTER (number 0 on the source device) and REG_IOC_QUERY_VALUE (number 0 on a key fd) do not collide: the kernel dispatches on the fd's file_operations, not globally. The encoded value is what _IOC produces from the direction, type byte, number and argument size.

Source device fd.

IoctlNumberDirectionArgumentArg sizeEncoded
REG_SRC_REGISTER0_IOWstruct reg_src_register_args240x40185200
REG_SRC_NEGOTIATE1_IOWRstruct reg_src_negotiate_args160xC0105201
REG_SRC_REQUEST_CONTEXT2_IOWRstruct reg_src_request_context_args400xC0285202
REG_SRC_RENEW3_IOWRstruct reg_src_renew_args320xC0205203

Key fd.

IoctlNumberDirectionArgumentArg sizeEncoded
REG_IOC_QUERY_VALUE0_IOWRstruct reg_query_value_args640xC0405200
REG_IOC_SET_VALUE1_IOWstruct reg_set_value_args640x40405201
REG_IOC_DELETE_VALUE2_IOWstruct reg_delete_value_args400x40285202
REG_IOC_BLANKET_TOMBSTONE3_IOWstruct reg_blanket_tombstone_args240x40185203
REG_IOC_QUERY_VALUES_BATCH4_IOWRstruct reg_query_values_batch_args240xC0185204
REG_IOC_ENUM_VALUES5_IOWRstruct reg_enum_value_args400xC0285205
REG_IOC_ENUM_SUBKEYS6_IOWRstruct reg_enum_subkey_args400xC0285206
REG_IOC_QUERY_KEY_INFO7_IOWRstruct reg_query_key_info_args640xC0405207
REG_IOC_DELETE_KEY8_IOWstruct reg_delete_key_args240x40185208
REG_IOC_HIDE_KEY9_IOWstruct reg_hide_key_args240x40185209
REG_IOC_GET_SECURITY10_IOWRstruct reg_get_security_args160xC010520A
REG_IOC_SET_SECURITY11_IOWstruct reg_set_security_args240x4018520B
REG_IOC_NOTIFY12_IOWstruct reg_notify_args80x4008520C
REG_IOC_FLUSH13_IOnone00x0000520D
REG_IOC_BACKUP14_IOWstruct reg_backup_args40x4004520E
REG_IOC_RESTORE15_IOWstruct reg_restore_args40x4004520F
REG_IOC_QUERY_KEY_INFO_TRANSACTED18_IOWRstruct reg_read_transacted_args160xC0105212
REG_IOC_GET_SECURITY_TRANSACTED19_IOWRstruct reg_read_transacted_args160xC0105213

Transaction fd.

IoctlNumberDirectionArgumentArg sizeEncoded
REG_IOC_COMMIT16_IOnone00x00005210
REG_IOC_TXN_STATUS17_IORstruct reg_txn_status_args80x80085211

Structure layouts #

Offsets and sizes are measured, not declared. The header also defines a _SIZE constant for each of these structures; the two agree by construction, and a mismatch fails the build in uapi/smoke_test.c.

Constants #

Grouped as the header groups them.

Optional RSI lifetime extension, negotiated before REG_SRC_REGISTER. All timestamps use CLOCK_MONOTONIC nanoseconds. Zero lifetime means an operation-owned transaction with no independent lifetime limit. The session is unique to this open source fd, including across restarts.

ConstantValue
REG_SRC_LIFETIME_VERSION1

Syscall and ioctl argument sizes (Kernel TRM section 5.A, LCS ABI).

ConstantValue
REG_CREATE_KEY_ARGS_SIZE48
REG_QUERY_VALUE_ARGS_SIZE64
REG_SET_VALUE_ARGS_SIZE64
REG_DELETE_VALUE_ARGS_SIZE40
REG_BLANKET_TOMBSTONE_ARGS_SIZE24
REG_QUERY_VALUES_BATCH_ARGS_SIZE24
REG_ENUM_VALUE_ARGS_SIZE40
REG_ENUM_SUBKEY_ARGS_SIZE40
REG_QUERY_KEY_INFO_ARGS_SIZE64
REG_READ_TRANSACTED_ARGS_SIZE16
REG_DELETE_KEY_ARGS_SIZE24
REG_HIDE_KEY_ARGS_SIZE24
REG_GET_SECURITY_ARGS_SIZE16
REG_SET_SECURITY_ARGS_SIZE24
REG_NOTIFY_ARGS_SIZE8
REG_BACKUP_ARGS_SIZE4
REG_RESTORE_ARGS_SIZE4
REG_TXN_STATUS_ARGS_SIZE8
REG_SRC_NEGOTIATE_ARGS_SIZE16
REG_SRC_REQUEST_CONTEXT_ARGS_SIZE40
REG_SRC_RENEW_ARGS_SIZE32
REG_SRC_REGISTER_ARGS_SIZE24
REG_SRC_HIVE_ENTRY_SIZE56

Transaction state codes.

ConstantValue
REG_TXN_ACTIVE_UNBOUND0
REG_TXN_ACTIVE_BOUND1
REG_TXN_COMMITTED2
REG_TXN_ABORTED3
REG_TXN_TIMED_OUT4
REG_TXN_SOURCE_DOWN5

Syscall flags and dispositions.

ConstantValue
REG_OPEN_LINK0x01
REG_OPTION_VOLATILE0x01
REG_OPTION_CREATE_LINK0x02
REG_CREATED_NEW1
REG_OPENED_EXISTING2

Registry key access rights.

ConstantValue
KEY_QUERY_VALUE0x00000001
KEY_SET_VALUE0x00000002
KEY_CREATE_SUB_KEY0x00000004
KEY_ENUMERATE_SUB_KEYS0x00000008
KEY_NOTIFY0x00000010
KEY_CREATE_LINK0x00000020
DELETE0x00010000
READ_CONTROL0x00020000
WRITE_DAC0x00040000
WRITE_OWNER0x00080000
ACCESS_SYSTEM_SECURITY0x01000000
MAXIMUM_ALLOWED0x02000000
GENERIC_ALL0x10000000
GENERIC_EXECUTE0x20000000
GENERIC_WRITE0x40000000
GENERIC_READ0x80000000
KEY_READ0x00020019
KEY_WRITE0x00020006
KEY_ALL_ACCESS0x000F003F
REG_VALID_DESIRED_ACCESS_MASK0xF30F003F
REG_VALID_MAPPED_ACCESS_MASK0x010F003F
REG_VALID_ACE_ACCESS_MASK0xF10F003F

Security information flags for REG_IOC_GET_SECURITY / SET_SECURITY.

ConstantValue
OWNER_SECURITY_INFORMATION0x00000001
GROUP_SECURITY_INFORMATION0x00000002
DACL_SECURITY_INFORMATION0x00000004
SACL_SECURITY_INFORMATION0x00000008
LABEL_SECURITY_INFORMATION0x00000010
REG_VALID_SECURITY_INFORMATION0x0000001F

Registry value types.

ConstantValue
REG_NONE0
REG_SZ1
REG_EXPAND_SZ2
REG_BINARY3
REG_DWORD4
REG_DWORD_BIG_ENDIAN5
REG_LINK6
REG_MULTI_SZ7
REG_RESOURCE_LIST8
REG_FULL_RESOURCE_DESCRIPTOR9
REG_RESOURCE_REQUIREMENTS_LIST10
REG_QWORD11
REG_TOMBSTONE0xFFFF

Watch event types and filters.

ConstantValue
REG_WATCH_VALUE_SET1
REG_WATCH_VALUE_DELETED2
REG_WATCH_SUBKEY_CREATED3
REG_WATCH_SUBKEY_DELETED4
REG_WATCH_SD_CHANGED5
REG_WATCH_KEY_DELETED6
REG_WATCH_OVERFLOW7

Watch event raw byte layout.

ConstantValue
REG_WATCH_EVENT_TOTAL_LEN_OFFSET0
REG_WATCH_EVENT_TYPE_OFFSET4
REG_WATCH_EVENT_NAME_LEN_OFFSET6
REG_WATCH_EVENT_NAME_OFFSET8
REG_WATCH_EVENT_MIN_SIZE8
REG_WATCH_SUBTREE_PATH_DEPTH_REL_OFFSET0
REG_WATCH_SUBTREE_PATH_DEPTH_SIZE2
REG_WATCH_SUBTREE_PATH_COMPONENTS_REL_OFFSET2
REG_WATCH_PATH_COMPONENT_LEN_SIZE2
REG_NOTIFY_VALUE0x01
REG_NOTIFY_SUBKEY0x02
REG_NOTIFY_SD0x04
REG_NOTIFY_ALL0x07

RSI common wire layout.

ConstantValue
RSI_REQUEST_TOTAL_LEN_OFFSET0
RSI_REQUEST_ID_OFFSET4
RSI_REQUEST_OP_CODE_OFFSET12
RSI_REQUEST_TXN_ID_OFFSET14
RSI_REQUEST_HEADER_SIZE22
RSI_RESPONSE_TOTAL_LEN_OFFSET0
RSI_RESPONSE_ID_OFFSET4
RSI_RESPONSE_OP_CODE_OFFSET12
RSI_RESPONSE_HEADER_SIZE14
RSI_RESPONSE_STATUS_OFFSET14
RSI_STATUS_SIZE4
RSI_MIN_RESPONSE_SIZE18
RSI_LENGTH_PREFIX_SIZE4
RSI_GUID_SIZE16
RSI_RESPONSE_BIT0x8000

RSI op codes and response op codes.

ConstantValue
RSI_LOOKUP0x0001
RSI_CREATE_ENTRY0x0002
RSI_HIDE_ENTRY0x0003
RSI_DELETE_ENTRY0x0004
RSI_ENUM_CHILDREN0x0005
RSI_CREATE_KEY0x0010
RSI_READ_KEY0x0011
RSI_WRITE_KEY0x0012
RSI_DROP_KEY0x0013
RSI_QUERY_VALUES0x0020
RSI_SET_VALUE0x0021
RSI_DELETE_VALUE_ENTRY0x0022
RSI_SET_BLANKET_TOMBSTONE0x0023
RSI_BEGIN_TRANSACTION0x0030
RSI_COMMIT_TRANSACTION0x0031
RSI_ABORT_TRANSACTION0x0032
RSI_FLUSH0x0040
RSI_DELETE_LAYER0x0050
RSI_LOOKUP_RESPONSE0x8001
RSI_CREATE_ENTRY_RESPONSE0x8002
RSI_HIDE_ENTRY_RESPONSE0x8003
RSI_DELETE_ENTRY_RESPONSE0x8004
RSI_ENUM_CHILDREN_RESPONSE0x8005
RSI_CREATE_KEY_RESPONSE0x8010
RSI_READ_KEY_RESPONSE0x8011
RSI_WRITE_KEY_RESPONSE0x8012
RSI_DROP_KEY_RESPONSE0x8013
RSI_QUERY_VALUES_RESPONSE0x8020
RSI_SET_VALUE_RESPONSE0x8021
RSI_DELETE_VALUE_ENTRY_RESPONSE0x8022
RSI_SET_BLANKET_TOMBSTONE_RESPONSE0x8023
RSI_BEGIN_TRANSACTION_RESPONSE0x8030
RSI_COMMIT_TRANSACTION_RESPONSE0x8031
RSI_ABORT_TRANSACTION_RESPONSE0x8032
RSI_FLUSH_RESPONSE0x8040
RSI_DELETE_LAYER_RESPONSE0x8050

RSI status codes.

ConstantValue
RSI_OK0
RSI_NOT_FOUND1
RSI_ALREADY_EXISTS2
RSI_STORAGE_ERROR3
RSI_NOT_EMPTY4
RSI_TOO_LARGE5
RSI_TXN_BUSY6
RSI_INVALID7
RSI_CAS_FAILED8
RSI_TXN_NOT_SUPPORTED9

RSI path target types.

ConstantValue
RSI_PATH_TARGET_GUID0
RSI_PATH_TARGET_HIDDEN1

RSI_WRITE_KEY field mask bits.

ConstantValue
RSI_WRITE_KEY_FIELD_SD0x01
RSI_WRITE_KEY_FIELD_LAST_WRITE_TIME0x02
RSI_WRITE_KEY_FIELD_KNOWN_MASK0x00000003

RSI transaction modes and source-registration flags.

ConstantValue
RSI_TXN_READ_WRITE0
RSI_TXN_READ_ONLY1
RSI_HIVE_PRIVATE0x01

Backup record types and magic.

ConstantValue
REG_BACKUP_HEADER0x01
REG_BACKUP_LAYER0x02
REG_BACKUP_KEY0x03
REG_BACKUP_PATH_ENTRY0x04
REG_BACKUP_VALUE0x05
REG_BACKUP_BLANKET_TOMBSTONE0x06
REG_BACKUP_TRAILER0xFF
REG_BACKUP_MAGIC"PEIOSREG"

Edit this page