kasan: allow enabling KASAN_VMALLOC and SW/HW_TAGS
authorAndrey Konovalov <andreyknvl@google.com>
Fri, 25 Mar 2022 01:11:50 +0000 (18:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Mar 2022 02:06:48 +0000 (19:06 -0700)
Allow enabling CONFIG_KASAN_VMALLOC with SW_TAGS and HW_TAGS KASAN modes.

Also adjust CONFIG_KASAN_VMALLOC description:

 - Mention HW_TAGS support.

 - Remove unneeded internal details: they have no place in Kconfig
   description and are already explained in the documentation.

Link: https://lkml.kernel.org/r/bfa0fdedfe25f65e5caa4e410f074ddbac7a0b59.1643047180.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/Kconfig.kasan

index 879757b..1f3e620 100644 (file)
@@ -178,17 +178,17 @@ config KASAN_TAGS_IDENTIFY
          memory consumption.
 
 config KASAN_VMALLOC
-       bool "Back mappings in vmalloc space with real shadow memory"
-       depends on KASAN_GENERIC && HAVE_ARCH_KASAN_VMALLOC
+       bool "Check accesses to vmalloc allocations"
+       depends on HAVE_ARCH_KASAN_VMALLOC
        help
-         By default, the shadow region for vmalloc space is the read-only
-         zero page. This means that KASAN cannot detect errors involving
-         vmalloc space.
-
-         Enabling this option will hook in to vmap/vmalloc and back those
-         mappings with real shadow memory allocated on demand. This allows
-         for KASAN to detect more sorts of errors (and to support vmapped
-         stacks), but at the cost of higher memory usage.
+         This mode makes KASAN check accesses to vmalloc allocations for
+         validity.
+
+         With software KASAN modes, checking is done for all types of vmalloc
+         allocations. Enabling this option leads to higher memory usage.
+
+         With hardware tag-based KASAN, only VM_ALLOC mappings are checked.
+         There is no additional memory usage.
 
 config KASAN_KUNIT_TEST
        tristate "KUnit-compatible tests of KASAN bug detection capabilities" if !KUNIT_ALL_TESTS