linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support
@ 2021-01-21 16:39 Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 1/6] arm64: mte: Add asynchronous " Vincenzo Frascino
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

This patchset implements the asynchronous mode support for ARMv8.5-A
Memory Tagging Extension (MTE), which is a debugging feature that allows
to detect with the help of the architecture the C and C++ programmatic
memory errors like buffer overflow, use-after-free, use-after-return, etc.

MTE is built on top of the AArch64 v8.0 virtual address tagging TBI
(Top Byte Ignore) feature and allows a task to set a 4 bit tag on any
subset of its address space that is multiple of a 16 bytes granule. MTE
is based on a lock-key mechanism where the lock is the tag associated to
the physical memory and the key is the tag associated to the virtual
address.
When MTE is enabled and tags are set for ranges of address space of a task,
the PE will compare the tag related to the physical memory with the tag
related to the virtual address (tag check operation). Access to the memory
is granted only if the two tags match. In case of mismatch the PE will raise
an exception.

The exception can be handled synchronously or asynchronously. When the
asynchronous mode is enabled:
  - Upon fault the PE updates the TFSR_EL1 register.
  - The kernel detects the change during one of the following:
    - Context switching
    - Return to user/EL0
    - Kernel entry from EL1
    - Kernel exit to EL1
  - If the register has been updated by the PE the kernel clears it and
    reports the error.

The series is based on linux-next/akpm.

To simplify the testing a tree with the new patches on top has been made
available at [1].

[1] https://git.gitlab.arm.com/linux-arm/linux-vf.git mte/v10.async.akpm

Changes:
--------
v5:
  - Rebase the series on linux-next/akpm.
  - Forbid execution for KASAN KUNIT tests when async
    mode is enabled.
  - Dropped patch to inline mte_assign_mem_tag_range().
  - Address review comments.
v4:
  - Added support for kasan.mode (sync/async) kernel
    command line parameter.
  - Addressed review comments.
v3:
  - Exposed kasan_hw_tags_mode to convert the internal
    KASAN represenetation.
  - Added dsb() for kernel exit paths in arm64.
  - Addressed review comments.
v2:
  - Fixed a compilation issue reported by krobot.
  - General cleanup.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Branislav Rankov <Branislav.Rankov@arm.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Vincenzo Frascino (6):
  arm64: mte: Add asynchronous mode support
  kasan: Add KASAN mode kernel parameter
  kasan: Add report for async mode
  arm64: mte: Enable async tag check fault
  arm64: mte: Expose execution mode
  kasan: Forbid kunit tests when async mode is enabled

 Documentation/dev-tools/kasan.rst  |  7 +++
 arch/arm64/include/asm/memory.h    |  4 +-
 arch/arm64/include/asm/mte-kasan.h | 15 ++++++-
 arch/arm64/include/asm/mte.h       | 32 ++++++++++++++
 arch/arm64/kernel/entry-common.c   |  6 +++
 arch/arm64/kernel/mte.c            | 68 +++++++++++++++++++++++++++++-
 include/linux/kasan.h              |  2 +
 lib/test_kasan.c                   |  7 ++-
 mm/kasan/hw_tags.c                 | 27 +++++++++++-
 mm/kasan/kasan.h                   |  8 +++-
 mm/kasan/report.c                  | 11 +++++
 11 files changed, 178 insertions(+), 9 deletions(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v5 1/6] arm64: mte: Add asynchronous mode support
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter Vincenzo Frascino
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

MTE provides an asynchronous mode for detecting tag exceptions. In
particular instead of triggering a fault the arm64 core updates a
register which is checked by the kernel after the asynchronous tag
check fault has occurred.

Add support for MTE asynchronous mode.

The exception handling mechanism will be added with a future patch.

Note: KASAN HW activates async mode via kasan.mode kernel parameter.
The default mode is set to synchronous.
The code that verifies the status of TFSR_EL1 will be added with a
future patch.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/memory.h    |  3 ++-
 arch/arm64/include/asm/mte-kasan.h |  9 +++++++--
 arch/arm64/kernel/mte.c            | 16 ++++++++++++++--
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index cedfc9e97bcc..df96b9c10b81 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -231,7 +231,8 @@ static inline const void *__tag_set(const void *addr, u8 tag)
 }
 
 #ifdef CONFIG_KASAN_HW_TAGS
-#define arch_enable_tagging()			mte_enable_kernel()
+#define arch_enable_tagging_sync()		mte_enable_kernel_sync()
+#define arch_enable_tagging_async()		mte_enable_kernel_async()
 #define arch_set_tagging_report_once(state)	mte_set_report_once(state)
 #define arch_init_tags(max_tag)			mte_init_tags(max_tag)
 #define arch_get_random_tag()			mte_get_random_tag()
diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mte-kasan.h
index 3748d5bb88c0..76b6a5988ce5 100644
--- a/arch/arm64/include/asm/mte-kasan.h
+++ b/arch/arm64/include/asm/mte-kasan.h
@@ -29,7 +29,8 @@ u8 mte_get_mem_tag(void *addr);
 u8 mte_get_random_tag(void);
 void *mte_set_mem_tag_range(void *addr, size_t size, u8 tag);
 
-void mte_enable_kernel(void);
+void mte_enable_kernel_sync(void);
+void mte_enable_kernel_async(void);
 void mte_init_tags(u64 max_tag);
 
 void mte_set_report_once(bool state);
@@ -55,7 +56,11 @@ static inline void *mte_set_mem_tag_range(void *addr, size_t size, u8 tag)
 	return addr;
 }
 
-static inline void mte_enable_kernel(void)
+static inline void mte_enable_kernel_sync(void)
+{
+}
+
+static inline void mte_enable_kernel_sync(void)
 {
 }
 
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index c63b3d7a3cd9..92078e1eb627 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -153,11 +153,23 @@ void mte_init_tags(u64 max_tag)
 	write_sysreg_s(SYS_GCR_EL1_RRND | gcr_kernel_excl, SYS_GCR_EL1);
 }
 
-void mte_enable_kernel(void)
+static inline void __mte_enable_kernel(const char *mode, unsigned long tcf)
 {
 	/* Enable MTE Sync Mode for EL1. */
-	sysreg_clear_set(sctlr_el1, SCTLR_ELx_TCF_MASK, SCTLR_ELx_TCF_SYNC);
+	sysreg_clear_set(sctlr_el1, SCTLR_ELx_TCF_MASK, tcf);
 	isb();
+
+	pr_info_once("MTE: enabled in %s mode at EL1\n", mode);
+}
+
+void mte_enable_kernel_sync(void)
+{
+	__mte_enable_kernel("synchronous", SCTLR_ELx_TCF_SYNC);
+}
+
+void mte_enable_kernel_async(void)
+{
+	__mte_enable_kernel("asynchronous", SCTLR_ELx_TCF_ASYNC);
 }
 
 void mte_set_report_once(bool state)
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 1/6] arm64: mte: Add asynchronous " Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 17:34   ` Andrey Konovalov
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

Architectures supported by KASAN_HW_TAGS can provide a sync or async mode
of execution. On an MTE enabled arm64 hw for example this can be identified
with the synchronous or asynchronous tagging mode of execution.
In synchronous mode, an exception is triggered if a tag check fault occurs.
In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register is
updated asynchronously. The kernel checks the corresponding bits
periodically.

KASAN requires a specific kernel command line parameter to make use of this
hw features.

Add KASAN HW execution mode kernel command line parameter.

Note: This patch adds the kasan.mode kernel parameter and the
sync/async kernel command line options to enable the described features.

Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 Documentation/dev-tools/kasan.rst |  7 +++++++
 lib/test_kasan.c                  |  2 +-
 mm/kasan/hw_tags.c                | 27 ++++++++++++++++++++++++++-
 mm/kasan/kasan.h                  |  6 ++++--
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index e022b7506e37..7e4a6e0c9f57 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst
@@ -161,6 +161,13 @@ particular KASAN features.
 
 - ``kasan=off`` or ``=on`` controls whether KASAN is enabled (default: ``on``).
 
+- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in
+  synchronous or asynchronous mode of execution (default: ``sync``).
+  ``synchronous mode``: an exception is triggered if a tag check fault occurs.
+  ``asynchronous mode``: if a tag check fault occurs, the information is stored
+  asynchronously in hardware (e.g. in the TFSR_EL1 register for arm64). The kernel
+  checks the hardware location and reports an error if the fault is detected.
+
 - ``kasan.stacktrace=off`` or ``=on`` disables or enables alloc and free stack
   traces collection (default: ``on`` for ``CONFIG_DEBUG_KERNEL=y``, otherwise
   ``off``).
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index d16ec9e66806..7285dcf9fcc1 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -97,7 +97,7 @@ static void kasan_test_exit(struct kunit *test)
 			READ_ONCE(fail_data.report_found));	\
 	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS)) {			\
 		if (READ_ONCE(fail_data.report_found))		\
-			hw_enable_tagging();			\
+			hw_enable_tagging_sync();		\
 		migrate_enable();				\
 	}							\
 } while (0)
diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
index e529428e7a11..224a2187839c 100644
--- a/mm/kasan/hw_tags.c
+++ b/mm/kasan/hw_tags.c
@@ -25,6 +25,11 @@ enum kasan_arg {
 	KASAN_ARG_ON,
 };
 
+enum kasan_arg_mode {
+	KASAN_ARG_MODE_SYNC,
+	KASAN_ARG_MODE_ASYNC,
+};
+
 enum kasan_arg_stacktrace {
 	KASAN_ARG_STACKTRACE_DEFAULT,
 	KASAN_ARG_STACKTRACE_OFF,
@@ -38,6 +43,7 @@ enum kasan_arg_fault {
 };
 
 static enum kasan_arg kasan_arg __ro_after_init;
+static enum kasan_arg_mode kasan_arg_mode __ro_after_init;
 static enum kasan_arg_stacktrace kasan_arg_stacktrace __ro_after_init;
 static enum kasan_arg_fault kasan_arg_fault __ro_after_init;
 
@@ -68,6 +74,21 @@ static int __init early_kasan_flag(char *arg)
 }
 early_param("kasan", early_kasan_flag);
 
+/* kasan.mode=sync/async */
+static int __init early_kasan_mode(char *arg)
+{
+	/* If arg is not set the default mode is sync */
+	if ((!arg) || !strcmp(arg, "sync"))
+		kasan_arg_mode = KASAN_ARG_MODE_SYNC;
+	else if (!strcmp(arg, "async"))
+		kasan_arg_mode = KASAN_ARG_MODE_ASYNC;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+early_param("kasan.mode", early_kasan_mode);
+
 /* kasan.stacktrace=off/on */
 static int __init early_kasan_flag_stacktrace(char *arg)
 {
@@ -115,7 +136,11 @@ void kasan_init_hw_tags_cpu(void)
 		return;
 
 	hw_init_tags(KASAN_TAG_MAX);
-	hw_enable_tagging();
+
+	if (kasan_arg_mode == KASAN_ARG_MODE_ASYNC)
+		hw_enable_tagging_async();
+	else
+		hw_enable_tagging_sync();
 }
 
 /* kasan_init_hw_tags() is called once on boot CPU. */
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index 07ef7fc742ad..3923d9744105 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -294,7 +294,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
 #define arch_set_mem_tag_range(addr, size, tag) ((void *)(addr))
 #endif
 
-#define hw_enable_tagging()			arch_enable_tagging()
+#define hw_enable_tagging_sync()		arch_enable_tagging_sync()
+#define hw_enable_tagging_async()		arch_enable_tagging_async()
 #define hw_init_tags(max_tag)			arch_init_tags(max_tag)
 #define hw_set_tagging_report_once(state)	arch_set_tagging_report_once(state)
 #define hw_get_random_tag()			arch_get_random_tag()
@@ -303,7 +304,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
 
 #else /* CONFIG_KASAN_HW_TAGS */
 
-#define hw_enable_tagging()
+#define hw_enable_tagging_sync()
+#define hw_enable_tagging_async()
 #define hw_set_tagging_report_once(state)
 
 #endif /* CONFIG_KASAN_HW_TAGS */
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 1/6] arm64: mte: Add asynchronous " Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 17:36   ` Andrey Konovalov
                     ` (3 more replies)
  2021-01-21 16:39 ` [PATCH v5 4/6] arm64: mte: Enable async tag check fault Vincenzo Frascino
                   ` (2 subsequent siblings)
  5 siblings, 4 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

KASAN provides an asynchronous mode of execution.

Add reporting functionality for this mode.

Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 include/linux/kasan.h |  2 ++
 mm/kasan/report.c     | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index bb862d1f0e15..b0a1d9dfa85c 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -351,6 +351,8 @@ static inline void *kasan_reset_tag(const void *addr)
 bool kasan_report(unsigned long addr, size_t size,
 		bool is_write, unsigned long ip);
 
+void kasan_report_async(void);
+
 #else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
 
 static inline void *kasan_reset_tag(const void *addr)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 234f35a84f19..2fd6845a95e9 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -358,6 +358,17 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
 	end_report(&flags);
 }
 
+void kasan_report_async(void)
+{
+	unsigned long flags;
+
+	start_report(&flags);
+	pr_err("BUG: KASAN: invalid-access\n");
+	pr_err("Asynchronous mode enabled: no access details available\n");
+	dump_stack();
+	end_report(&flags);
+}
+
 static void __kasan_report(unsigned long addr, size_t size, bool is_write,
 				unsigned long ip)
 {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 4/6] arm64: mte: Enable async tag check fault
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
                   ` (2 preceding siblings ...)
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 17:38   ` Andrey Konovalov
  2021-01-22 11:58   ` Catalin Marinas
  2021-01-21 16:39 ` [PATCH v5 5/6] arm64: mte: Expose execution mode Vincenzo Frascino
  2021-01-21 16:39 ` [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled Vincenzo Frascino
  5 siblings, 2 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

MTE provides a mode that asynchronously updates the TFSR_EL1 register
when a tag check exception is detected.

To take advantage of this mode the kernel has to verify the status of
the register at:
  1. Context switching
  2. Return to user/EL0 (Not required in entry from EL0 since the kernel
  did not run)
  3. Kernel entry from EL1
  4. Kernel exit to EL1

If the register is non-zero a trace is reported.

Add the required features for EL1 detection and reporting.

Note: ITFSB bit is set in the SCTLR_EL1 register hence it guaranties that
the indirect writes to TFSR_EL1 are synchronized at exception entry to
EL1. On the context switch path the synchronization is guarantied by the
dsb() in __switch_to().
The dsb(nsh) in mte_check_tfsr_exit() is provisional pending
confirmation by the architects.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/mte.h     | 32 +++++++++++++++++++++++
 arch/arm64/kernel/entry-common.c |  6 +++++
 arch/arm64/kernel/mte.c          | 44 ++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+)

diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h
index d02aff9f493d..237bb2f7309d 100644
--- a/arch/arm64/include/asm/mte.h
+++ b/arch/arm64/include/asm/mte.h
@@ -92,5 +92,37 @@ static inline void mte_assign_mem_tag_range(void *addr, size_t size)
 
 #endif /* CONFIG_ARM64_MTE */
 
+#ifdef CONFIG_KASAN_HW_TAGS
+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 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  */
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index 5346953e4382..31666511ba67 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -37,6 +37,8 @@ static void noinstr enter_from_kernel_mode(struct pt_regs *regs)
 	lockdep_hardirqs_off(CALLER_ADDR0);
 	rcu_irq_enter_check_tick();
 	trace_hardirqs_off_finish();
