linux/security/smack
Jann Horn fedc88e38c smack: fix cred UAF in smack_file_send_sigiotask()
When inspecting the credentials of another task, objective credentials
(->real_cred, accessed with __task_cred()) must always be used.

Accessing ->cred on a non-current task is forbidden unless that task is
being created or destroyed; a task is allowed to change its own ->cred
pointer with no synchronization, and changing ->cred should only affect the
current syscall.

smack_file_send_sigiotask() was accessing both sets of credentials: First
tsk->cred, then __task_cred(tsk).

Fix it, always access the objective credentials here.

I have tested that this bug can lead to a KASAN-reported UAF of struct cred
in smack_file_send_sigiotask(), and that this fix prevents the race.

Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
History 2026-08-08 09:47:22 -07:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
smack.h smack: restrict smackfs/{direct,mapped} values to 0-255 2026-06-22 13:52:24 -07:00
smack_access.c smack: show msgrcv() subject task in audit 2026-06-22 11:16:40 -07:00
smack_lsm.c smack: fix cred UAF in smack_file_send_sigiotask() 2026-08-08 09:47:22 -07:00
smack_netfilter.c smack: move initcalls to the LSM framework 2025-10-22 19:24:25 -04:00
smackfs.c smack: restrict smackfs/{direct,mapped} values to 0-255 2026-06-22 13:52:24 -07:00