[RFC PATCH 2/2] selinux: fix data race on AVC latest_notif

From: Christian Göttsche

Date: Mon Feb 02 2026 - 08:49:15 EST


From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

The latest revocation notification of the AVC cache can be bumped
concurrently. Ensure an atomic read using READ_ONCE() and please
KCSAN by using data_race().

Reported-by: syzbot+a7f7cb0737bd91aa698c@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=a7f7cb0737bd91aa698c
Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
security/selinux/avc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 8f77b9a732e1..fd1f9486fa98 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -1204,5 +1204,5 @@ int avc_has_perm(u32 ssid, u32 tsid, u16 tclass,

u32 avc_policy_seqno(void)
{
- return selinux_avc.avc_cache.latest_notif;
+ return data_race(READ_ONCE(selinux_avc.avc_cache.latest_notif));
}
--
2.51.0