+
+	mte_check_tfsr_entry();
 }
 
 /*
@@ -47,6 +49,8 @@ static void noinstr exit_to_kernel_mode(struct pt_regs *regs)
 {
 	lockdep_assert_irqs_disabled();
 
+	mte_check_tfsr_exit();
+
 	if (interrupts_enabled(regs)) {
 		if (regs->exit_rcu) {
 			trace_hardirqs_on_prepare();
@@ -243,6 +247,8 @@ asmlinkage void noinstr enter_from_user_mode(void)
 
 asmlinkage void noinstr exit_to_user_mode(void)
 {
+	mte_check_tfsr_exit();
+
 	trace_hardirqs_on_prepare();
 	lockdep_hardirqs_on_prepare(CALLER_ADDR0);
 	user_enter_irqoff();
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index 92078e1eb627..7763ac1f2917 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -182,6 +182,37 @@ bool mte_report_once(void)
 	return READ_ONCE(report_fault_once);
 }
 
+#ifdef CONFIG_KASAN_HW_TAGS
+void mte_check_tfsr_el1(void)
+{
+	u64 tfsr_el1;
+
+	if (!system_supports_mte())
+		return;
+
+	tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);
+
+	/*
+	 * The kernel should never trigger an asynchronous fault on a
+	 * TTBR0 address, so we should never see TF0 set.
+	 * For futexes we disable checks via PSTATE.TCO.
+	 */
+	WARN_ONCE(tfsr_el1 & SYS_TFSR_EL1_TF0,
+		  "Kernel async tag fault on TTBR0 address");
+
+	if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) {
+		/*
+		 * Note: isb() is not required after this direct write
+		 * because there is no indirect read subsequent to it
+		 * (per ARM DDI 0487F.c table D13-1).
+		 */
+		write_sysreg_s(0, SYS_TFSR_EL1);
+
+		kasan_report_async();
+	}
+}
+#endif
+
 static void update_sctlr_el1_tcf0(u64 tcf0)
 {
 	/* ISB required for the kernel uaccess routines */
@@ -247,6 +278,19 @@ void mte_thread_switch(struct task_struct *next)
 	/* avoid expensive SCTLR_EL1 accesses if no change */
 	if (current->thread.sctlr_tcf0 != next->thread.sctlr_tcf0)
 		update_sctlr_el1_tcf0(next->thread.sctlr_tcf0);
+	else
+		isb();
+
+	/*
+	 * Check if an async tag exception occurred at EL1.
+	 *
+	 * Note: On the context switch path we rely on the dsb() present
+	 * in __switch_to() to guarantee that the indirect writes to TFSR_EL1
+	 * are synchronized before this point.
+	 * isb() above is required for the same reason.
+	 *
+	 */
+	mte_check_tfsr_el1();
 }
 
 void mte_suspend_exit(void)
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 5/6] arm64: mte: Expose execution mode
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
                   ` (3 preceding siblings ...)
  2021-01-21 16:39 ` [PATCH v5 4/6] arm64: mte: Enable async tag check fault Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 17:41   ` Andrey Konovalov
  2021-01-21 16:39 ` [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled Vincenzo Frascino
  5 siblings, 1 reply; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

MTE enabled arm64 HW can be configured in synchronous or asynchronous
tagging mode of execution.
In synchronous mode, an exception is triggered if a tag check fault
occurs.
In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register
is updated asynchronously. The kernel checks the corresponding bits
periodically.

Introduce an API that exposes the mode of execution to the kernel.

Note: This API will be used by KASAN KUNIT tests to forbid the execution
when async mode is enable.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/memory.h    | 1 +
 arch/arm64/include/asm/mte-kasan.h | 6 ++++++
 arch/arm64/kernel/mte.c            | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index df96b9c10b81..1d4eef519fa6 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -233,6 +233,7 @@ static inline const void *__tag_set(const void *addr, u8 tag)
 #ifdef CONFIG_KASAN_HW_TAGS
 #define arch_enable_tagging_sync()		mte_enable_kernel_sync()
 #define arch_enable_tagging_async()		mte_enable_kernel_async()
+#define arch_is_mode_sync()			mte_is_mode_sync()
 #define arch_set_tagging_report_once(state)	mte_set_report_once(state)
 #define arch_init_tags(max_tag)			mte_init_tags(max_tag)
 #define arch_get_random_tag()			mte_get_random_tag()
diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mte-kasan.h
index 76b6a5988ce5..c216160e805c 100644
--- a/arch/arm64/include/asm/mte-kasan.h
+++ b/arch/arm64/include/asm/mte-kasan.h
@@ -31,6 +31,7 @@ void *mte_set_mem_tag_range(void *addr, size_t size, u8 tag);
 
 void mte_enable_kernel_sync(void);
 void mte_enable_kernel_async(void);
+bool mte_is_mode_sync(void);
 void mte_init_tags(u64 max_tag);
 
 void mte_set_report_once(bool state);
@@ -64,6 +65,11 @@ static inline void mte_enable_kernel_sync(void)
 {
 }
 
+static inline bool mte_is_mode_sync(void)
+{
+	return false;
+}
+
 static inline void mte_init_tags(u64 max_tag)
 {
 }
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index 7763ac1f2917..1cc3fc173b97 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -26,6 +26,7 @@
 u64 gcr_kernel_excl __ro_after_init;
 
 static bool report_fault_once = true;
+static bool __mte_mode_sync = true;
 
 static void mte_sync_page_tags(struct page *page, pte_t *ptep, bool check_swap)
 {
@@ -169,9 +170,16 @@ void mte_enable_kernel_sync(void)
 
 void mte_enable_kernel_async(void)
 {
+	__mte_mode_sync = false;
+
 	__mte_enable_kernel("asynchronous", SCTLR_ELx_TCF_ASYNC);
 }
 
+bool mte_is_mode_sync(void)
+{
+	return __mte_mode_sync;
+}
+
 void mte_set_report_once(bool state)
 {
 	WRITE_ONCE(report_fault_once, state);
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled
  2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
                   ` (4 preceding siblings ...)
  2021-01-21 16:39 ` [PATCH v5 5/6] arm64: mte: Expose execution mode Vincenzo Frascino
@ 2021-01-21 16:39 ` Vincenzo Frascino
  2021-01-21 17:40   ` Andrey Konovalov
  2021-01-22  4:04   ` kernel test robot
  5 siblings, 2 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-21 16:39 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, kasan-dev
  Cc: Vincenzo Frascino, Catalin Marinas, Will Deacon, Dmitry Vyukov,
	Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

Architectures supported by KASAN_HW_TAGS can provide a sync or async
mode of execution. KASAN KUNIT tests can be executed only when sync
mode is enabled.

Forbid the execution of the KASAN KUNIT tests when async mode is
enabled.

Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 lib/test_kasan.c | 5 +++++
 mm/kasan/kasan.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index 7285dcf9fcc1..1306f707b4fe 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -52,6 +52,11 @@ static int kasan_test_init(struct kunit *test)
 		return -1;
 	}
 
+	if (!hw_is_mode_sync()) {
+		kunit_err(test, "can't run KASAN tests in async mode");
+		return -1;
+	}
+
 	multishot = kasan_save_enable_multi_shot();
 	hw_set_tagging_report_once(false);
 	return 0;
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index 3923d9744105..3464113042ab 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -296,6 +296,7 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
 
 #define hw_enable_tagging_sync()		arch_enable_tagging_sync()
 #define hw_enable_tagging_async()		arch_enable_tagging_async()
+#define hw_is_mode_sync()			arch_is_mode_sync()
 #define hw_init_tags(max_tag)			arch_init_tags(max_tag)
 #define hw_set_tagging_report_once(state)	arch_set_tagging_report_once(state)
 #define hw_get_random_tag()			arch_get_random_tag()
@@ -306,6 +307,7 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
 
 #define hw_enable_tagging_sync()
 #define hw_enable_tagging_async()
+#define hw_is_mode_sync()
 #define hw_set_tagging_report_once(state)
 
 #endif /* CONFIG_KASAN_HW_TAGS */
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter
  2021-01-21 16:39 ` [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter Vincenzo Frascino
@ 2021-01-21 17:34   ` Andrey Konovalov
  2021-01-22 11:25     ` Vincenzo Frascino
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Konovalov @ 2021-01-21 17:34 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 5:39 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> Architectures supported by KASAN_HW_TAGS can provide a sync or async mode
> of execution. On an MTE enabled arm64 hw for example this can be identified
> with the synchronous or asynchronous tagging mode of execution.
> In synchronous mode, an exception is triggered if a tag check fault occurs.
> In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register is
> updated asynchronously. The kernel checks the corresponding bits
> periodically.
>
> KASAN requires a specific kernel command line parameter to make use of this
> hw features.
>
> Add KASAN HW execution mode kernel command line parameter.
>
> Note: This patch adds the kasan.mode kernel parameter and the
> sync/async kernel command line options to enable the described features.
>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  Documentation/dev-tools/kasan.rst |  7 +++++++
>  lib/test_kasan.c                  |  2 +-
>  mm/kasan/hw_tags.c                | 27 ++++++++++++++++++++++++++-
>  mm/kasan/kasan.h                  |  6 ++++--
>  4 files changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index e022b7506e37..7e4a6e0c9f57 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -161,6 +161,13 @@ particular KASAN features.
>
>  - ``kasan=off`` or ``=on`` controls whether KASAN is enabled (default: ``on``).
>
> +- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in
> +  synchronous or asynchronous mode of execution (default: ``sync``).
> +  ``synchronous mode``: an exception is triggered if a tag check fault occurs.

Synchronous mode: a bad access is detected immediately when a tag
check fault occurs.

(No need for `` here, "synchronous mode" is not an inline snippet.)

> +  ``asynchronous mode``: if a tag check fault occurs, the information is stored
> +  asynchronously in hardware (e.g. in the TFSR_EL1 register for arm64). The kernel
> +  checks the hardware location and reports an error if the fault is detected.

Asynchronous mode: a bad access detection is delayed. When a tag check
fault occurs, the information is stored in hardware (in the TFSR_EL1
register for arm64). The kernel periodically checks the hardware and
only reports tag faults during these checks.

> +
>  - ``kasan.stacktrace=off`` or ``=on`` disables or enables alloc and free stack
>    traces collection (default: ``on`` for ``CONFIG_DEBUG_KERNEL=y``, otherwise
>    ``off``).
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index d16ec9e66806..7285dcf9fcc1 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -97,7 +97,7 @@ static void kasan_test_exit(struct kunit *test)
>                         READ_ONCE(fail_data.report_found));     \
>         if (IS_ENABLED(CONFIG_KASAN_HW_TAGS)) {                 \
>                 if (READ_ONCE(fail_data.report_found))          \
> -                       hw_enable_tagging();                    \
> +                       hw_enable_tagging_sync();               \
>                 migrate_enable();                               \
>         }                                                       \
>  } while (0)
> diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
> index e529428e7a11..224a2187839c 100644
> --- a/mm/kasan/hw_tags.c
> +++ b/mm/kasan/hw_tags.c
> @@ -25,6 +25,11 @@ enum kasan_arg {
>         KASAN_ARG_ON,
>  };
>
> +enum kasan_arg_mode {
> +       KASAN_ARG_MODE_SYNC,
> +       KASAN_ARG_MODE_ASYNC,

For other modes I explicitly added a _DEFAULT option first. It makes
sense to do this here as well for consistency.

> +};
> +
>  enum kasan_arg_stacktrace {
>         KASAN_ARG_STACKTRACE_DEFAULT,
>         KASAN_ARG_STACKTRACE_OFF,
> @@ -38,6 +43,7 @@ enum kasan_arg_fault {
>  };
>
>  static enum kasan_arg kasan_arg __ro_after_init;
> +static enum kasan_arg_mode kasan_arg_mode __ro_after_init;
>  static enum kasan_arg_stacktrace kasan_arg_stacktrace __ro_after_init;
>  static enum kasan_arg_fault kasan_arg_fault __ro_after_init;
>
> @@ -68,6 +74,21 @@ static int __init early_kasan_flag(char *arg)
>  }
>  early_param("kasan", early_kasan_flag);
>
> +/* kasan.mode=sync/async */
> +static int __init early_kasan_mode(char *arg)
> +{
> +       /* If arg is not set the default mode is sync */
> +       if ((!arg) || !strcmp(arg, "sync"))
> +               kasan_arg_mode = KASAN_ARG_MODE_SYNC;
> +       else if (!strcmp(arg, "async"))
> +               kasan_arg_mode = KASAN_ARG_MODE_ASYNC;
> +       else
> +               return -EINVAL;
> +
> +       return 0;
> +}
> +early_param("kasan.mode", early_kasan_mode);
> +
>  /* kasan.stacktrace=off/on */
>  static int __init early_kasan_flag_stacktrace(char *arg)
>  {
> @@ -115,7 +136,11 @@ void kasan_init_hw_tags_cpu(void)
>                 return;
>
>         hw_init_tags(KASAN_TAG_MAX);
> -       hw_enable_tagging();
> +

Let's add a comment:

/* Enable async mode only when explicitly requested through the command line. */

> +       if (kasan_arg_mode == KASAN_ARG_MODE_ASYNC)
> +               hw_enable_tagging_async();
> +       else
> +               hw_enable_tagging_sync();
>  }
>
>  /* kasan_init_hw_tags() is called once on boot CPU. */
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index 07ef7fc742ad..3923d9744105 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -294,7 +294,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
>  #define arch_set_mem_tag_range(addr, size, tag) ((void *)(addr))
>  #endif
>
> -#define hw_enable_tagging()                    arch_enable_tagging()
> +#define hw_enable_tagging_sync()               arch_enable_tagging_sync()
> +#define hw_enable_tagging_async()              arch_enable_tagging_async()
>  #define hw_init_tags(max_tag)                  arch_init_tags(max_tag)
>  #define hw_set_tagging_report_once(state)      arch_set_tagging_report_once(state)
>  #define hw_get_random_tag()                    arch_get_random_tag()
> @@ -303,7 +304,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
>
>  #else /* CONFIG_KASAN_HW_TAGS */
>
> -#define hw_enable_tagging()
> +#define hw_enable_tagging_sync()
> +#define hw_enable_tagging_async()
>  #define hw_set_tagging_report_once(state)
>
>  #endif /* CONFIG_KASAN_HW_TAGS */
> --
> 2.30.0
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
@ 2021-01-21 17:36   ` Andrey Konovalov
  2021-01-22  2:45   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 23+ messages in thread
From: Andrey Konovalov @ 2021-01-21 17:36 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 5:39 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> KASAN provides an asynchronous mode of execution.
>
> Add reporting functionality for this mode.
>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  include/linux/kasan.h |  2 ++
>  mm/kasan/report.c     | 11 +++++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index bb862d1f0e15..b0a1d9dfa85c 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -351,6 +351,8 @@ static inline void *kasan_reset_tag(const void *addr)
>  bool kasan_report(unsigned long addr, size_t size,
>                 bool is_write, unsigned long ip);
>
> +void kasan_report_async(void);
> +
>  #else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
>
>  static inline void *kasan_reset_tag(const void *addr)
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 234f35a84f19..2fd6845a95e9 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -358,6 +358,17 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
>         end_report(&flags);
>  }
>
> +void kasan_report_async(void)
> +{
> +       unsigned long flags;
> +
> +       start_report(&flags);
> +       pr_err("BUG: KASAN: invalid-access\n");
> +       pr_err("Asynchronous mode enabled: no access details available\n");
> +       dump_stack();
> +       end_report(&flags);
> +}
> +
>  static void __kasan_report(unsigned long addr, size_t size, bool is_write,
>                                 unsigned long ip)
>  {
> --
> 2.30.0
>

Reviewed-by: Andrey Konovalov <andreyknvl@google.com>

FTR: this will conflict with the Alex's patch:

https://lore.kernel.org/linux-api/20210121131915.1331302-1-glider@google.com/T/#m8872c56af85babfc08784e2b2fcd5cc1c0c73859

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 4/6] arm64: mte: Enable async tag check fault
  2021-01-21 16:39 ` [PATCH v5 4/6] arm64: mte: Enable async tag check fault Vincenzo Frascino
@ 2021-01-21 17:38   ` Andrey Konovalov
  2021-01-22 11:24     ` Vincenzo Frascino
  2021-01-22 11:58   ` Catalin Marinas
  1 sibling, 1 reply; 23+ messages in thread
From: Andrey Konovalov @ 2021-01-21 17:38 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> MTE provides a mode that asynchronously updates the TFSR_EL1 register
> when a tag check exception is detected.
>
> To take advantage of this mode the kernel has to verify the status of
> the register at:
>   1. Context switching
>   2. Return to user/EL0 (Not required in entry from EL0 since the kernel
>   did not run)
>   3. Kernel entry from EL1
>   4. Kernel exit to EL1
>
> If the register is non-zero a trace is reported.
>
> Add the required features for EL1 detection and reporting.
>
> Note: ITFSB bit is set in the SCTLR_EL1 register hence it guaranties that
> the indirect writes to TFSR_EL1 are synchronized at exception entry to
> EL1. On the context switch path the synchronization is guarantied by the
> dsb() in __switch_to().
> The dsb(nsh) in mte_check_tfsr_exit() is provisional pending
> confirmation by the architects.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  arch/arm64/include/asm/mte.h     | 32 +++++++++++++++++++++++
>  arch/arm64/kernel/entry-common.c |  6 +++++
>  arch/arm64/kernel/mte.c          | 44 ++++++++++++++++++++++++++++++++
>  3 files changed, 82 insertions(+)
>
> diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h
> index d02aff9f493d..237bb2f7309d 100644
> --- a/arch/arm64/include/asm/mte.h
> +++ b/arch/arm64/include/asm/mte.h
> @@ -92,5 +92,37 @@ static inline void mte_assign_mem_tag_range(void *addr, size_t size)
>
>  #endif /* CONFIG_ARM64_MTE */
>
> +#ifdef CONFIG_KASAN_HW_TAGS
> +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 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  */
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index 5346953e4382..31666511ba67 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -37,6 +37,8 @@ static void noinstr enter_from_kernel_mode(struct pt_regs *regs)
>         lockdep_hardirqs_off(CALLER_ADDR0);
>         rcu_irq_enter_check_tick();
>         trace_hardirqs_off_finish();
> +
> +       mte_check_tfsr_entry();
>  }
>
>  /*
> @@ -47,6 +49,8 @@ static void noinstr exit_to_kernel_mode(struct pt_regs *regs)
>  {
>         lockdep_assert_irqs_disabled();
>
> +       mte_check_tfsr_exit();
> +
>         if (interrupts_enabled(regs)) {
>                 if (regs->exit_rcu) {
>                         trace_hardirqs_on_prepare();
> @@ -243,6 +247,8 @@ asmlinkage void noinstr enter_from_user_mode(void)
>
>  asmlinkage void noinstr exit_to_user_mode(void)
>  {
> +       mte_check_tfsr_exit();
> +
>         trace_hardirqs_on_prepare();
>         lockdep_hardirqs_on_prepare(CALLER_ADDR0);
>         user_enter_irqoff();
> diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
> index 92078e1eb627..7763ac1f2917 100644
> --- a/arch/arm64/kernel/mte.c
> +++ b/arch/arm64/kernel/mte.c
> @@ -182,6 +182,37 @@ bool mte_report_once(void)
>         return READ_ONCE(report_fault_once);
>  }
>
> +#ifdef CONFIG_KASAN_HW_TAGS
> +void mte_check_tfsr_el1(void)
> +{
> +       u64 tfsr_el1;
> +
> +       if (!system_supports_mte())
> +               return;
> +
> +       tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);
> +
> +       /*
> +        * The kernel should never trigger an asynchronous fault on a
> +        * TTBR0 address, so we should never see TF0 set.
> +        * For futexes we disable checks via PSTATE.TCO.
> +        */
> +       WARN_ONCE(tfsr_el1 & SYS_TFSR_EL1_TF0,
> +                 "Kernel async tag fault on TTBR0 address");
> +
> +       if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) {
> +               /*
> +                * Note: isb() is not required after this direct write
> +                * because there is no indirect read subsequent to it
> +                * (per ARM DDI 0487F.c table D13-1).
> +                */
> +               write_sysreg_s(0, SYS_TFSR_EL1);
> +
> +               kasan_report_async();

Do we need a static bool reported like in do_tag_recovery() here?

> +       }
> +}
> +#endif
> +
>  static void update_sctlr_el1_tcf0(u64 tcf0)
>  {
>         /* ISB required for the kernel uaccess routines */
> @@ -247,6 +278,19 @@ void mte_thread_switch(struct task_struct *next)
>         /* avoid expensive SCTLR_EL1 accesses if no change */
>         if (current->thread.sctlr_tcf0 != next->thread.sctlr_tcf0)
>                 update_sctlr_el1_tcf0(next->thread.sctlr_tcf0);
> +       else
> +               isb();
> +
> +       /*
> +        * Check if an async tag exception occurred at EL1.
> +        *
> +        * Note: On the context switch path we rely on the dsb() present
> +        * in __switch_to() to guarantee that the indirect writes to TFSR_EL1
> +        * are synchronized before this point.
> +        * isb() above is required for the same reason.
> +        *
> +        */
> +       mte_check_tfsr_el1();
>  }
>
>  void mte_suspend_exit(void)
> --
> 2.30.0
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled
  2021-01-21 16:39 ` [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled Vincenzo Frascino
@ 2021-01-21 17:40   ` Andrey Konovalov
  2021-01-22 11:26     ` Vincenzo Frascino
  2021-01-22 12:00     ` Catalin Marinas
  2021-01-22  4:04   ` kernel test robot
  1 sibling, 2 replies; 23+ messages in thread
From: Andrey Konovalov @ 2021-01-21 17:40 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> Architectures supported by KASAN_HW_TAGS can provide a sync or async
> mode of execution. KASAN KUNIT tests can be executed only when sync
> mode is enabled.
>
> Forbid the execution of the KASAN KUNIT tests when async mode is
> enabled.
>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  lib/test_kasan.c | 5 +++++
>  mm/kasan/kasan.h | 2 ++
>  2 files changed, 7 insertions(+)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index 7285dcf9fcc1..1306f707b4fe 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -52,6 +52,11 @@ static int kasan_test_init(struct kunit *test)
>                 return -1;
>         }
>
> +       if (!hw_is_mode_sync()) {
> +               kunit_err(test, "can't run KASAN tests in async mode");
> +               return -1;
> +       }

I'd rather implement this check at the KASAN level, than in arm64
code. Just the way kasan_stack_collection_enabled() is implemented.

Feel free to drop this change and the previous patch, I'll implement
this myself later.

> +
>         multishot = kasan_save_enable_multi_shot();
>         hw_set_tagging_report_once(false);
>         return 0;
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index 3923d9744105..3464113042ab 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -296,6 +296,7 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
>
>  #define hw_enable_tagging_sync()               arch_enable_tagging_sync()
>  #define hw_enable_tagging_async()              arch_enable_tagging_async()
> +#define hw_is_mode_sync()                      arch_is_mode_sync()
>  #define hw_init_tags(max_tag)                  arch_init_tags(max_tag)
>  #define hw_set_tagging_report_once(state)      arch_set_tagging_report_once(state)
>  #define hw_get_random_tag()                    arch_get_random_tag()
> @@ -306,6 +307,7 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
>
>  #define hw_enable_tagging_sync()
>  #define hw_enable_tagging_async()
> +#define hw_is_mode_sync()
>  #define hw_set_tagging_report_once(state)
>
>  #endif /* CONFIG_KASAN_HW_TAGS */
> --
> 2.30.0
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 5/6] arm64: mte: Expose execution mode
  2021-01-21 16:39 ` [PATCH v5 5/6] arm64: mte: Expose execution mode Vincenzo Frascino
@ 2021-01-21 17:41   ` Andrey Konovalov
  0 siblings, 0 replies; 23+ messages in thread
From: Andrey Konovalov @ 2021-01-21 17:41 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> MTE enabled arm64 HW can be configured in synchronous or asynchronous
> tagging mode of execution.
> In synchronous mode, an exception is triggered if a tag check fault
> occurs.
> In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register
> is updated asynchronously. The kernel checks the corresponding bits
> periodically.
>
> Introduce an API that exposes the mode of execution to the kernel.
>
> Note: This API will be used by KASAN KUNIT tests to forbid the execution
> when async mode is enable.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  arch/arm64/include/asm/memory.h    | 1 +
>  arch/arm64/include/asm/mte-kasan.h | 6 ++++++
>  arch/arm64/kernel/mte.c            | 8 ++++++++
>  3 files changed, 15 insertions(+)
>
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index df96b9c10b81..1d4eef519fa6 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -233,6 +233,7 @@ static inline const void *__tag_set(const void *addr, u8 tag)
>  #ifdef CONFIG_KASAN_HW_TAGS
>  #define arch_enable_tagging_sync()             mte_enable_kernel_sync()
>  #define arch_enable_tagging_async()            mte_enable_kernel_async()
> +#define arch_is_mode_sync()                    mte_is_mode_sync()
>  #define arch_set_tagging_report_once(state)    mte_set_report_once(state)
>  #define arch_init_tags(max_tag)                        mte_init_tags(max_tag)
>  #define arch_get_random_tag()                  mte_get_random_tag()
> diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mte-kasan.h
> index 76b6a5988ce5..c216160e805c 100644
> --- a/arch/arm64/include/asm/mte-kasan.h
> +++ b/arch/arm64/include/asm/mte-kasan.h
> @@ -31,6 +31,7 @@ void *mte_set_mem_tag_range(void *addr, size_t size, u8 tag);
>
>  void mte_enable_kernel_sync(void);
>  void mte_enable_kernel_async(void);
> +bool mte_is_mode_sync(void);
>  void mte_init_tags(u64 max_tag);
>
>  void mte_set_report_once(bool state);
> @@ -64,6 +65,11 @@ static inline void mte_enable_kernel_sync(void)
>  {
>  }
>
> +static inline bool mte_is_mode_sync(void)
> +{
> +       return false;
> +}
> +
>  static inline void mte_init_tags(u64 max_tag)
>  {
>  }
> diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
> index 7763ac1f2917..1cc3fc173b97 100644
> --- a/arch/arm64/kernel/mte.c
> +++ b/arch/arm64/kernel/mte.c
> @@ -26,6 +26,7 @@
>  u64 gcr_kernel_excl __ro_after_init;
>
>  static bool report_fault_once = true;
> +static bool __mte_mode_sync = true;
>
>  static void mte_sync_page_tags(struct page *page, pte_t *ptep, bool check_swap)
>  {
> @@ -169,9 +170,16 @@ void mte_enable_kernel_sync(void)
>
>  void mte_enable_kernel_async(void)
>  {
> +       __mte_mode_sync = false;
> +
>         __mte_enable_kernel("asynchronous", SCTLR_ELx_TCF_ASYNC);
>  }
>
> +bool mte_is_mode_sync(void)
> +{
> +       return __mte_mode_sync;
> +}
> +
>  void mte_set_report_once(bool state)
>  {
>         WRITE_ONCE(report_fault_once, state);
> --
> 2.30.0
>

(See my comment on patch #6.)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
  2021-01-21 17:36   ` Andrey Konovalov
@ 2021-01-22  2:45   ` kernel test robot
  2021-01-22  2:46   ` kernel test robot
  2021-01-22 13:19   ` Catalin Marinas
  3 siblings, 0 replies; 23+ messages in thread
From: kernel test robot @ 2021-01-22  2:45 UTC (permalink / raw)
  To: Vincenzo Frascino, linux-arm-kernel, linux-kernel, kasan-dev
  Cc: kbuild-all, clang-built-linux, Vincenzo Frascino,
	Catalin Marinas, Will Deacon, Dmitry Vyukov, Andrey Ryabinin,
	Alexander Potapenko, Marco Elver

[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]

Hi Vincenzo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210121]
[cannot apply to arm64/for-next/core arm/for-next soc/for-next xlnx/master kvmarm/next linus/master hnaz-linux-mm/master v5.11-rc4 v5.11-rc3 v5.11-rc2 v5.11-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
base:    bc085f8fc88fc16796c9f2364e2bfb3fef305cad
config: riscv-randconfig-r003-20210122 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bd3a387ee76f58caa0d7901f3f84e9bb3d006f27)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/5d51fa880ab55b639b377b24bfe0b8ef6560c14c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
        git checkout 5d51fa880ab55b639b377b24bfe0b8ef6560c14c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> mm/kasan/report.c:361:6: warning: no previous prototype for function 'kasan_report_async' [-Wmissing-prototypes]
   void kasan_report_async(void)
        ^
   mm/kasan/report.c:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void kasan_report_async(void)
   ^
   static 
   1 warning generated.


vim +/kasan_report_async +361 mm/kasan/report.c

   360	
 > 361	void kasan_report_async(void)
   362	{
   363		unsigned long flags;
   364	
   365		start_report(&flags);
   366		pr_err("BUG: KASAN: invalid-access\n");
   367		pr_err("Asynchronous mode enabled: no access details available\n");
   368		dump_stack();
   369		end_report(&flags);
   370	}
   371	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25951 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
  2021-01-21 17:36   ` Andrey Konovalov
  2021-01-22  2:45   ` kernel test robot
@ 2021-01-22  2:46   ` kernel test robot
  2021-01-22 13:19   ` Catalin Marinas
  3 siblings, 0 replies; 23+ messages in thread
From: kernel test robot @ 2021-01-22  2:46 UTC (permalink / raw)
  To: Vincenzo Frascino, linux-arm-kernel, linux-kernel, kasan-dev
  Cc: kbuild-all, Vincenzo Frascino, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver

[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]

Hi Vincenzo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210121]
[cannot apply to arm64/for-next/core arm/for-next soc/for-next xlnx/master kvmarm/next linus/master hnaz-linux-mm/master v5.11-rc4 v5.11-rc3 v5.11-rc2 v5.11-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
base:    bc085f8fc88fc16796c9f2364e2bfb3fef305cad
config: x86_64-randconfig-s022-20210122 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-208-g46a52ca4-dirty
        # https://github.com/0day-ci/linux/commit/5d51fa880ab55b639b377b24bfe0b8ef6560c14c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
        git checkout 5d51fa880ab55b639b377b24bfe0b8ef6560c14c
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> mm/kasan/report.c:361:6: warning: no previous prototype for 'kasan_report_async' [-Wmissing-prototypes]
     361 | void kasan_report_async(void)
         |      ^~~~~~~~~~~~~~~~~~


vim +/kasan_report_async +361 mm/kasan/report.c

   360	
 > 361	void kasan_report_async(void)
   362	{
   363		unsigned long flags;
   364	
   365		start_report(&flags);
   366		pr_err("BUG: KASAN: invalid-access\n");
   367		pr_err("Asynchronous mode enabled: no access details available\n");
   368		dump_stack();
   369		end_report(&flags);
   370	}
   371	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36054 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled
  2021-01-21 16:39 ` [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled Vincenzo Frascino
  2021-01-21 17:40   ` Andrey Konovalov
@ 2021-01-22  4:04   ` kernel test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kernel test robot @ 2021-01-22  4:04 UTC (permalink / raw)
  To: Vincenzo Frascino, linux-arm-kernel, linux-kernel, kasan-dev
  Cc: kbuild-all, clang-built-linux, Vincenzo Frascino,
	Catalin Marinas, Will Deacon, Dmitry Vyukov, Andrey Ryabinin,
	Alexander Potapenko, Marco Elver

[-- Attachment #1: Type: text/plain, Size: 2815 bytes --]

Hi Vincenzo,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20210121]
[cannot apply to arm64/for-next/core arm/for-next soc/for-next xlnx/master kvmarm/next linus/master hnaz-linux-mm/master v5.11-rc4 v5.11-rc3 v5.11-rc2 v5.11-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
base:    bc085f8fc88fc16796c9f2364e2bfb3fef305cad
config: riscv-randconfig-r003-20210122 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bd3a387ee76f58caa0d7901f3f84e9bb3d006f27)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/0ac23ec8a70b5fd68efdec0a6a501bdccddf4d5e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add-async-mode-support/20210122-004631
        git checkout 0ac23ec8a70b5fd68efdec0a6a501bdccddf4d5e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> lib/test_kasan.c:55:24: error: expected expression
           if (!hw_is_mode_sync()) {
                                 ^
   1 error generated.


vim +55 lib/test_kasan.c

    41	
    42	/*
    43	 * Temporarily enable multi-shot mode. Otherwise, KASAN would only report the
    44	 * first detected bug and panic the kernel if panic_on_warn is enabled. For
    45	 * hardware tag-based KASAN also allow tag checking to be reenabled for each
    46	 * test, see the comment for KUNIT_EXPECT_KASAN_FAIL().
    47	 */
    48	static int kasan_test_init(struct kunit *test)
    49	{
    50		if (!kasan_enabled()) {
    51			kunit_err(test, "can't run KASAN tests with KASAN disabled");
    52			return -1;
    53		}
    54	
  > 55		if (!hw_is_mode_sync()) {
    56			kunit_err(test, "can't run KASAN tests in async mode");
    57			return -1;
    58		}
    59	
    60		multishot = kasan_save_enable_multi_shot();
    61		hw_set_tagging_report_once(false);
    62		return 0;
    63	}
    64	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25951 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 4/6] arm64: mte: Enable async tag check fault
  2021-01-21 17:38   ` Andrey Konovalov
@ 2021-01-22 11:24     ` Vincenzo Frascino
  0 siblings, 0 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-22 11:24 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov



On 1/21/21 5:38 PM, Andrey Konovalov wrote:
>> +       if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) {
>> +               /*
>> +                * Note: isb() is not required after this direct write
>> +                * because there is no indirect read subsequent to it
>> +                * (per ARM DDI 0487F.c table D13-1).
>> +                */
>> +               write_sysreg_s(0, SYS_TFSR_EL1);
>> +
>> +               kasan_report_async();
> Do we need a static bool reported like in do_tag_recovery() here?
> 

I would say not because async mode does not get disabled after the first fault.

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter
  2021-01-21 17:34   ` Andrey Konovalov
@ 2021-01-22 11:25     ` Vincenzo Frascino
  0 siblings, 0 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-22 11:25 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov



On 1/21/21 5:34 PM, Andrey Konovalov wrote:
>> +- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in
>> +  synchronous or asynchronous mode of execution (default: ``sync``).
>> +  ``synchronous mode``: an exception is triggered if a tag check fault occurs.
> Synchronous mode: a bad access is detected immediately when a tag
> check fault occurs.
> 
> (No need for `` here, "synchronous mode" is not an inline snippet.)
> 

Ok will do in v5.

>> +  ``asynchronous mode``: if a tag check fault occurs, the information is stored
>> +  asynchronously in hardware (e.g. in the TFSR_EL1 register for arm64). The kernel
>> +  checks the hardware location and reports an error if the fault is detected.
> Asynchronous mode: a bad access detection is delayed. When a tag check
> fault occurs, the information is stored in hardware (in the TFSR_EL1
> register for arm64). The kernel periodically checks the hardware and
> only reports tag faults during these checks.
> 

Will do in v5.

>> +
>>  - ``kasan.stacktrace=off`` or ``=on`` disables or enables alloc and free stack
>>    traces collection (default: ``on`` for ``CONFIG_DEBUG_KERNEL=y``, otherwise
>>    ``off``).
>> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
>> index d16ec9e66806..7285dcf9fcc1 100644
>> --- a/lib/test_kasan.c
>> +++ b/lib/test_kasan.c
>> @@ -97,7 +97,7 @@ static void kasan_test_exit(struct kunit *test)
>>                         READ_ONCE(fail_data.report_found));     \
>>         if (IS_ENABLED(CONFIG_KASAN_HW_TAGS)) {                 \
>>                 if (READ_ONCE(fail_data.report_found))          \
>> -                       hw_enable_tagging();                    \
>> +                       hw_enable_tagging_sync();               \
>>                 migrate_enable();                               \
>>         }                                                       \
>>  } while (0)
>> diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
>> index e529428e7a11..224a2187839c 100644
>> --- a/mm/kasan/hw_tags.c
>> +++ b/mm/kasan/hw_tags.c
>> @@ -25,6 +25,11 @@ enum kasan_arg {
>>         KASAN_ARG_ON,
>>  };
>>
>> +enum kasan_arg_mode {
>> +       KASAN_ARG_MODE_SYNC,
>> +       KASAN_ARG_MODE_ASYNC,
> For other modes I explicitly added a _DEFAULT option first. It makes
> sense to do this here as well for consistency.
> 

Will do in v5.

>> +};
>> +
>>  enum kasan_arg_stacktrace {
>>         KASAN_ARG_STACKTRACE_DEFAULT,
>>         KASAN_ARG_STACKTRACE_OFF,
>> @@ -38,6 +43,7 @@ enum kasan_arg_fault {
>>  };
>>
>>  static enum kasan_arg kasan_arg __ro_after_init;
>> +static enum kasan_arg_mode kasan_arg_mode __ro_after_init;
>>  static enum kasan_arg_stacktrace kasan_arg_stacktrace __ro_after_init;
>>  static enum kasan_arg_fault kasan_arg_fault __ro_after_init;
>>
>> @@ -68,6 +74,21 @@ static int __init early_kasan_flag(char *arg)
>>  }
>>  early_param("kasan", early_kasan_flag);
>>
>> +/* kasan.mode=sync/async */
>> +static int __init early_kasan_mode(char *arg)
>> +{
>> +       /* If arg is not set the default mode is sync */
>> +       if ((!arg) || !strcmp(arg, "sync"))
>> +               kasan_arg_mode = KASAN_ARG_MODE_SYNC;
>> +       else if (!strcmp(arg, "async"))
>> +               kasan_arg_mode = KASAN_ARG_MODE_ASYNC;
>> +       else
>> +               return -EINVAL;
>> +
>> +       return 0;
>> +}
>> +early_param("kasan.mode", early_kasan_mode);
>> +
>>  /* kasan.stacktrace=off/on */
>>  static int __init early_kasan_flag_stacktrace(char *arg)
>>  {
>> @@ -115,7 +136,11 @@ void kasan_init_hw_tags_cpu(void)
>>                 return;
>>
>>         hw_init_tags(KASAN_TAG_MAX);
>> -       hw_enable_tagging();
>> +
> Let's add a comment:
> 
> /* Enable async mode only when explicitly requested through the command line. */
> 

Will do in v5.

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled
  2021-01-21 17:40   ` Andrey Konovalov
@ 2021-01-22 11:26     ` Vincenzo Frascino
  2021-01-22 12:00     ` Catalin Marinas
  1 sibling, 0 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-22 11:26 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: Linux ARM, LKML, kasan-dev, Catalin Marinas, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov


On 1/21/21 5:40 PM, Andrey Konovalov wrote:
>> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
>> index 7285dcf9fcc1..1306f707b4fe 100644
>> --- a/lib/test_kasan.c
>> +++ b/lib/test_kasan.c
>> @@ -52,6 +52,11 @@ static int kasan_test_init(struct kunit *test)
>>                 return -1;
>>         }
>>
>> +       if (!hw_is_mode_sync()) {
>> +               kunit_err(test, "can't run KASAN tests in async mode");
>> +               return -1;
>> +       }
> I'd rather implement this check at the KASAN level, than in arm64
> code. Just the way kasan_stack_collection_enabled() is implemented.
> 
> Feel free to drop this change and the previous patch, I'll implement
> this myself later.
> 

Fine by me, will drop 5 and 6 in v5.

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 4/6] arm64: mte: Enable async tag check fault
  2021-01-21 16:39 ` [PATCH v5 4/6] arm64: mte: Enable async tag check fault Vincenzo Frascino
  2021-01-21 17:38   ` Andrey Konovalov
@ 2021-01-22 11:58   ` Catalin Marinas
  1 sibling, 0 replies; 23+ messages in thread
From: Catalin Marinas @ 2021-01-22 11:58 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

On Thu, Jan 21, 2021 at 04:39:41PM +0000, Vincenzo Frascino wrote:
> MTE provides a mode that asynchronously updates the TFSR_EL1 register
> when a tag check exception is detected.
> 
> To take advantage of this mode the kernel has to verify the status of
> the register at:
>   1. Context switching
>   2. Return to user/EL0 (Not required in entry from EL0 since the kernel
>   did not run)
>   3. Kernel entry from EL1
>   4. Kernel exit to EL1
> 
> If the register is non-zero a trace is reported.
> 
> Add the required features for EL1 detection and reporting.
> 
> Note: ITFSB bit is set in the SCTLR_EL1 register hence it guaranties that
> the indirect writes to TFSR_EL1 are synchronized at exception entry to
> EL1. On the context switch path the synchronization is guarantied by the
> dsb() in __switch_to().
> The dsb(nsh) in mte_check_tfsr_exit() is provisional pending
> confirmation by the architects.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled
  2021-01-21 17:40   ` Andrey Konovalov
  2021-01-22 11:26     ` Vincenzo Frascino
@ 2021-01-22 12:00     ` Catalin Marinas
  1 sibling, 0 replies; 23+ messages in thread
From: Catalin Marinas @ 2021-01-22 12:00 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: Vincenzo Frascino, Linux ARM, LKML, kasan-dev, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov

On Thu, Jan 21, 2021 at 06:40:35PM +0100, Andrey Konovalov wrote:
> On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino
> <vincenzo.frascino@arm.com> wrote:
> >
> > Architectures supported by KASAN_HW_TAGS can provide a sync or async
> > mode of execution. KASAN KUNIT tests can be executed only when sync
> > mode is enabled.
> >
> > Forbid the execution of the KASAN KUNIT tests when async mode is
> > enabled.
> >
> > Cc: Dmitry Vyukov <dvyukov@google.com>
> > Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> > Cc: Alexander Potapenko <glider@google.com>
> > Cc: Andrey Konovalov <andreyknvl@google.com>
> > Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> > ---
> >  lib/test_kasan.c | 5 +++++
> >  mm/kasan/kasan.h | 2 ++
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> > index 7285dcf9fcc1..1306f707b4fe 100644
> > --- a/lib/test_kasan.c
> > +++ b/lib/test_kasan.c
> > @@ -52,6 +52,11 @@ static int kasan_test_init(struct kunit *test)
> >                 return -1;
> >         }
> >
> > +       if (!hw_is_mode_sync()) {
> > +               kunit_err(test, "can't run KASAN tests in async mode");
> > +               return -1;
> > +       }
> 
> I'd rather implement this check at the KASAN level, than in arm64
> code. Just the way kasan_stack_collection_enabled() is implemented.
> 
> Feel free to drop this change and the previous patch, I'll implement
> this myself later.

