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] [day] [month] [year] [list]
Message-ID: <20251001115524.24542fd8@gandalf.local.home>
Date: Wed, 1 Oct 2025 11:55:24 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: jpoimboe@...nel.org, rostedt@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/12] unwind: Simplify unwind_user_next_fp() alignment
 check

On Wed, 24 Sep 2025 09:59:58 +0200
Peter Zijlstra <peterz@...radead.org> wrote:

I would add a change log. Something like:

  sizeof(long) is 4 or 8. Where 4 = 1 << 2 and 8 = 1 << 3.
  Calculating shift to be 2 or 3 and then passing that variable into
  (1 << shift) is the same as just using sizeof(long).

I blame lack of sleep for writing that code :-p

> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>

Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>

-- Steve

> ---
>  kernel/unwind/user.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> --- a/kernel/unwind/user.c
> +++ b/kernel/unwind/user.c
> @@ -19,7 +19,6 @@ static int unwind_user_next_fp(struct un
>  {
>  	const struct unwind_user_frame *frame = &fp_frame;
>  	unsigned long cfa, fp, ra;
> -	unsigned int shift;
>  
>  	if (frame->use_fp) {
>  		if (state->fp < state->sp)
> @@ -37,8 +36,7 @@ static int unwind_user_next_fp(struct un
>  		return -EINVAL;
>  
>  	/* Make sure that the address is word aligned */
> -	shift = sizeof(long) == 4 ? 2 : 3;
> -	if (cfa & ((1 << shift) - 1))
> +	if (cfa & (sizeof(long) - 1))
>  		return -EINVAL;
>  
>  	/* Find the Return Address (RA) */
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