Re: [patch V6 19/31] rseq: Provide and use rseq_update_user_cs()
From: Thomas Gleixner
Date: Wed Oct 29 2025 - 17:00:40 EST
On Wed, Oct 29 2025 at 12:04, Steven Rostedt wrote:
>> +bool rseq_debug_update_user_cs(struct task_struct *t, struct pt_regs *regs, unsigned long csaddr);
>
> So rseq_debug_update_user_cs() is always declared.
And?
>> +#ifdef RSEQ_BUILD_SLOW_PATH
>
> But the function is only defined if RSEQ_BUILD_SLOW_PATH is defined.
Right.
>
> There's no:
>
> #else
>
> bool rseq_debug_update_user_cs(struct task_struct *t, struct pt_regs *regs,
> unsigned long csaddr)
> {
> return false;
> }
And why would you need that?
>> + if (static_branch_unlikely(&rseq_debug_enabled))
>> + return rseq_debug_update_user_cs(t, regs, csaddr);
>
> Wouldn't the above reference to rseq_debug_update_user_cs() fail to build
> if RSEQ_BUILD_SLOW_PATH is not defined?
>
> Or am I missing something?
Yes. None of this is compiled at all when CONFIG_RSEQ=n.
When CONFIG_RSEQ=y then the slowpath muck is compiled into kernel/rseq.c
because that file defines RSEQ_BUILD_SLOW_PATH.
> I see that it looks like RSEQ_BUILD_SLOW_PATH is always defined, but why
> have this logic if it can't be not defined?
The fastpath inline version is compiled into the entry code and that
does not define RSEQ_BUILD_SLOW_PATH and therefore needs the
unconditional forward declaration of the debug function.
I made it this way because I wanted to keep the debug and non-debug
version next to each other as it's simpler that way to keep them in sync
instead of forgetting about the other variant because it's in a
different file.
Thanks,
tglx