I agree, it makes sense.

-- 
Catalin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
                     ` (2 preceding siblings ...)
  2021-01-22  2:46   ` kernel test robot
@ 2021-01-22 13:19   ` Catalin Marinas
  2021-01-22 13:27     ` Vincenzo Frascino
  3 siblings, 1 reply; 23+ messages in thread
From: Catalin Marinas @ 2021-01-22 13:19 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov

On Thu, Jan 21, 2021 at 04:39:40PM +0000, Vincenzo Frascino wrote:
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index bb862d1f0e15..b0a1d9dfa85c 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -351,6 +351,8 @@ static inline void *kasan_reset_tag(const void *addr)
>  bool kasan_report(unsigned long addr, size_t size,
>  		bool is_write, unsigned long ip);
>  
> +void kasan_report_async(void);
> +
>  #else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
>  
>  static inline void *kasan_reset_tag(const void *addr)
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 234f35a84f19..2fd6845a95e9 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -358,6 +358,17 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
>  	end_report(&flags);
>  }
>  
> +void kasan_report_async(void)
> +{
> +	unsigned long flags;
> +
> +	start_report(&flags);
> +	pr_err("BUG: KASAN: invalid-access\n");
> +	pr_err("Asynchronous mode enabled: no access details available\n");
> +	dump_stack();
> +	end_report(&flags);
> +}

