(Backport: conflicts due to adjacent lines changed; add pgtable.h include to arch/arm64/include/asm/vmalloc.h.) HW_TAGS KASAN relies on ARM Memory Tagging Extension (MTE). With MTE, a memory region must be mapped as MT_NORMAL_TAGGED to allow setting memory tags via MTE-specific instructions. Add proper protection bits to vmalloc() allocations. These allocations are always backed by page_alloc pages, so the tags will actually be getting set on the corresponding physical memory. Link: https://lkml.kernel.org/r/983fc33542db2f6b1e77b34ca23448d4640bbb9e.1643047180.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Co-developed-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.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: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> (cherry picked from commit df70c9aebdba46948cf5af35a82c23a8e8376797 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm) Bug: 217222520 Change-Id: I1ea6aa7cfa907a75fa1b8cab3d33538f89fe0fca Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
36 lines
871 B
C
36 lines
871 B
C
#ifndef _ASM_ARM64_VMALLOC_H
|
|
#define _ASM_ARM64_VMALLOC_H
|
|
|
|
#include <asm/page.h>
|
|
#include <asm/pgtable.h>
|
|
|
|
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
|
|
|
|
#define arch_vmap_pud_supported arch_vmap_pud_supported
|
|
static inline bool arch_vmap_pud_supported(pgprot_t prot)
|
|
{
|
|
/*
|
|
* Only 4k granule supports level 1 block mappings.
|
|
* SW table walks can't handle removal of intermediate entries.
|
|
*/
|
|
return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
|
|
!IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
|
|
}
|
|
|
|
#define arch_vmap_pmd_supported arch_vmap_pmd_supported
|
|
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
|
|
{
|
|
/* See arch_vmap_pud_supported() */
|
|
return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
|
|
}
|
|
|
|
#endif
|
|
|
|
#define arch_vmap_pgprot_tagged arch_vmap_pgprot_tagged
|
|
static inline pgprot_t arch_vmap_pgprot_tagged(pgprot_t prot)
|
|
{
|
|
return pgprot_tagged(prot);
|
|
}
|
|
|
|
#endif /* _ASM_ARM64_VMALLOC_H */
|