[PATCH 3/3] ima: Mark concurrent accesses to the iint pointer in the inode security blob
From: Roberto Sassu
Date: Tue Oct 08 2024 - 12:58:39 EST
From: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
Use the READ_ONCE() and WRITE_ONCE() macros to mark concurrent read and
write accesses to the portion of the inode security blob containing the
iint pointer.
Writers are serialized by the iint lock.
Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
---
security/integrity/ima/ima.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 6474a15b584a..3fe1651395ce 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -215,7 +215,7 @@ ima_inode_get_iint(const struct inode *inode)
return NULL;
iint_lock = ima_inode_security(inode->i_security);
- return iint_lock->iint;
+ return READ_ONCE(iint_lock->iint);
}
static inline void ima_inode_set_iint(const struct inode *inode,
@@ -227,7 +227,7 @@ static inline void ima_inode_set_iint(const struct inode *inode,
return;
iint_lock = ima_inode_security(inode->i_security);
- iint_lock->iint = iint;
+ WRITE_ONCE(iint_lock->iint, iint);
}
struct ima_iint_cache *ima_iint_find(struct inode *inode);
--
2.34.1