I think the kernel test robot complains that with KASAN_SW_TAGS and
HW_TAGS disabled, the kasan_report_async() prototype is no longer
visible but you still have the non-static function definition here. So
either move kasan_report_async() out of this #ifdef or add the #ifdef
around the function definition.

It looks like the original kasan_report() prototype is declared in two
places (second one in mm/kasan/kasan.h). I'd remove the latter and try
to have a consistent approach for kasan_report() and
kasan_report_async().

-- 
Catalin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-22 13:19   ` Catalin Marinas
@ 2021-01-22 13:27     ` Vincenzo Frascino
  2021-01-22 13:38       ` Vincenzo Frascino
  0 siblings, 1 reply; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-22 13:27 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov



On 1/22/21 1:19 PM, Catalin Marinas wrote:
> On Thu, Jan 21, 2021 at 04:39:40PM +0000, Vincenzo Frascino wrote:
>> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
>> index bb862d1f0e15..b0a1d9dfa85c 100644
>> --- a/include/linux/kasan.h
>> +++ b/include/linux/kasan.h
>> @@ -351,6 +351,8 @@ static inline void *kasan_reset_tag(const void *addr)
>>  bool kasan_report(unsigned long addr, size_t size,
>>  		bool is_write, unsigned long ip);
>>  
>> +void kasan_report_async(void);
>> +
>>  #else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
>>  
>>  static inline void *kasan_reset_tag(const void *addr)
>> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
>> index 234f35a84f19..2fd6845a95e9 100644
>> --- a/mm/kasan/report.c
>> +++ b/mm/kasan/report.c
>> @@ -358,6 +358,17 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
>>  	end_report(&flags);
>>  }
>>  
>> +void kasan_report_async(void)
>> +{
>> +	unsigned long flags;
>> +
>> +	start_report(&flags);
>> +	pr_err("BUG: KASAN: invalid-access\n");
>> +	pr_err("Asynchronous mode enabled: no access details available\n");
>> +	dump_stack();
>> +	end_report(&flags);
>> +}
> 
> I think the kernel test robot complains that with KASAN_SW_TAGS and
> HW_TAGS disabled, the kasan_report_async() prototype is no longer
> visible but you still have the non-static function definition here. So
> either move kasan_report_async() out of this #ifdef or add the #ifdef
> around the function definition.
>

I think adding #ifdef around the function would be the best way in this case,
for consistency with the header.

> It looks like the original kasan_report() prototype is declared in two
> places (second one in mm/kasan/kasan.h). I'd remove the latter and try
> to have a consistent approach for kasan_report() and
> kasan_report_async().
> 

Ok, I will remove it.

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 3/6] kasan: Add report for async mode
  2021-01-22 13:27     ` Vincenzo Frascino
