Skip to content

Commit 1cd2aca

Browse files
committed
lsm: move the io_uring hook comments to security/security.c
This patch relocates the LSM hook function comments to the function definitions, in keeping with the current kernel conventions. This should make the hook descriptions more easily discoverable and easier to maintain. While formatting changes have been done to better fit the kernel-doc style, content changes have been kept to a minimum and limited to text which was obviously incorrect and/or outdated. It is expected the future patches will improve the quality of the function header comments. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 452b670 commit 1cd2aca

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

include/linux/lsm_hooks.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,6 @@
196196
* @what: kernel feature being accessed.
197197
* Return 0 if permission is granted.
198198
*
199-
* Security hooks for io_uring
200-
*
201-
* @uring_override_creds:
202-
* Check if the current task, executing an io_uring operation, is allowed
203-
* to override it's credentials with @new.
204-
* @new: the new creds to use.
205-
* Return 0 if permission is granted.
206-
*
207-
* @uring_sqpoll:
208-
* Check whether the current task is allowed to spawn a io_uring polling
209-
* thread (IORING_SETUP_SQPOLL).
210-
* Return 0 if permission is granted.
211-
*
212-
* @uring_cmd:
213-
* Check whether the file_operations uring_cmd is allowed to run.
214-
* Return 0 if permission is granted.
215-
*
216199
*/
217200
union security_list_options {
218201
#define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__);

security/security.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4993,15 +4993,41 @@ int security_perf_event_write(struct perf_event *event)
49934993
#endif /* CONFIG_PERF_EVENTS */
49944994

49954995
#ifdef CONFIG_IO_URING
4996+
/**
4997+
* security_uring_override_creds() - Check if overriding creds is allowed
4998+
* @new: new credentials
4999+
*
5000+
* Check if the current task, executing an io_uring operation, is allowed to
5001+
* override it's credentials with @new.
5002+
*
5003+
* Return: Returns 0 if permission is granted.
5004+
*/
49965005
int security_uring_override_creds(const struct cred *new)
49975006
{
49985007
return call_int_hook(uring_override_creds, 0, new);
49995008
}
50005009

5010+
/**
5011+
* security_uring_sqpoll() - Check if IORING_SETUP_SQPOLL is allowed
5012+
*
5013+
* Check whether the current task is allowed to spawn a io_uring polling thread
5014+
* (IORING_SETUP_SQPOLL).
5015+
*
5016+
* Return: Returns 0 if permission is granted.
5017+
*/
50015018
int security_uring_sqpoll(void)
50025019
{
50035020
return call_int_hook(uring_sqpoll, 0);
50045021
}
5022+
5023+
/**
5024+
* security_uring_cmd() - Check if a io_uring passthrough command is allowed
5025+
* @ioucmd: command
5026+
*
5027+
* Check whether the file_operations uring_cmd is allowed to run.
5028+
*
5029+
* Return: Returns 0 if permission is granted.
5030+
*/
50055031
int security_uring_cmd(struct io_uring_cmd *ioucmd)
50065032
{
50075033
return call_int_hook(uring_cmd, 0, ioucmd);

0 commit comments

Comments
 (0)