linux/init
Jann Horn b030ffaedc cred: clarify that task_struct::cred is only for the current task
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 <jannh@google.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
[PM: style tweak in security_init(), applied fixup from JH]
Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-08-31 16:14:09 -04:00
..
.gitignore
.kunitconfig
calibrate.c
do_mounts_initrd.c
do_mounts_rd.c
do_mounts.c
do_mounts.h
init_task.c cred: clarify that task_struct::cred is only for the current task 2026-08-31 16:14:09 -04:00
initramfs_internal.h
initramfs_test.c
initramfs.c
Kconfig Bootconfig updates for v7.3: 2026-08-25 08:59:09 -07:00
main.c Bootconfig updates for v7.3: 2026-08-25 08:59:09 -07:00
Makefile
noinitramfs.c
version-timestamp.c
version.c