@ 2021-01-22 13:38       ` Vincenzo Frascino
  0 siblings, 0 replies; 23+ messages in thread
From: Vincenzo Frascino @ 2021-01-22 13:38 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, Will Deacon,
	Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko, Marco Elver,
	Evgenii Stepanov, Branislav Rankov, Andrey Konovalov



On 1/22/21 1:27 PM, Vincenzo Frascino wrote:
>> It looks like the original kasan_report() prototype is declared in two
>> places (second one in mm/kasan/kasan.h). I'd remove the latter and try
>> to have a consistent approach for kasan_report() and
>> kasan_report_async().
>>
> Ok, I will remove it.

I just realized that the internal interface exposes the kasan_report() interface
for the GENERIC KASAN implementation. If I remove it that does not work anymore:

/data1/Projects/LinuxKernel/linux-mte/mm/kasan/common.c: In function
‘__kasan_check_byte’:
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/common.c:503:17: error: implicit
declaration of function ‘kasan_report’ [-Werror=implicit-function-declaration]
  503 |                 kasan_report((unsigned long)address, 1, false, ip);
      |                 ^~~~~~~~~~~~
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/generic.c: In function
‘check_region_inline’:
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/generic.c:170:25: error: implicit
declaration of function ‘kasan_report’ [-Werror=implicit-function-declaration]
  170 |                 return !kasan_report(addr, size, write, ret_ip);
      |                         ^~~~~~~~~~~~
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/report_generic.c: In function
‘__asan_report_load1_noabort’:
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/report_generic.c:295:9: error:
implicit declaration of function ‘kasan_report’
[-Werror=implicit-function-declaration]
  295 |         kasan_report(addr, size, false, _RET_IP_);        \
      |         ^~~~~~~~~~~~
/data1/Projects/LinuxKernel/linux-mte/mm/kasan/report_generic.c:306:1: note: in
expansion of macro ‘DEFINE_ASAN_REPORT_LOAD’
  306 | DEFINE_ASAN_REPORT_LOAD(1);

To do that cleanly few things need to be shuffled around, Andrey or I can take
care of it but if you agree we shall look into this after -rc1.

Thanks!

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-01-22 13:36 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 16:39 [PATCH v5 0/6] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
2021-01-21 16:39 ` [PATCH v5 1/6] arm64: mte: Add asynchronous " Vincenzo Frascino
2021-01-21 16:39 ` [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter Vincenzo Frascino
2021-01-21 17:34   ` Andrey Konovalov
2021-01-22 11:25     ` Vincenzo Frascino
2021-01-21 16:39 ` [PATCH v5 3/6] kasan: Add report for async mode Vincenzo Frascino
2021-01-21 17:36   ` Andrey Konovalov
2021-01-22  2:45   ` kernel test robot
2021-01-22  2:46   ` kernel test robot
2021-01-22 13:19   ` Catalin Marinas
2021-01-22 13:27     ` Vincenzo Frascino
2021-01-22 13:38       ` Vincenzo Frascino
2021-01-21 16:39 ` [PATCH v5 4/6] arm64: mte: Enable async tag check fault Vincenzo Frascino
2021-01-21 17:38   ` Andrey Konovalov
2021-01-22 11:24     ` Vincenzo Frascino
2021-01-22 11:58   ` Catalin Marinas
2021-01-21 16:39 ` [PATCH v5 5/6] arm64: mte: Expose execution mode Vincenzo Frascino
2021-01-21 17:41   ` Andrey Konovalov
2021-01-21 16:39 ` [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled Vincenzo Frascino
2021-01-21 17:40   ` Andrey Konovalov
2021-01-22 11:26     ` Vincenzo Frascino
2021-01-22 12:00     ` Catalin Marinas
2021-01-22  4:04   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).