From: Catalin Marinas Date: Thu, 15 Apr 2021 13:00:47 +0000 (+0100) Subject: Merge branch 'for-next/mte-async-kernel-mode' into for-next/core X-Git-Tag: accepted/tizen/unified/20230118.172025~7258^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=604df13d7aadae6902d3b7f03a35bb21d887f0cf;p=platform%2Fkernel%2Flinux-rpi.git Merge branch 'for-next/mte-async-kernel-mode' into for-next/core * for-next/mte-async-kernel-mode: : Add MTE asynchronous kernel mode support kasan, arm64: tests supports for HW_TAGS async mode arm64: mte: Report async tag faults before suspend arm64: mte: Enable async tag check fault arm64: mte: Conditionally compile mte_enable_kernel_*() arm64: mte: Enable TCO in functions that can read beyond buffer limits kasan: Add report for async mode arm64: mte: Drop arch_enable_tagging() kasan: Add KASAN mode kernel parameter arm64: mte: Add asynchronous mode support --- 604df13d7aadae6902d3b7f03a35bb21d887f0cf diff --cc arch/arm64/include/asm/mte.h index 3872795,a38abc1..51006e0 --- a/arch/arm64/include/asm/mte.h +++ b/arch/arm64/include/asm/mte.h @@@ -82,7 -88,55 +86,51 @@@ static inline int mte_ptrace_copy_tags( return -EIO; } -static inline void mte_assign_mem_tag_range(void *addr, size_t size) -{ -} - #endif /* CONFIG_ARM64_MTE */ + #ifdef CONFIG_KASAN_HW_TAGS + /* Whether the MTE asynchronous mode is enabled. */ + DECLARE_STATIC_KEY_FALSE(mte_async_mode); + + static inline bool system_uses_mte_async_mode(void) + { + return static_branch_unlikely(&mte_async_mode); + } + + void mte_check_tfsr_el1(void); + + static inline void mte_check_tfsr_entry(void) + { + mte_check_tfsr_el1(); + } + + static inline void mte_check_tfsr_exit(void) + { + /* + * The asynchronous faults are sync'ed automatically with + * TFSR_EL1 on kernel entry but for exit an explicit dsb() + * is required. + */ + dsb(nsh); + isb(); + + mte_check_tfsr_el1(); + } + #else + static inline bool system_uses_mte_async_mode(void) + { + return false; + } + static inline void mte_check_tfsr_el1(void) + { + } + static inline void mte_check_tfsr_entry(void) + { + } + static inline void mte_check_tfsr_exit(void) + { + } + #endif /* CONFIG_KASAN_HW_TAGS */ + #endif /* __ASSEMBLY__ */ #endif /* __ASM_MTE_H */