Re: [RFC PATCH v2 34/45] arm64: nmi: Add handling of superpriority interrupts as NMIs

Vladimir Murzin <[email protected]> Mon, 3 Aug 2026 13:33:24 +0100
Newsgroups org.infradead.lists.linux-arm-kernel
Message-ID <[email protected]>
On 7/28/26 13:25, Jinjie Ruan wrote:
>> @@ -924,6 +967,20 @@ static void noinstr el0_interrupt(struct pt_regs *regs,
>>  	 */
>>  	arm64_debug_exc_context(NOIRQ_CONTEXT);
>>  	arm64_exit_to_user_mode(regs, arm64_exc_hwstate_of_context(NOIRQ_CONTEXT));
>> +}
>> +
>> +static void noinstr el0_interrupt(struct pt_regs *regs,
>> +				  void (*handler)(struct pt_regs *))
>> +{
>> +	if (regs->pc & BIT(55))
>> +		arm64_apply_bp_hardening();
> It seems only after enter_from_user_mode() or irqentry_nmi_enter(), it
> is safe to call normal kernel code.

I do not think there is issue with that. Here is call chain:

arm64_apply_bp_hardening()           // always_inline
  -> alternative_has_cap_unlikely()  // always_inline
     -> cpucap_is_possible()         // always_inline
  -> fn()
      - qcom_link_stack_sanitisation // noinstr
      - call_hvc_arch_workaround_1   // noinstr
      - call_smc_arch_workaround_1   // noinstr

That's also in line with el0_ia(), el0_pc() and el0_softstp()
which call arm64_apply_bp_hardening() before enter_from_user_mode()

Cheers
Vladimir