path: root/mm/page_alloc.c
diff options
authorAndrey Konovalov <>2021-04-29 22:59:49 -0700
committerLinus Torvalds <>2021-04-30 11:20:41 -0700
commita064cb00d359bc464df6fd2ab6dfb8dc4b31e361 (patch)
tree34223973f338521d23f318e253ec96690d70b7cc /mm/page_alloc.c
parentbfcfe37136d718f5f5846f51df9ff22d13752a5b (diff)
kasan: initialize shadow to TAG_INVALID for SW_TAGS
Currently, KASAN_SW_TAGS uses 0xFF as the default tag value for unallocated memory. The underlying idea is that since that memory hasn't been allocated yet, it's only supposed to be dereferenced through a pointer with the native 0xFF tag. While this is a good idea in terms on consistency, practically it doesn't bring any benefit. Since the 0xFF pointer tag is a match-all tag, it doesn't matter what tag the accessed memory has. No accesses through 0xFF-tagged pointers are considered buggy by KASAN. This patch changes the default tag value for unallocated memory to 0xFE, which is the tag KASAN uses for inaccessible memory. This doesn't affect accesses through 0xFF-tagged pointer to this memory, but this allows KASAN to detect wild and large out-of-bounds invalid memory accesses through otherwise-tagged pointers. This is a prepatory patch for the next one, which changes the tag-based KASAN modes to not poison the boot memory. Link: Signed-off-by: Andrey Konovalov <> Cc: Alexander Potapenko <> Cc: Andrey Ryabinin <> Cc: Branislav Rankov <> Cc: Catalin Marinas <> Cc: Christoph Hellwig <> Cc: Dmitry Vyukov <> Cc: Evgenii Stepanov <> Cc: Kevin Brodsky <> Cc: Marco Elver <> Cc: Peter Collingbourne <> Cc: Vincenzo Frascino <> Cc: Will Deacon <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/page_alloc.c')
0 files changed, 0 insertions, 0 deletions