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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <968ff88f-ae77-43b4-a5b4-1a4b0bf61098@ghiti.fr>
Date: Tue, 11 Feb 2025 08:41:38 +0100
From: Alexandre Ghiti <alex@...ti.fr>
To: Clément Léger <cleger@...osinc.com>,
 Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt
 <palmer@...belt.com>,
 "open list:RISC-V ARCHITECTURE" <linux-riscv@...ts.infradead.org>,
 open list <linux-kernel@...r.kernel.org>
Cc: Conor Dooley <conor@...nel.org>, Alexandre Ghiti <alexghiti@...osinc.com>
Subject: Re: [PATCH] riscv: cpufeature: use bitmap_equal() instead of memcmp()

Hi Clément,

On 10/02/2025 16:56, Clément Léger wrote:
> Comparison of bitmaps should be done using bitmap_equal(), not memcmp(),
> use the former one to compare isa bitmaps.
>
> Signed-off-by: Clément Léger <cleger@...osinc.com>
> ---
>   arch/riscv/kernel/cpufeature.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index c6ba750536c3..40ac72e407b6 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -479,7 +479,7 @@ static void __init riscv_resolve_isa(unsigned long *source_isa,
>   			if (bit < RISCV_ISA_EXT_BASE)
>   				*this_hwcap |= isa2hwcap[bit];
>   		}
> -	} while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa)));
> +	} while (loop && !bitmap_equal(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX));
>   }
>   
>   static void __init match_isa_ext(const char *name, const char *name_end, unsigned long *bitmap)


Since bitmap does not guarantee the value of the 'extra' bits 
(https://elixir.bootlin.com/linux/v6.13.1/source/lib/bitmap.c#L24), this 
is a fix so I would add a Fixes tag:

Fixes: 625034abd52a8c ("riscv: add ISA extensions validation callback")

You can also add:

Reviewed-by: Alexandre Ghiti <alexghiti@...osinc.com>

Thanks,

Alex


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