[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <874iua6nom.ffs@tglx>
Date: Thu, 14 Aug 2025 15:24:41 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Michael Jeanson
<mjeanson@...icios.com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, "Paul E. McKenney" <paulmck@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Wei Liu <wei.liu@...nel.org>, Jens
Axboe <axboe@...nel.dk>
Subject: Re: [patch 10/11] rseq: Skip fixup when returning from a syscall
On Thu, Aug 14 2025 at 10:54, Peter Zijlstra wrote:
> On Wed, Aug 13, 2025 at 06:29:37PM +0200, Thomas Gleixner wrote:
>
>> --- a/kernel/rseq.c
>> +++ b/kernel/rseq.c
>> @@ -408,6 +408,22 @@ static int rseq_ip_fixup(struct pt_regs
>> return 0;
>> }
>>
>> +static inline bool rseq_ignore_event(bool from_irq, bool ksig)
>> +{
>> + /*
>> + * On architectures which do not select_GENERIC_ENTRY
>> + * @from_irq is not usable.
>> + */
>> + if (IS_ENABLED(CONFIG_DEBUG_RSEQ) || !IS_ENABLED(CONFIG_GENERIC_ENTRY))
>> + return false;
>> +
>> + /*
>> + * Avoid the heavy lifting when this is a return from syscall,
>> + * i.e. not from interrupt and not from signal delivery.
>> + */
>> + return !from_irq && !ksig;
>> +}
>> +
>> /*
>> * This resume handler must always be executed between any of:
>> * - preemption,
>
>> @@ -467,6 +484,9 @@ void __rseq_handle_notify_resume(struct
>> t->rseq_event_pending = false;
>> }
>>
>> + if (rseq_ignore_event(from_irq, !!ksig))
>> + event = false;
>> +
>> if (IS_ENABLED(CONFIG_DEBUG_RSEQ) || event) {
>> ret = rseq_ip_fixup(regs, event);
>> if (unlikely(ret < 0))
>>
>
> You now have a double check for CONFIG_DEBUG_RSEQ.
>
> Since the value of @event is immaterial when DEBUG_RSEQ, might as well
> remove it from rseq_ignore_event(), right?
Not really. debug wants the event preserved even if it's !from_irq
Yes, it's not pretty, but I wanted to preserve the debug behaviour as
much as it goes.
Powered by blists - more mailing lists