Re: [patch V6 15/31] rseq: Record interrupt from user space

From: Thomas Gleixner

Date: Tue Oct 28 2025 - 13:02:17 EST


On Tue, Oct 28 2025 at 11:26, Mathieu Desnoyers wrote:
> On 2025-10-27 04:44, Thomas Gleixner wrote:
> [...]
>> @@ -281,6 +281,7 @@ static __always_inline void exit_to_user
>> static __always_inline void irqentry_enter_from_user_mode(struct pt_regs *regs)
>> {
>> enter_from_user_mode(regs);
>> + rseq_note_user_irq_entry();
>> }
>>
> Looking at x86, both exc_debug_user() and exc_int3() invoke
> irqentry_enter_from_user_mode(), but there are various
> other traps that can come from userspace (e.g. math_error,
> exc_general_protection, ...). Some of those traps don't
> necessarily end with a signal delivery to the offending
> process. And some of those traps enable interrupts.

They all go through irqentry_enter_from_user_mode(). See
DEFINE_IDTENTRY*() macros. They invoke:

irqentry_enter()
if (user_mode())
irqentry_enter_from_user_mode();

If that wouldn't be the case then all the RCU/NOHZ magic would not work
either. So any exception, trap, interrupt must go through this to
establish state correctly. Whether that's explicit as it's required for
int3 and debug_user or implicit through the IDTENTRY magic.

Thanks,

tglx