Commit 2571bb9d authored by Stephen Smalley's avatar Stephen Smalley Committed by Paul Moore
Browse files

selinux: annotate false positive data race to avoid KCSAN warnings



KCSAN flags the check of isec->initialized by
__inode_security_revalidate() as a data race. This is indeed a racy
check, but inode_doinit_with_dentry() will recheck with isec->lock held.
Annotate the check with the data_race() macro to silence the KCSAN false
positive.

Reported-by: default avatar <syzbot+319ed1769c0078257262@syzkaller.appspotmail.com>
Signed-off-by: default avatarStephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent fc328c86
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -282,8 +282,13 @@ static int __inode_security_revalidate(struct inode *inode,

	might_sleep_if(may_sleep);

	/*
	 * The check of isec->initialized below is racy but
	 * inode_doinit_with_dentry() will recheck with
	 * isec->lock held.
	 */
	if (selinux_initialized() &&
	    isec->initialized != LABEL_INITIALIZED) {
	    data_race(isec->initialized != LABEL_INITIALIZED)) {
		if (!may_sleep)
			return -ECHILD;