aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_kasan.c
diff options
context:
space:
mode:
authorAndrey Ryabinin <aryabinin@virtuozzo.com>2019-03-05 18:41:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 00:07:13 -0500
commit7771bdbbfd3d6f204631b6fd9e1bbc30cd15918e (patch)
tree1f715a5317669f6473d1d4ddb4f5bf761e918e71 /lib/test_kasan.c
parent46612b751c4941c5c0472ddf04027e877ae5990f (diff)
kasan: remove use after scope bugs detection.
Use after scope bugs detector seems to be almost entirely useless for the linux kernel. It exists over two years, but I've seen only one valid bug so far [1]. And the bug was fixed before it has been reported. There were some other use-after-scope reports, but they were false-positives due to different reasons like incompatibility with structleak plugin. This feature significantly increases stack usage, especially with GCC < 9 version, and causes a 32K stack overflow. It probably adds performance penalty too. Given all that, let's remove use-after-scope detector entirely. While preparing this patch I've noticed that we mistakenly enable use-after-scope detection for clang compiler regardless of CONFIG_KASAN_EXTRA setting. This is also fixed now. [1] http://lkml.kernel.org/r/<20171129052106.rhgbjhhis53hkgfn@wfg-t540p.sh.intel.com> Link: http://lkml.kernel.org/r/20190111185842.13978-1-aryabinin@virtuozzo.com Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Acked-by: Will Deacon <will.deacon@arm.com> [arm64] Cc: Qian Cai <cai@lca.pw> Cc: Alexander Potapenko <glider@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/test_kasan.c')
-rw-r--r--lib/test_kasan.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index 51b78405bf24..7de2702621dc 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -480,29 +480,6 @@ static noinline void __init copy_user_test(void)
480 kfree(kmem); 480 kfree(kmem);
481} 481}
482 482
483static noinline void __init use_after_scope_test(void)
484{
485 volatile char *volatile p;
486
487 pr_info("use-after-scope on int\n");
488 {
489 int local = 0;
490
491 p = (char *)&local;
492 }
493 p[0] = 1;
494 p[3] = 1;
495
496 pr_info("use-after-scope on array\n");
497 {
498 char local[1024] = {0};
499
500 p = local;
501 }
502 p[0] = 1;
503 p[1023] = 1;
504}
505
506static noinline void __init kasan_alloca_oob_left(void) 483static noinline void __init kasan_alloca_oob_left(void)
507{ 484{
508 volatile int i = 10; 485 volatile int i = 10;
@@ -682,7 +659,6 @@ static int __init kmalloc_tests_init(void)
682 kasan_alloca_oob_right(); 659 kasan_alloca_oob_right();
683 ksize_unpoisons_memory(); 660 ksize_unpoisons_memory();
684 copy_user_test(); 661 copy_user_test();
685 use_after_scope_test();
686 kmem_cache_double_free(); 662 kmem_cache_double_free();
687 kmem_cache_invalid_free(); 663 kmem_cache_invalid_free();
688 kasan_memchr(); 664 kasan_memchr();