[PATCH] kasan: disable stackleak plugin in report code

Josh Poimboeuf posted 1 patch 3 years, 5 months ago
mm/kasan/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] kasan: disable stackleak plugin in report code
Posted by Josh Poimboeuf 3 years, 5 months ago
kasan_report() has a uaccess critical section which can't have any
instrumentation calls in the middle.  Disable the stackleak plugin for
the report code.

Fixes the following warning:

  vmlinux.o: warning: objtool: kasan_report+0x12: call to stackleak_track_stack() with UACCESS enabled

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 mm/kasan/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
index d4837bff3b60..da2976365197 100644
--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -27,7 +27,7 @@ CFLAGS_common.o := $(CC_FLAGS_KASAN_RUNTIME)
 CFLAGS_generic.o := $(CC_FLAGS_KASAN_RUNTIME)
 CFLAGS_init.o := $(CC_FLAGS_KASAN_RUNTIME)
 CFLAGS_quarantine.o := $(CC_FLAGS_KASAN_RUNTIME)
-CFLAGS_report.o := $(CC_FLAGS_KASAN_RUNTIME)
+CFLAGS_report.o := $(CC_FLAGS_KASAN_RUNTIME) $(DISABLE_STACKLEAK_PLUGIN)
 CFLAGS_report_generic.o := $(CC_FLAGS_KASAN_RUNTIME)
 CFLAGS_report_hw_tags.o := $(CC_FLAGS_KASAN_RUNTIME)
 CFLAGS_report_sw_tags.o := $(CC_FLAGS_KASAN_RUNTIME)
-- 
2.37.3
Re: [PATCH] kasan: disable stackleak plugin in report code
Posted by Linus Torvalds 3 years, 5 months ago
On Tue, Oct 11, 2022 at 12:05 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> kasan_report() has a uaccess critical section which can't have any
> instrumentation calls in the middle.  Disable the stackleak plugin for
> the report code.

I see Andrew already picked this up, but I can confirm that it
obviously fixes the problem here for me.

I'll get it the usual channels from Andrew.

Thanks,
            Linus