Skip to content

Commit 3bb61aa

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "I'm sad to say that we've got an unusually large arm64 fixes pull for rc7 which addresses numerous significant instrumentation issues with our entry code. Without these patches, lockdep is hopelessly unreliable in some configurations [1,2] and syzkaller is therefore not a lot of use because it's so noisy. Although much of this has always been broken, it appears to have been exposed more readily by other changes such as 044d0d6 ("lockdep: Only trace IRQ edges") and general lockdep improvements around IRQ tracing and NMIs. Fixing this properly required moving much of the instrumentation hooks from our entry assembly into C, which Mark has been working on for the last few weeks. We're not quite ready to move to the recently added generic functions yet, but the code here has been deliberately written to mimic that closely so we can look at cleaning things up once we have a bit more breathing room. Having said all that, the second version of these patches was posted last week and I pushed it into our CI (kernelci and cki) along with a commit which forced on PROVE_LOCKING, NOHZ_FULL and CONTEXT_TRACKING_FORCE. The result? We found a real bug in the md/raid10 code [3]. Oh, and there's also a really silly typo patch that's unrelated. Summary: - Fix numerous issues with instrumentation and exception entry - Fix hideous typo in unused register field definition" [1] https://lore.kernel.org/r/CACT4Y+aAzoJ48Mh1wNYD17pJqyEcDnrxGfApir=-j171TnQXhw@mail.gmail.com [2] https://lore.kernel.org/r/20201119193819.GA2601289@elver.google.com [3] https://lore.kernel.org/r/94c76d5e-466a-bc5f-e6c2-a11b65c39f83@redhat.com * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mte: Fix typo in macro definition arm64: entry: fix EL1 debug transitions arm64: entry: fix NMI {user, kernel}->kernel transitions arm64: entry: fix non-NMI kernel<->kernel transitions arm64: ptrace: prepare for EL1 irq/rcu tracking arm64: entry: fix non-NMI user<->kernel transitions arm64: entry: move el1 irq/nmi logic to C arm64: entry: prepare ret_to_user for function call arm64: entry: move enter_from_user_mode to entry-common.c arm64: entry: mark entry code as noinstr arm64: mark idle code as noinstr arm64: syscall: exit userspace before unmasking exceptions
2 parents 2c6ffa9 + 9e5344e commit 3bb61aa

12 files changed

Lines changed: 243 additions & 181 deletions

File tree

‎arch/arm64/include/asm/daifflags.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ static inline void local_daif_inherit(struct pt_regs *regs)
128128
{
129129
unsigned long flags = regs->pstate & DAIF_MASK;
130130

131+
if (interrupts_enabled(regs))
132+
trace_hardirqs_on();
133+
131134
/*
132135
* We can't use local_daif_restore(regs->pstate) here as
133136
* system_has_prio_mask_debugging() won't restore the I bit if it can

‎arch/arm64/include/asm/exception.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ static inline u32 disr_to_esr(u64 disr)
3131
return esr;
3232
}
3333

34+
asmlinkage void noinstr enter_el1_irq_or_nmi(struct pt_regs *regs);
35+
asmlinkage void noinstr exit_el1_irq_or_nmi(struct pt_regs *regs);
3436
asmlinkage void enter_from_user_mode(void);
37+
asmlinkage void exit_to_user_mode(void);
38+
void arm64_enter_nmi(struct pt_regs *regs);
39+
void arm64_exit_nmi(struct pt_regs *regs);
3540
void do_mem_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs);
3641
void do_undefinstr(struct pt_regs *regs);
3742
void do_bti(struct pt_regs *regs);

‎arch/arm64/include/asm/ptrace.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ struct pt_regs {
193193
/* Only valid when ARM64_HAS_IRQ_PRIO_MASKING is enabled. */
194194
u64 pmr_save;
195195
u64 stackframe[2];
196+
197+
/* Only valid for some EL1 exceptions. */
198+
u64 lockdep_hardirqs;
199+
u64 exit_rcu;
196200
};
197201

198202
static inline bool in_syscall(struct pt_regs const *regs)

‎arch/arm64/include/asm/sysreg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@
987987
#define SYS_TFSR_EL1_TF0_SHIFT 0
988988
#define SYS_TFSR_EL1_TF1_SHIFT 1
989989
#define SYS_TFSR_EL1_TF0 (UL(1) << SYS_TFSR_EL1_TF0_SHIFT)
990-
#define SYS_TFSR_EL1_TF1 (UK(2) << SYS_TFSR_EL1_TF1_SHIFT)
990+
#define SYS_TFSR_EL1_TF1 (UL(1) << SYS_TFSR_EL1_TF1_SHIFT)
991991

992992
/* Safe value for MPIDR_EL1: Bit31:RES1, Bit30:U:0, Bit24:MT:0 */
993993
#define SYS_MPIDR_SAFE_VAL (BIT(31))

0 commit comments

Comments
 (0)