diff options
author | Hamza Mahfooz <hamzamahfooz@linux.microsoft.com> | 2025-01-27 10:57:18 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2025-02-07 17:17:49 -0500 |
commit | c6ad9fdbd44b78f51fa50138247694774ab99e97 (patch) | |
tree | e28a1056a83be8177af5db7c75959d431267bd1c /security/security.c | |
parent | b8a468e0b0604a10e72ab7f55af0f931aac1d477 (diff) |
io_uring,lsm,selinux: add LSM hooks for io_uring_setup()
It is desirable to allow LSM to configure accessibility to io_uring
because it is a coarse yet very simple way to restrict access to it. So,
add an LSM for io_uring_allowed() to guard access to io_uring.
Cc: Paul Moore <paul@paul-moore.com>
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
[PM: merge fuzz due to changes in preceding patches, subj tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c index 143561ebc3e8..c9fae447327e 100644 --- a/security/security.c +++ b/security/security.c @@ -5999,6 +5999,18 @@ int security_uring_cmd(struct io_uring_cmd *ioucmd) { return call_int_hook(uring_cmd, ioucmd); } + +/** + * security_uring_allowed() - Check if io_uring_setup() is allowed + * + * Check whether the current task is allowed to call io_uring_setup(). + * + * Return: Returns 0 if permission is granted. + */ +int security_uring_allowed(void) +{ + return call_int_hook(uring_allowed); +} #endif /* CONFIG_IO_URING */ /** |