lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250814085426.GS4067720@noisy.programming.kicks-ass.net>
Date: Thu, 14 Aug 2025 10:54:26 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
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 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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