From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Thiago Macieira <thiago.macieira@intel.com>
Cc: Borislav Petkov <bp@alien8.de>,
Christopher Snowhill <chris@kode54.net>,
Gregory Price <gourry@gourry.net>,
x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de,
mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com,
peterz@infradead.org, mario.limonciello@amd.com,
riel@surriel.com, yazen.ghannam@amd.com, me@mixaill.net,
kai.huang@intel.com, sandipan.das@amd.com, darwi@linutronix.de,
stable@vger.kernel.org
Subject: Re: [PATCH v2] x86/amd: Disable RDSEED on AMD Zen5 because of an error.
Date: Wed, 5 Nov 2025 02:58:36 +0100 [thread overview]
Message-ID: <aQqvTGblMoKkRK1j@zx2c4.com> (raw)
In-Reply-To: <4632322.0HT0TaD9VG@tjmaciei-mobl5>
Hi Thiago,
On Tue, Nov 04, 2025 at 03:50:37PM -0800, Thiago Macieira wrote:
> Strictly speaking, if you don't have getentropy(), the fallback will be
> compiled in, in case someone runs the application is a messed up environment
> with /dev improperly populated. In practice, that never happens and
> getentropy() appeared in glibc 2.25, which is now older than the oldest distro
> we still support.
Great, so I suppose you can entirely remove /dev/[u]random support then.
> But I don't want to deal with bug reports for the other operating systems Qt
> still supports (QNX, VxWorks, INTEGRITY) for which I have no SDK and for which
> even finding man pages is difficult. I don't want to spend time on them,
> including that of checking if they always have /dev/urandom. There are people
> being paid to worry about those. They can deal with them.
Ahhh. It'd be nice to gate this stuff off carefully, and maybe use a
real hash function too.
> Indeed. Linux is *impressively* fast in transitioning to kernel mode and back.
> Your numbers above are showing getrandom() taking about 214 ns, which is about
> on par what I'd expect for a system call that does some non-trivial work.
> Other OSes may be an order of magnitude slower, placing them on the other side
> of RDRAND (616 ns).
>
> Then I have to ask myself if I care. I've been before in the situation where I
> just say, "Linux can do it (state of the art), so complain to your OS vendor
> that yours can't". Especially as it also simplifies my codebase.
Well, if you want performance consistency, use arc4random() on the BSDs,
and you'll avoid syscalls. Same for RtlGenRandom on Windows. These will
all have similar performance as vDSO getrandom() on Linux, because they
live in userspace. Or use the getentropy() syscall on the BSDs and trust
that it's still probably faster than RDRAND, and certainly faster than
RDSEED.
> QRandomGenerator *can* be used as a deterministic generator, but that's
> neither global() nor system(). Even though global() uses a DPRNG, it's always
> seeded from system(), so the user can never control the initial seed and thus
> should never rely on a particular random sequence.
>
> The question remaining is whether we should use the system call for global()
> or if we should retain the DPRNG. This is not about performance any more, but
> about the system-wide impact that could happen if someone decided to fill in a
> couple of GB of of random data. From your data, that would only take a couple
> of seconds to achieve.
Oh yea, good question. Well, with every major OS now having a mechanism
to skip syscalls for random numbers, I guess you could indeed just alias
global() to system() and call it a day. Then users really cannot shoot
themselves in the foot. That would be simpler too. Seems like the best
option.
> From everything I could read at the time, the MT was cryptographically-secure
> so long as it had been cryptographically-securely seeded in the first place. I
> have a vague memory of reading a paper somewhere that the MT state can be
> predicted after a few entries, but given that it has a 624*32 = 10368 bit
> internal state I find that hard to believe.
I suppose it's linear in F2.
> > 1) New microcode
> >
> > 2) Fix all source code to either use the 64bit variant of RDSEED
> > or check the result for 0 and treat it like RDSEED with CF=0
> > (fail) or make it check the CPUID bit....
>
> Or 3) recompile the code with the runtime detection enabled.
>
> It's a pity that Qt always uses the 64-bit variant, so it would have worked
> just fine.
4) Fix Qt to use getrandom().
Jason
next prev parent reply other threads:[~2025-11-05 1:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 2:40 [PATCH v2] x86/amd: Disable RDSEED on AMD Zen5 because of an error Gregory Price
2025-10-18 10:03 ` Borislav Petkov
2025-10-19 14:46 ` Jason A. Donenfeld
2025-10-19 15:00 ` Borislav Petkov
2025-10-19 15:03 ` Jason A. Donenfeld
2025-11-03 10:22 ` Christopher Snowhill
2025-11-03 12:03 ` Borislav Petkov
2025-11-03 23:55 ` Christopher Snowhill
2025-11-04 13:21 ` Borislav Petkov
2025-11-04 14:28 ` Jason A. Donenfeld
2025-11-04 15:00 ` Jason A. Donenfeld
2025-11-04 18:08 ` Thiago Macieira
2025-11-04 21:56 ` Jason A. Donenfeld
2025-11-04 23:50 ` Thiago Macieira
2025-11-05 1:58 ` Jason A. Donenfeld [this message]
2025-11-05 16:41 ` Thiago Macieira
2025-11-07 19:13 ` Jason A. Donenfeld
2025-11-07 19:55 ` Thiago Macieira
2025-11-07 23:07 ` Jason A. Donenfeld
2025-11-07 23:11 ` Thiago Macieira
2025-11-08 0:04 ` Jason A. Donenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQqvTGblMoKkRK1j@zx2c4.com \
--to=jason@zx2c4.com \
--cc=bp@alien8.de \
--cc=chris@kode54.net \
--cc=darwi@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=gourry@gourry.net \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=me@mixaill.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=sandipan.das@amd.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=thiago.macieira@intel.com \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox