Skip to contentSkip to conversation

sparse doesn't support struct randomization

PATCH Applied Matthew Wilcox 2 participants 2 messages Jan 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparse doesn't support struct randomization

From: Matthew Wilcox <[email protected]>

Without this patch, I drown in a sea of unknown attribute warnings

---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -1
index 2272ded07496..631354acfa72 100644
@@ -219,7 +219,7 @@
 /* Mark a function definition as prohibited from being cloned. */
 #define __noclone	__attribute__((__noclone__, __optimize__("no-tracer")))
 
-#ifdef RANDSTRUCT_PLUGIN
+#if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
 #define __randomize_layout __attribute__((randomize_layout))
 #define __no_randomize_layout __attribute__((no_randomize_layout))
 #endif
Signature · 1 line
2.15.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Matthew Wilcox

From: Matthew Wilcox <[email protected]>

Without this patch, I drown in a sea of unknown attribute warnings

Thanks!

Andrew, are you able to take this? I have no other gcc-plugin changes pending for the coming merge window...

-Kees

Quoted 20 lines
---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -2
index 2272ded07496..631354acfa72 100644
@@ -219,7 +219,7 @@
 /* Mark a function definition as prohibited from being cloned. */
 #define __noclone      __attribute__((__noclone__, __optimize__("no-tracer")))
 
-#ifdef RANDSTRUCT_PLUGIN
+#if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
 #define __randomize_layout __attribute__((randomize_layout))
 #define __no_randomize_layout __attribute__((no_randomize_layout))
 #endif
--

2.15.1

Signature · 2 lines
Kees Cook
Pixel Security