On Wed, Feb 26, 2020 at 06:05:17PM +0000, Catalin Marinas wrote: > diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile > index fc6488660f64..d4a378bc0a60 100644 > --- a/arch/arm64/kernel/Makefile > +++ b/arch/arm64/kernel/Makefile > @@ -63,6 +63,7 @@ obj-$(CONFIG_CRASH_CORE) += crash_core.o > obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o > obj-$(CONFIG_ARM64_SSBD) += ssbd.o > obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o > +obj-$(CONFIG_ARM64_MTE) += mte.o > > obj-y += vdso/ probes/ > obj-$(CONFIG_COMPAT_VDSO) += vdso32/ > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index 9461d812ae27..9338b340e869 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S [...] > @@ -738,6 +763,8 @@ work_pending: > */ > ret_to_user: > disable_daif > + /* Check for asynchronous tag check faults in the uaccess routines */ > + check_mte_async_tcf x1, x2 > gic_prio_kentry_setup tmp=x3 > ldr x1, [tsk, #TSK_TI_FLAGS] > and x2, x1, #_TIF_WORK_MASK I got this wrong, check_mte_async expects the flags as the first argument (one may experience weird behaviour with overriding the TIF flags; thanks to Kevin for debugging). The diff below should fix it: diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 9338b340e869..6e7f315911e8 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -764,9 +764,9 @@ work_pending: ret_to_user: disable_daif /* Check for asynchronous tag check faults in the uaccess routines */ - check_mte_async_tcf x1, x2 gic_prio_kentry_setup tmp=x3 ldr x1, [tsk, #TSK_TI_FLAGS] + check_mte_async_tcf x1, x2 and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending finish_ret_to_user: