mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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>
This commit is contained in:
@@ -1537,7 +1537,7 @@ int __init netlbl_unlabel_defconf(void)
|
||||
/* Only the kernel is allowed to call this function and the only time
|
||||
* it is called is at bootup before the audit subsystem is reporting
|
||||
* messages so don't worry to much about these values. */
|
||||
security_task_getsecid_subj(current, &audit_info.secid);
|
||||
security_current_getsecid_subj(&audit_info.secid);
|
||||
audit_info.loginuid = GLOBAL_ROOT_UID;
|
||||
audit_info.sessionid = 0;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
static inline void netlbl_netlink_auditinfo(struct netlbl_audit *audit_info)
|
||||
{
|
||||
security_task_getsecid_subj(current, &audit_info->secid);
|
||||
security_current_getsecid_subj(&audit_info->secid);
|
||||
audit_info->loginuid = audit_get_loginuid(current);
|
||||
audit_info->sessionid = audit_get_sessionid(current);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user