diff options
author | Lokesh Gidra <lokeshgidra@google.com> | 2021-01-08 14:22:20 -0800 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2021-01-14 17:28:24 -0500 |
commit | 215b674b84dd052098fe6389e32a5afaff8b4d56 (patch) | |
tree | 70382b40681e709a8f7790d03cc00adbad4726fa /include/linux/lsm_hooks.h | |
parent | 08abe46b2cfcf5f815cd4961b1bf9e10b1714c6d (diff) | |
download | linux-215b674b84dd052098fe6389e32a5afaff8b4d56.tar.gz linux-215b674b84dd052098fe6389e32a5afaff8b4d56.tar.bz2 linux-215b674b84dd052098fe6389e32a5afaff8b4d56.zip |
security: add inode_init_security_anon() LSM hook
This change adds a new LSM hook, inode_init_security_anon(), that will
be used while creating secure anonymous inodes. The hook allows/denies
its creation and assigns a security context to the inode.
The new hook accepts an optional context_inode parameter that callers
can use to provide additional contextual information to security modules
for granting/denying permission to create an anon-inode of the same type.
This context_inode's security_context can also be used to initialize the
newly created anon-inode's security_context.
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'include/linux/lsm_hooks.h')
-rw-r--r-- | include/linux/lsm_hooks.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index a19adef1f088..bdfc8a76a4f7 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -233,6 +233,15 @@ * Returns 0 if @name and @value have been successfully set, * -EOPNOTSUPP if no security attribute is needed, or * -ENOMEM on memory allocation failure. + * @inode_init_security_anon: + * Set up the incore security field for the new anonymous inode + * and return whether the inode creation is permitted by the security + * module or not. + * @inode contains the inode structure + * @name name of the anonymous inode class + * @context_inode optional related inode + * Returns 0 on success, -EACCES if the security module denies the + * creation of this inode, or another -errno upon other errors. * @inode_create: * Check permission to create a regular file. * @dir contains inode structure of the parent of the new file. |