lsm,uapi: introduce LSM_ATTR_UNSHARE
Subsystems (3)
Stephen Smalley
maintainerPATCH v2 1/1 lsm,uapi: introduce LSM_ATTR_UNSHARE
This defines a new LSM_ATTR_UNSHARE attribute for the lsm_set_self_attr(2) and lsm_get_self_attr(2) system calls. When passed to lsm_set_self_attr(2), the LSM-specific namespace for the specified LSM id is immediately unshared in a similar manner to the unshare(2) system call for other Linux namespaces. When passed to lsm_get_self_attr(2), ctx->ctx_len is set to 1 and ctx->ctx[0] is set to a boolean (0 or 1) that indicates whether the LSM-specific namespace for the specified LSM id has been unshared and not yet fully initialized (e.g. no policy yet loaded).
Signed-off-by Stephen Smalley <[email protected]>
--- Documentation/userspace-api/lsm.rst | 11 +++++++++++ include/uapi/linux/lsm.h | 1 + 2 files changed, 12 insertions(+)
Documentation/userspace-api/lsm.rst +11 -0
@@ -48,6 +48,17 @@ creating socket objects. The proc filesystem provides this value in ``/proc/self/attr/sockcreate``. This is supported by the SELinux security module. +``LSM_ATTR_UNSHARE`` is used to unshare the LSM-specific namespace for +the process. +When passed to ``lsm_set_self_attr(2)``, the LSM-specific namespace +for the specified LSM id is immediately unshared in a similar manner +to the ``unshare(2)`` system call for other Linux namespaces. When +passed to ``lsm_get_self_attr(2)``, ``ctx->ctx_len`` is set to ``1`` +and ``ctx->ctx[0]`` is set to a boolean (``0`` or ``1``) that +indicates whether the LSM-specific namespace for the specified LSM id +has been unshared and not yet fully initialized (e.g. no policy yet +loaded). + Kernel interface ================
include/uapi/linux/lsm.h +1 -0
@@ -83,6 +83,7 @@ struct lsm_ctx {#define LSM_ATTR_KEYCREATE 103#define LSM_ATTR_PREV 104#define LSM_ATTR_SOCKCREATE 105 +#define LSM_ATTR_UNSHARE 106/* * LSM_FLAG_XXX definitions identify special handling instructions
Signature · 1 line
2.51.0