kasan: allow enabling KASAN_VMALLOC and SW/HW_TAGS

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>
This commit is contained in:
Andrey Konovalov 2022-03-24 18:11:50 -07:00 committed by Linus Torvalds
parent 551b2bcb7e
commit fbefb423f8

View File

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