aboutsummaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
authorMicah Morton <mortonm@chromium.org>2019-01-07 19:10:53 -0500
committerJames Morris <james.morris@microsoft.com>2019-01-10 17:16:06 -0500
commitc1a85a00ea66cb6f0bd0f14e47c28c2b0999799f (patch)
tree310c082e0b41d2d3ff8b619553ed5e45ad244862 /security/security.c
parent2233975cd7927672525361c4c6eebc0b8d018a74 (diff)
LSM: generalize flag passing to security_capable
This patch provides a general mechanism for passing flags to the security_capable LSM hook. It replaces the specific 'audit' flag that is used to tell security_capable whether it should log an audit message for the given capability check. The reason for generalizing this flag passing is so we can add an additional flag that signifies whether security_capable is being called by a setid syscall (which is needed by the proposed SafeSetID LSM). Signed-off-by: Micah Morton <mortonm@chromium.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/security/security.c b/security/security.c
index 953fc3ea18a9..a618e22df5c6 100644
--- a/security/security.c
+++ b/security/security.c
@@ -689,16 +689,12 @@ int security_capset(struct cred *new, const struct cred *old,
689 effective, inheritable, permitted); 689 effective, inheritable, permitted);
690} 690}
691 691
692int security_capable(const struct cred *cred, struct user_namespace *ns, 692int security_capable(const struct cred *cred,
693 int cap) 693 struct user_namespace *ns,
694 int cap,
695 unsigned int opts)
694{ 696{
695 return call_int_hook(capable, 0, cred, ns, cap, SECURITY_CAP_AUDIT); 697 return call_int_hook(capable, 0, cred, ns, cap, opts);
696}
697
698int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
699 int cap)
700{
701 return call_int_hook(capable, 0, cred, ns, cap, SECURITY_CAP_NOAUDIT);
702} 698}
703 699
704int security_quotactl(int cmds, int type, int id, struct super_block *sb) 700int security_quotactl(int cmds, int type, int id, struct super_block *sb)