Skip to contentSkip to conversation

lsm: update the BUILD_BUG_ON() in audit_log_lsm_data()

PATCH In review Paul Moore 1 participant 3 messages Aug 13 – Aug 31 Security (LSM)

lore
Share & tools
lore

Paul Moore

author maintainer
#0 lore raw

PATCH 1/1 lsm: update the BUILD_BUG_ON() in audit_log_lsm_data()

On 32-bit systems the newly added namespace fields in the common_audit_data struct exceed the BUILD_BUG_ON(sizeof(void *) * 2) size check in audit_log_lsm_data(). Convert the size check to two u64 types to both fit the new fields and move to a size that is not architecture dependent.

Fixes bb20ca26f960 ("lsm: add LSM_AUDIT_DATA_NS for namespace audit records")
---
 security/lsm_audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/lsm_audit.c +1 -1
index 404ccbbbf94c..29116ef2986b 100644
@@ -182,7 +182,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
 	 * start making this union too large!  See struct lsm_network_audit
 	 * as an example of how to deal with large data.
 	 */
-	BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
+	BUILD_BUG_ON(sizeof(a->u) > (sizeof(u64) * 2));
 
 	switch (a->type) {
 	case LSM_AUDIT_DATA_NONE:
Signature · 1 line
2.55.0
author maintainer
#1 lore raw
Quoted 7 lines · Paul Moore

On 32-bit systems the newly added namespace fields in the common_audit_data struct exceed the BUILD_BUG_ON(sizeof(void *) * 2) size check in audit_log_lsm_data(). Convert the size check to two u64 types to both fit the new fields and move to a size that is not architecture dependent.

Quoted 7 lines
Fixes bb20ca26f960 ("lsm: add LSM_AUDIT_DATA_NS for namespace audit records")
---
 security/lsm_audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I'm applying this to lsm/dev-staging to fix the kernel test robot build failure, but as this is just the dev-staging branch, please feel free to comment on how this is a stupid patch, ACK, review, etc. as you see fit.

Signature · 1 line
paul-moore.com
author maintainer
#2 lore raw
Quoted 16 lines · Paul Moore
Quoted 7 lines · Paul Moore

On 32-bit systems the newly added namespace fields in the common_audit_data struct exceed the BUILD_BUG_ON(sizeof(void *) * 2) size check in audit_log_lsm_data(). Convert the size check to two u64 types to both fit the new fields and move to a size that is not architecture dependent.

Quoted 7 lines
Fixes bb20ca26f960 ("lsm: add LSM_AUDIT_DATA_NS for namespace audit records")
---
 security/lsm_audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

I'm applying this to lsm/dev-staging to fix the kernel test robot build failure, but as this is just the dev-staging branch, please feel free to comment on how this is a stupid patch, ACK, review, etc. as you see fit.

This is now in lsm/dev.

Signature · 1 line
paul-moore.com