Skip to contentSkip to conversation

kasan: Makefile: shut up warnings if CONFIG_COMPILE_TEST=y

PATCH In review Andrey Ryabinin 2 participants 4 messages Apr 8, 2015 – Apr 9, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 kasan: Makefile: shut up warnings if CONFIG_COMPILE_TEST=y

It might be annoying to constantly see this:

scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler

while performing allmodconfig/allyesconfig build tests. Disable this warning if CONFIG_COMPILE_TEST=y.

---
 scripts/Makefile.kasan | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.kasan +6 -2
index 631619b..3f874d2 100644
@@ -13,12 +13,16 @@ CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
 		--param asan-instrumentation-with-call-threshold=$(call_threshold))
 
 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
+   ifneq ($(CONFIG_COMPILE_TEST),y)
         $(warning Cannot use CONFIG_KASAN: \
             -fsanitize=kernel-address is not supported by compiler)
+   endif
 else
     ifeq ($(CFLAGS_KASAN),)
-        $(warning CONFIG_KASAN: compiler does not support all options.\
-            Trying minimal configuration)
+        ifneq ($(CONFIG_COMPILE_TEST),y)
+            $(warning CONFIG_KASAN: compiler does not support all options.\
+                Trying minimal configuration)
+        endif
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif
Signature · 1 line
2.3.5
#2 lore raw
Quoted 5 lines · Andrey Ryabinin

It might be annoying to constantly see this:

scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler

while performing allmodconfig/allyesconfig build tests.

That warning might be seen - once per build - because allmodconfig and allyesconfig enable both CONFIG_KASAN and CONFIG_COMPILE_TEST, right?

Quoted 1 line

Disable this warning if CONFIG_COMPILE_TEST=y.

Do we expect that some people want to enable both KASAN and COMPILE_TEST manually (ie, not as a result of allmodconfig or allyesconfig)? If so, those people might now be in for some head-scratching if their compiler lacks what's apparently needed to run kasan.

Quoted 14 lines
---
 scripts/Makefile.kasan | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.kasan +1 -0
index 631619b..3f874d2 100644
@@ -13,12 +13,16 @@ CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
 		--param asan-instrumentation-with-call-threshold=$(call_threshold))
 
 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
+   ifneq ($(CONFIG_COMPILE_TEST),y)

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 24

Quoted 10 lines
scripts/Makefile.kasan +4 -2
         $(warning Cannot use CONFIG_KASAN: \
             -fsanitize=kernel-address is not supported by compiler)
+   endif
 else
     ifeq ($(CFLAGS_KASAN),)
-        $(warning CONFIG_KASAN: compiler does not support all options.\
-            Trying minimal configuration)
+        ifneq ($(CONFIG_COMPILE_TEST),y)
+            $(warning CONFIG_KASAN: compiler does not support all options.\
+                Trying minimal configuration)

(Side note: in this case the compiler supports that minimal configuration, doesn't it? So shouldn't the second warning end in
Running with minimal configuration)

or something to that effect?)

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 28

Quoted 4 lines
scripts/Makefile.kasan +1 -0
+        endif
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif

Thanks,

Paul Bolle

#3 lore raw
Quoted 10 lines · Paul Bolle
Quoted 5 lines · Andrey Ryabinin

It might be annoying to constantly see this:

scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler

while performing allmodconfig/allyesconfig build tests.

That warning might be seen - once per build - because allmodconfig and allyesconfig enable both CONFIG_KASAN and CONFIG_COMPILE_TEST, right?

It might be seen once per build because all*config enables CONFIG_KASAN. There was no dependency on CONFIG_COMPILE_TEST before this patch.

Quoted 7 lines
Quoted 1 line

Disable this warning if CONFIG_COMPILE_TEST=y.

Do we expect that some people want to enable both KASAN and COMPILE_TEST manually (ie, not as a result of allmodconfig or allyesconfig)? If so, those people might now be in for some head-scratching if their compiler lacks what's apparently needed to run kasan.

I think this shouldn't be a problem.
CONFIG_COMPILE_TEST used for building drivers that cannot be loaded on platform used for compiling these drivers.
So it's unlikely that such kernel will be used for runtime testing.

