kasan: test fix: warn if the UAF could not be detected in kmalloc_uaf2
authorAlexander Potapenko <glider@google.com>
Fri, 25 Mar 2016 21:22:11 +0000 (14:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Mar 2016 23:37:42 +0000 (16:37 -0700)
Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrey Konovalov <adech.fo@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Konstantin Serebryany <kcc@google.com>
Cc: Dmitry Chernenkov <dmitryc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/test_kasan.c

index 90ad74f715355ee485ea8aba773f4209adb4fae5..82169fbf24538fdc70ff98fce1f324cb13f241da 100644 (file)
@@ -294,6 +294,8 @@ static noinline void __init kmalloc_uaf2(void)
        }
 
        ptr1[40] = 'x';
+       if (ptr1 == ptr2)
+               pr_err("Could not detect use-after-free: ptr1 == ptr2\n");
        kfree(ptr2);
 }