Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:

- Fix incorrect asm constraint for load_unaligned_zeropad() fixup

- Fix thread flag update when setting TIF_MTE_ASYNC_FAULT

- Fix restored irq state when handling fault on kprobe

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: kprobes: Restore local irqflag if kprobes is cancelled
arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically
arm64: fix inline asm in load_unaligned_zeropad()

+20 -12
+5 -1
arch/arm64/Kconfig
··· 1406 1406 config AS_HAS_LDAPR 1407 1407 def_bool $(as-instr,.arch_extension rcpc) 1408 1408 1409 + config AS_HAS_LSE_ATOMICS 1410 + def_bool $(as-instr,.arch_extension lse) 1411 + 1409 1412 config ARM64_LSE_ATOMICS 1410 1413 bool 1411 1414 default ARM64_USE_LSE_ATOMICS 1412 - depends on $(as-instr,.arch_extension lse) 1415 + depends on AS_HAS_LSE_ATOMICS 1413 1416 1414 1417 config ARM64_USE_LSE_ATOMICS 1415 1418 bool "Atomic instructions" ··· 1669 1666 default y 1670 1667 depends on ARM64_AS_HAS_MTE && ARM64_TAGGED_ADDR_ABI 1671 1668 depends on AS_HAS_ARMV8_5 1669 + depends on AS_HAS_LSE_ATOMICS 1672 1670 # Required for tag checking in the uaccess routines 1673 1671 depends on ARM64_PAN 1674 1672 select ARCH_USES_HIGH_VMA_FLAGS
+5 -5
arch/arm64/include/asm/word-at-a-time.h
··· 53 53 */ 54 54 static inline unsigned long load_unaligned_zeropad(const void *addr) 55 55 { 56 - unsigned long ret, offset; 56 + unsigned long ret, tmp; 57 57 58 58 /* Load word from unaligned pointer addr */ 59 59 asm( ··· 61 61 "2:\n" 62 62 " .pushsection .fixup,\"ax\"\n" 63 63 " .align 2\n" 64 - "3: and %1, %2, #0x7\n" 65 - " bic %2, %2, #0x7\n" 66 - " ldr %0, [%2]\n" 64 + "3: bic %1, %2, #0x7\n" 65 + " ldr %0, [%1]\n" 66 + " and %1, %2, #0x7\n" 67 67 " lsl %1, %1, #0x3\n" 68 68 #ifndef __AARCH64EB__ 69 69 " lsr %0, %0, %1\n" ··· 73 73 " b 2b\n" 74 74 " .popsection\n" 75 75 _ASM_EXTABLE(1b, 3b) 76 - : "=&r" (ret), "=&r" (offset) 76 + : "=&r" (ret), "=&r" (tmp) 77 77 : "r" (addr), "Q" (*(unsigned long *)addr)); 78 78 79 79 return ret;
+6 -4
arch/arm64/kernel/entry.S
··· 148 148 .endm 149 149 150 150 /* Check for MTE asynchronous tag check faults */ 151 - .macro check_mte_async_tcf, flgs, tmp 151 + .macro check_mte_async_tcf, tmp, ti_flags 152 152 #ifdef CONFIG_ARM64_MTE 153 + .arch_extension lse 153 154 alternative_if_not ARM64_MTE 154 155 b 1f 155 156 alternative_else_nop_endif 156 157 mrs_s \tmp, SYS_TFSRE0_EL1 157 158 tbz \tmp, #SYS_TFSR_EL1_TF0_SHIFT, 1f 158 159 /* Asynchronous TCF occurred for TTBR0 access, set the TI flag */ 159 - orr \flgs, \flgs, #_TIF_MTE_ASYNC_FAULT 160 - str \flgs, [tsk, #TSK_TI_FLAGS] 160 + mov \tmp, #_TIF_MTE_ASYNC_FAULT 161 + add \ti_flags, tsk, #TSK_TI_FLAGS 162 + stset \tmp, [\ti_flags] 161 163 msr_s SYS_TFSRE0_EL1, xzr 162 164 1: 163 165 #endif ··· 246 244 disable_step_tsk x19, x20 247 245 248 246 /* Check for asynchronous tag check faults in user space */ 249 - check_mte_async_tcf x19, x22 247 + check_mte_async_tcf x22, x23 250 248 apply_ssbd 1, x22, x23 251 249 252 250 ptrauth_keys_install_kernel tsk, x20, x22, x23
+4 -2
arch/arm64/kernel/probes/kprobes.c
··· 267 267 if (!instruction_pointer(regs)) 268 268 BUG(); 269 269 270 - if (kcb->kprobe_status == KPROBE_REENTER) 270 + if (kcb->kprobe_status == KPROBE_REENTER) { 271 271 restore_previous_kprobe(kcb); 272 - else 272 + } else { 273 + kprobes_restore_local_irqflag(kcb, regs); 273 274 reset_current_kprobe(); 275 + } 274 276 275 277 break; 276 278 case KPROBE_HIT_ACTIVE: