brintos

brintos / linux-shallow public Read only

0
0
Text · 2.6 KiB · 938593d Raw
94 lines · c
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */2/*3 * Linux Security Modules (LSM) - User space API4 *5 * Copyright (C) 2022 Casey Schaufler <casey@schaufler-ca.com>6 * Copyright (C) 2022 Intel Corporation7 */8 9#ifndef _UAPI_LINUX_LSM_H10#define _UAPI_LINUX_LSM_H11 12#include <linux/stddef.h>13#include <linux/types.h>14#include <linux/unistd.h>15 16/**17 * struct lsm_ctx - LSM context information18 * @id: the LSM id number, see LSM_ID_XXX19 * @flags: LSM specific flags20 * @len: length of the lsm_ctx struct, @ctx and any other data or padding21 * @ctx_len: the size of @ctx22 * @ctx: the LSM context value23 *24 * The @len field MUST be equal to the size of the lsm_ctx struct25 * plus any additional padding and/or data placed after @ctx.26 *27 * In all cases @ctx_len MUST be equal to the length of @ctx.28 * If @ctx is a string value it should be nul terminated with29 * @ctx_len equal to `strlen(@ctx) + 1`.  Binary values are30 * supported.31 *32 * The @flags and @ctx fields SHOULD only be interpreted by the33 * LSM specified by @id; they MUST be set to zero/0 when not used.34 */35struct lsm_ctx {36	__u64 id;37	__u64 flags;38	__u64 len;39	__u64 ctx_len;40	__u8 ctx[] __counted_by(ctx_len);41};42 43/*44 * ID tokens to identify Linux Security Modules (LSMs)45 *46 * These token values are used to uniquely identify specific LSMs47 * in the kernel as well as in the kernel's LSM userspace API.48 *49 * A value of zero/0 is considered undefined and should not be used50 * outside the kernel. Values 1-99 are reserved for potential51 * future use.52 */53#define LSM_ID_UNDEF		054#define LSM_ID_CAPABILITY	10055#define LSM_ID_SELINUX		10156#define LSM_ID_SMACK		10257#define LSM_ID_TOMOYO		10358#define LSM_ID_APPARMOR		10459#define LSM_ID_YAMA		10560#define LSM_ID_LOADPIN		10661#define LSM_ID_SAFESETID	10762#define LSM_ID_LOCKDOWN		10863#define LSM_ID_BPF		10964#define LSM_ID_LANDLOCK		11065#define LSM_ID_IMA		11166#define LSM_ID_EVM		11267#define LSM_ID_IPE		11368 69/*70 * LSM_ATTR_XXX definitions identify different LSM attributes71 * which are used in the kernel's LSM userspace API. Support72 * for these attributes vary across the different LSMs. None73 * are required.74 *75 * A value of zero/0 is considered undefined and should not be used76 * outside the kernel. Values 1-99 are reserved for potential77 * future use.78 */79#define LSM_ATTR_UNDEF		080#define LSM_ATTR_CURRENT	10081#define LSM_ATTR_EXEC		10182#define LSM_ATTR_FSCREATE	10283#define LSM_ATTR_KEYCREATE	10384#define LSM_ATTR_PREV		10485#define LSM_ATTR_SOCKCREATE	10586 87/*88 * LSM_FLAG_XXX definitions identify special handling instructions89 * for the API.90 */91#define LSM_FLAG_SINGLE	0x000192 93#endif /* _UAPI_LINUX_LSM_H */94