Quoted 29 lines
Quoted 14 lines
---
 scripts/Makefile.kasan | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.kasan +1 -0
index 631619b..3f874d2 100644
@@ -13,12 +13,16 @@ CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
 		--param asan-instrumentation-with-call-threshold=$(call_threshold))
 
 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
+   ifneq ($(CONFIG_COMPILE_TEST),y)

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 24

Quoted 10 lines
scripts/Makefile.kasan +4 -2
         $(warning Cannot use CONFIG_KASAN: \
             -fsanitize=kernel-address is not supported by compiler)
+   endif
 else
     ifeq ($(CFLAGS_KASAN),)
-        $(warning CONFIG_KASAN: compiler does not support all options.\
-            Trying minimal configuration)
+        ifneq ($(CONFIG_COMPILE_TEST),y)
+            $(warning CONFIG_KASAN: compiler does not support all options.\
+                Trying minimal configuration)

(Side note: in this case the compiler supports that minimal configuration, doesn't it? So shouldn't the second warning end in
Running with minimal configuration)

Quoted 2 lines

or something to that effect?)

It should and it does.
CFLAGS_KASAN reassigned to minimal set of options below.

Quoted 11 lines

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 28

Quoted 4 lines
scripts/Makefile.kasan +1 -0
+        endif
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif

Thanks,

Paul Bolle

#4 lore raw
Quoted 6 lines · Andrey Ryabinin
Quoted 5 lines · Paul Bolle
Quoted 4 lines · Andrey Ryabinin

It might be annoying to constantly see this:

scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

while performing allmodconfig/allyesconfig build tests.

That warning might be seen - once per build - because allmodconfig and allyesconfig enable both CONFIG_KASAN and CONFIG_COMPILE_TEST, right?

It might be seen once per build because all*config enables CONFIG_KASAN. There was no dependency on CONFIG_COMPILE_TEST before this patch.

Yes, of course.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Disable this warning if CONFIG_COMPILE_TEST=y.

Do we expect that some people want to enable both KASAN and COMPILE_TEST manually (ie, not as a result of allmodconfig or allyesconfig)? If so, those people might now be in for some head-scratching if their compiler lacks what's apparently needed to run kasan.

Quoted 4 lines

I think this shouldn't be a problem.
CONFIG_COMPILE_TEST used for building drivers that cannot be loaded on platform used for compiling these drivers.
So it's unlikely that such kernel will be used for runtime testing.

It would be nice if there would at least be a comment explaining what's being done here (ie, assuming that if CONFIG_COMPILE_TEST equals 'y' we're doing a allmodconfig or an allyesconfig and that people using either of those make targets don't care whether their compiler supports kasan). Because I'd be surprised if people figure that out by looking at this Makefile.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
---
 scripts/Makefile.kasan | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.kasan +1 -0
index 631619b..3f874d2 100644
@@ -13,12 +13,16 @@ CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
 		--param asan-instrumentation-with-call-threshold=$(call_threshold))
 
 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
+   ifneq ($(CONFIG_COMPILE_TEST),y)

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 24

Quoted 10 lines
scripts/Makefile.kasan +4 -2
         $(warning Cannot use CONFIG_KASAN: \
             -fsanitize=kernel-address is not supported by compiler)
+   endif
 else
     ifeq ($(CFLAGS_KASAN),)
-        $(warning CONFIG_KASAN: compiler does not support all options.\
-            Trying minimal configuration)
+        ifneq ($(CONFIG_COMPILE_TEST),y)
+            $(warning CONFIG_KASAN: compiler does not support all options.\
+                Trying minimal configuration)

(Side note: in this case the compiler supports that minimal configuration, doesn't it? So shouldn't the second warning end in
Running with minimal configuration)

Quoted 5 lines
Quoted 2 lines

or something to that effect?)

It should and it does.
CFLAGS_KASAN reassigned to minimal set of options below.

Which makes "Trying" ambiguous, but anyway, it's just a side note.

Quoted 4 lines
Quoted 4 lines

scripts/Makefile.kasan CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ · line 28

Quoted 4 lines
scripts/Makefile.kasan +1 -0
+        endif
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif

Thanks,

Paul Bolle