lsm: security_task_getsecid_subj() -> security_current_getsecid_subj()
authorPaul Moore <paul@paul-moore.com>
Wed, 29 Sep 2021 15:01:21 +0000 (11:01 -0400)
committerPaul Moore <paul@paul-moore.com>
Mon, 22 Nov 2021 22:52:47 +0000 (17:52 -0500)
commit6326948f940dc3f77066d5cdc44ba6afe67830c0
tree13976c9bfaedfc1105ac27a1efaf9c752d3949ee
parentfa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf
lsm: security_task_getsecid_subj() -> security_current_getsecid_subj()

The security_task_getsecid_subj() LSM hook invites misuse by allowing
callers to specify a task even though the hook is only safe when the
current task is referenced.  Fix this by removing the task_struct
argument to the hook, requiring LSM implementations to use the
current task.  While we are changing the hook declaration we also
rename the function to security_current_getsecid_subj() in an effort
to reinforce that the hook captures the subjective credentials of the
current task and not an arbitrary task on the system.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
15 files changed:
include/linux/lsm_hook_defs.h
include/linux/lsm_hooks.h
include/linux/security.h
kernel/audit.c
kernel/auditfilter.c
kernel/auditsc.c
net/netlabel/netlabel_unlabeled.c
net/netlabel/netlabel_user.h
security/apparmor/lsm.c
security/integrity/ima/ima_appraise.c
security/integrity/ima/ima_main.c
security/security.c
security/selinux/hooks.c
security/smack/smack.h
security/smack/smack_lsm.c