android_kernel_motorola_sm6375/security/smack
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jiawei Ye e8c1082c72 smackfs: Use rcu_assign_pointer() to ensure safe assignment in smk_set_cipso
[ Upstream commit 2749749afa071f8a0e405605de9da615e771a7ce ]

In the `smk_set_cipso` function, the `skp->smk_netlabel.attr.mls.cat`
field is directly assigned to a new value without using the appropriate
RCU pointer assignment functions. According to RCU usage rules, this is
illegal and can lead to unpredictable behavior, including data
inconsistencies and impossible-to-diagnose memory corruption issues.

This possible bug was identified using a static analysis tool developed
by myself, specifically designed to detect RCU-related issues.

To address this, the assignment is now done using rcu_assign_pointer(),
which ensures that the pointer assignment is done safely, with the
necessary memory barriers and synchronization. This change prevents
potential RCU dereference issues by ensuring that the `cat` field is
safely updated while still adhering to RCU's requirements.

Fixes: 0817534ff9ea ("smackfs: Fix use-after-free in netlbl_catmap_walk()")
Signed-off-by: Jiawei Ye <jiawei.ye@foxmail.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-08 16:20:30 +01:00
..
Kconfig
Makefile
smack.h smack: Record transmuting in smk_transmuted 2023-10-10 21:46:41 +02:00
smack_access.c
smack_lsm.c smack: unix sockets: fix accept()ed socket label 2024-09-12 11:03:52 +02:00
smack_netfilter.c
smackfs.c smackfs: Use rcu_assign_pointer() to ensure safe assignment in smk_set_cipso 2024-11-08 16:20:30 +01:00