LSM: add SafeSetID module that gates setid calls
authorMicah Morton <mortonm@chromium.org>
Tue, 22 Jan 2019 22:42:09 +0000 (14:42 -0800)
committerJames Morris <james.morris@microsoft.com>
Fri, 25 Jan 2019 19:22:43 +0000 (11:22 -0800)
commit40852275a94afb3e836be9248399e036982d1a79
tree97db7b5d7dfae0ecd678b57bc861e60e949afe44
parent4b42564181d683d767b495d7041b1f229468042f
LSM: add SafeSetID module that gates setid calls

This change ensures that the set*uid family of syscalls in kernel/sys.c
(setreuid, setuid, setresuid, setfsuid) all call ns_capable_common with
the CAP_OPT_INSETID flag, so capability checks in the security_capable
hook can know whether they are being called from within a set*uid
syscall. This change is a no-op by itself, but is needed for the
proposed SafeSetID LSM.

Signed-off-by: Micah Morton <mortonm@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <james.morris@microsoft.com>
include/linux/capability.h
kernel/capability.c
kernel/sys.c