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 <byungc...@sk.com> --- 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 a182295e6f08..6c69598a6423 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -279,6 +279,7 @@ config ARM64 select HAVE_SOFTIRQ_ON_OWN_STACK select USER_STACKTRACE_SUPPORT select VDSO_GETRANDOM + 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 ec0a337891dd..0fcc3dc9c2a9 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> @@ -616,6 +617,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