[PATCH v17 09/47] arm64, dept: add support CONFIG_ARCH_HAS_DEPT_SUPPORT to arm64
From: Byungchul Park
Date: Thu Oct 02 2025 - 04:20:16 EST
dept needs to notice every entrance from user to kernel mode to treat
every kernel context independently when tracking wait-event dependencies.
Roughly, system call and user oriented fault are the cases.
Make dept aware of the entrances of arm64 and add support
CONFIG_ARCH_HAS_DEPT_SUPPORT to arm64.
Signed-off-by: Byungchul Park <byungchul@xxxxxx>
---
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/syscall.c | 7 +++++++
arch/arm64/mm/fault.c | 7 +++++++
3 files changed, 15 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e9bbfacc35a6..a8fab2c052dc 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -281,6 +281,7 @@ config ARM64
select USER_STACKTRACE_SUPPORT
select VDSO_GETRANDOM
select VMAP_STACK
+ select ARCH_HAS_DEPT_SUPPORT
help
ARM 64-bit (AArch64) Linux support.
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index c442fcec6b9e..bbd306335179 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -7,6 +7,7 @@
#include <linux/ptrace.h>
#include <linux/randomize_kstack.h>
#include <linux/syscalls.h>
+#include <linux/dept.h>
#include <asm/debug-monitors.h>
#include <asm/exception.h>
@@ -96,6 +97,12 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
* (Similarly for HVC and SMC elsewhere.)
*/
+ /*
+ * This is a system call from user mode. Make dept work with a
+ * new kernel mode context.
+ */
+ dept_update_cxt();
+
if (flags & _TIF_MTE_ASYNC_FAULT) {
/*
* Process the asynchronous tag check fault before the actual
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index d816ff44faff..96827b999d18 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -26,6 +26,7 @@
#include <linux/pkeys.h>
#include <linux/preempt.h>
#include <linux/hugetlb.h>
+#include <linux/dept.h>
#include <asm/acpi.h>
#include <asm/bug.h>
@@ -622,6 +623,12 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
if (!(mm_flags & FAULT_FLAG_USER))
goto lock_mmap;
+ /*
+ * This fault comes from user mode. Make dept work with a new
+ * kernel mode context.
+ */
+ dept_update_cxt();
+
vma = lock_vma_under_rcu(mm, addr);
if (!vma)
goto lock_mmap;
--
2.17.1