Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kasan: always taint kernel on report

Currently we already taint the kernel in some cases. E.g. if we hit some
bug in slub memory we call object_err() which will taint the kernel with
TAINT_BAD_PAGE flag. But for other kind of bugs kernel left untainted.

Always taint with TAINT_BAD_PAGE if kasan found some bug. This is useful
for automated testing.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrey Ryabinin and committed by
Linus Torvalds
eb06f43f 89d3c87e

+1
+1
mm/kasan/report.c
··· 238 238 } 239 239 pr_err("=================================" 240 240 "=================================\n"); 241 + add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); 241 242 spin_unlock_irqrestore(&report_lock, flags); 242 243 kasan_enable_current(); 243 244 }