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: <20250312163234.GEZ9G3IsDW1wxGWs7f@fat_crate.local>
Date: Wed, 12 Mar 2025 17:32:34 +0100
From: Borislav Petkov <bp@...en8.de>
To: Mikhail Paulyshka <me@...aill.net>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] x86/rdrand: implement sanity check for RDSEED

On Wed, Mar 12, 2025 at 03:31:29PM +0300, Mikhail Paulyshka wrote:
> +/*
> + * RDSEED has Built-In-Self-Test (BIST) that runs on every invocation.
> + * Run the instruction a few times as a sanity check. Also make sure
> + * it's not outputting the same value over and over, which has happened
> + * as a result of past CPU bugs.
> + *
> + * If it fails, it is simple to disable RDSEED here.
> + */
> +
> +void x86_init_rdseed(struct cpuinfo_x86 *c)
> +{
> +	unsigned long sample, prev;
> +	bool failure = false;
> +	size_t i, changed;
> +
> +	if (!cpu_has(c, X86_FEATURE_RDSEED))
> +		return;
> +
> +	for (changed = 0, i = 0; i < SAMPLES; ++i) {
> +		if (!rdseed_long(&sample)) {
> +			failure = true;
> +			break;
> +		}
> +		changed += i && sample != prev;
> +		prev = sample;
> +	}
> +	if (changed < MIN_CHANGE)
> +		failure = true;
> +
> +	if (failure) {
> +		clear_cpu_cap(c, X86_FEATURE_RDSEED);
> +		pr_emerg("RDSEED is not reliable on this platform; disabling.\n");
> +	}
> +}

This one basically duplicates x86_init_rdrand() and I'm sure you can use
a single function to test both.

But more importantly, lemme ask around internally whether that is even
a reliable test to detect RDSEED performs properly or not.

Stay tuned...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