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: <Y160oanRPF3ZLINw@arm.com>
Date:   Sun, 30 Oct 2022 17:30:09 +0000
From:   Catalin Marinas <catalin.marinas@....com>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     will@...nel.org, jean-philippe@...aro.org, ardb@...nel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] random: remove early archrandom abstraction

On Sat, Oct 29, 2022 at 01:40:25AM +0200, Jason A. Donenfeld wrote:
> diff --git a/arch/arm64/include/asm/archrandom.h b/arch/arm64/include/asm/archrandom.h
> index 109e2a4454be..8a059a9033af 100644
> --- a/arch/arm64/include/asm/archrandom.h
> +++ b/arch/arm64/include/asm/archrandom.h
> @@ -58,6 +58,16 @@ static inline bool __arm64_rndrrs(unsigned long *v)
>  	return ok;
>  }
>  
> +static __always_inline bool __cpu_has_rng(void)
> +{
> +	if (!system_capabilities_finalized()) {
> +		/* Open code as we run prior to the first call to cpufeature. */
> +		unsigned long ftr = read_sysreg_s(SYS_ID_AA64ISAR0_EL1);
> +		return (ftr >> ID_AA64ISAR0_EL1_RNDR_SHIFT) & 0xf;
> +	}
> +	return cpus_have_const_cap(ARM64_HAS_RNG);
> +}

We need to be careful with this check as it is only valid on the CPU it
was called on. Is the result used only on this CPU and with the
preemption disabled? We have big.LITTLE systems where CPUs may differ
and the ARM64_HAS_RNG feature may not be enabled once all the CPUs have
been initialised (capabilities finalised).

We could make this capability an ARM64_CPUCAP_BOOT_CPU_FEATURE, though
I'd have to check whether any systems in the wild have such mixed CPUs.

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