aboutsummaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
authorMicah Morton <mortonm@chromium.org>2022-06-08 20:57:11 +0000
committerMicah Morton <mortonm@chromium.org>2022-07-15 18:21:49 +0000
commitfcfe0ac2fcfae7d5fcad3d0375cb8ff38caf8aba (patch)
tree5cb709520c62f77b5a276d77d069a0238b2443ae /security/security.c
parentLSM: SafeSetID: add GID testing to selftest (diff)
downloadlinux-dev-fcfe0ac2fcfae7d5fcad3d0375cb8ff38caf8aba.tar.xz
linux-dev-fcfe0ac2fcfae7d5fcad3d0375cb8ff38caf8aba.zip
security: Add LSM hook to setgroups() syscall
Give the LSM framework the ability to filter setgroups() syscalls. There are already analagous hooks for the set*uid() and set*gid() syscalls. The SafeSetID LSM will use this new hook to ensure setgroups() calls are allowed by the installed security policy. Tested by putting print statement in security_task_fix_setgroups() hook and confirming that it gets hit when userspace does a setgroups() syscall. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Micah Morton <mortonm@chromium.org>
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c
index 188b8f782220..15c686145ad6 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1803,6 +1803,11 @@ int security_task_fix_setgid(struct cred *new, const struct cred *old,
return call_int_hook(task_fix_setgid, 0, new, old, flags);
}
+int security_task_fix_setgroups(struct cred *new, const struct cred *old)
+{
+ return call_int_hook(task_fix_setgroups, 0, new, old);
+}
+
int security_task_setpgid(struct task_struct *p, pid_t pgid)
{
return call_int_hook(task_setpgid, 0, p, pgid);