mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
The `cred` field in task_struct is currently marked as __rcu, but that's not true: It can point to credentials from access_override_creds(), which do not get freed with RCU delay. What actually protects task_struct::cred is that accessing it is only permitted for the current task (except for setting up a child during fork() or tearing down a dead process). (There is currently code in Smack that violates this rule, but that's a bug and causes UAF, I have sent a separate fix for that.) Clarify this, remove the __rcu marker, and remove RCU helpers from all accesses to this field. Signed-off-by: Jann Horn <[email protected]> Reviewed-by: Serge Hallyn <[email protected]> [PM: style tweak in security_init(), applied fixup from JH] Signed-off-by: Paul Moore <[email protected]>