The patch titled Subject: kasan, arm64: enable top byte ignore for the kernel has been added to the -mm tree. Its filename is kasan-arm64-enable-top-byte-ignore-for-the-kernel.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-arm64-enable-top-byte-ignore-for-the-kernel.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-arm64-enable-top-byte-ignore-for-the-kernel.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Subject: kasan, arm64: enable top byte ignore for the kernel Tag-based KASAN uses the Top Byte Ignore feature of arm64 CPUs to store a pointer tag in the top byte of each pointer. This commit enables the TCR_TBI1 bit, which enables Top Byte Ignore for the kernel, when tag-based KASAN is used. Link: http://lkml.kernel.org/r/1ed03d53ee679cba52ba7118d2acbef948d21fcc.1543337629.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Reviewed-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/arch/arm64/include/asm/pgtable-hwdef.h~kasan-arm64-enable-top-byte-ignore-for-the-kernel +++ a/arch/arm64/include/asm/pgtable-hwdef.h @@ -291,6 +291,7 @@ #define TCR_A1 (UL(1) << 22) #define TCR_ASID16 (UL(1) << 36) #define TCR_TBI0 (UL(1) << 37) +#define TCR_TBI1 (UL(1) << 38) #define TCR_HA (UL(1) << 39) #define TCR_HD (UL(1) << 40) #define TCR_NFD1 (UL(1) << 54) --- a/arch/arm64/mm/proc.S~kasan-arm64-enable-top-byte-ignore-for-the-kernel +++ a/arch/arm64/mm/proc.S @@ -47,6 +47,12 @@ /* PTWs cacheable, inner/outer WBWA */ #define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA +#ifdef CONFIG_KASAN_SW_TAGS +#define TCR_KASAN_FLAGS TCR_TBI1 +#else +#define TCR_KASAN_FLAGS 0 +#endif + #define MAIR(attr, mt) ((attr) << ((mt) * 8)) /* @@ -445,7 +451,7 @@ ENTRY(__cpu_setup) */ ldr x10, =TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ TCR_TG_FLAGS | TCR_KASLR_FLAGS | TCR_ASID16 | \ - TCR_TBI0 | TCR_A1 + TCR_TBI0 | TCR_A1 | TCR_KASAN_FLAGS tcr_set_idmap_t0sz x10, x9 /* _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-mm-change-hooks-signatures.patch kasan-slub-handle-pointer-tags-in-early_kmem_cache_node_alloc.patch kasan-move-common-generic-and-tag-based-code-to-commonc.patch kasan-rename-source-files-to-reflect-the-new-naming-scheme.patch kasan-add-config_kasan_generic-and-config_kasan_sw_tags.patch kasan-arm64-adjust-shadow-size-for-tag-based-mode.patch kasan-rename-kasan_zero_page-to-kasan_early_shadow_page.patch kasan-initialize-shadow-to-0xff-for-tag-based-mode.patch arm64-move-untagged_addr-macro-from-uaccessh-to-memoryh.patch kasan-add-tag-related-helper-functions.patch kasan-arm64-untag-address-in-_virt_addr_is_linear.patch kasan-preassign-tags-to-objects-with-ctors-or-slab_typesafe_by_rcu.patch kasan-arm64-fix-up-fault-handling-logic.patch kasan-arm64-enable-top-byte-ignore-for-the-kernel.patch kasan-mm-perform-untagged-pointers-comparison-in-krealloc.patch kasan-split-out-generic_reportc-from-reportc.patch kasan-add-bug-reporting-routines-for-tag-based-mode.patch mm-move-obj_to_index-to-include-linux-slab_defh.patch kasan-add-hooks-implementation-for-tag-based-mode.patch kasan-arm64-add-brk-handler-for-inline-instrumentation.patch kasan-mm-arm64-tag-non-slab-memory-allocated-via-pagealloc.patch kasan-add-__must_check-annotations-to-kasan-hooks.patch kasan-arm64-select-have_arch_kasan_sw_tags.patch kasan-update-documentation.patch kasan-add-spdx-license-identifier-mark-to-source-files.patch