Re: [PATCH v6 11/18] x86/kasan: KASAN raw shadow memory PTE init
From: Alexander Potapenko <glider@google.com>
Date: 2025-11-11 09:11:52
Also in:
linux-doc, linux-kbuild, linux-mm, lkml
From: Alexander Potapenko <glider@google.com>
Date: 2025-11-11 09:11:52
Also in:
linux-doc, linux-kbuild, linux-mm, lkml
On Wed, Oct 29, 2025 at 9:07 PM Maciej Wieczor-Retman [off-list ref] wrote:
From: Maciej Wieczor-Retman <redacted> In KASAN's generic mode the default value in shadow memory is zero. During initialization of shadow memory pages they are allocated and zeroed. In KASAN's tag-based mode the default tag for the arm64 architecture is 0xFE which corresponds to any memory that should not be accessed. On x86 (where tags are 4-bit wide instead of 8-bit wide) that tag is 0xE so during the initializations all the bytes in shadow memory pages should be filled with it. Use memblock_alloc_try_nid_raw() instead of memblock_alloc_try_nid() to avoid zeroing out the memory so it can be set with the KASAN invalid tag. Signed-off-by: Maciej Wieczor-Retman <redacted>
Reviewed-by: Alexander Potapenko <glider@google.com>