conv.

All stories
TechActive · 46h

AMD's RDRAND16 instruction can't generate zero on some Zen CPUs

Users discover AMD processors skip 0 when generating 16-bit random numbers, a flaw that evaded hardware validation.

What to know

  • AMD's RDRAND16 instruction on Zen 2 and some Zen 3 CPUs never generates zero values, instead falsely signaling an error condition.
  • The flaw appears to be in the carry-flag logic, not the underlying entropy generator—the instruction produces zero internally but discards it via incorrect error signaling.
  • The bug has limited real-world impact; cryptographic code seeds software CSPRNGs with hardware randomness rather than using it directly.
  • This is at least the second known RDRAND defect on Zen 2 (a prior bug generated all 1s); AMD has released security bulletin SB-7055 acknowledging the issue.

The dispute Whether the bug was fixed after Zen 2 or persists into Zen 3—one Zen 3 user could not reproduce it while another on a later Zen 3 chip reported generating zeros normally. · positions read across 19 posts and comments

many voices

The bug is real but has minimal practical impact because crypto code uses hardware RNG only as a seed for software CSPRNGs.

  • “Embarrassing, but probably little practical impact, since these hardware random numbers are typically not used directly and instead seed a CSPRNG.”

    CodesInChaos · Hacker News ↗
some voices

The bug's existence and escape through validation raises questions about AMD's testing rigor.

  • “I always wonder how hardware bugs like this happen with the sheer amount of hardware validation that's done. It'd be fascinating to know how it slipped through the cracks, though I know almost nothing about this side of the industry sadly”

    20k · Hacker News ↗
many voices

The bug is specific to RDRAND16; 32-bit and 64-bit variants appear unaffected, and the flaw stems from carry-flag misbehavior rather than entropy failure.

  • “OK, update, I can reproduce it with rdrand16, rdrand32 is fine but rdrand16 can never generate all 0s.”

    jstanley · Hacker News ↗

jstanley Zen 2 CPU owner, bug reproducer0x000xca0xfe Hardware/cryptography developerAMD CPU manufacturer

How it unfolded 4 developments, newest first · click a bar or a number to jump articlespostscomments

Peak 6 pieces in one hour at Sep 22, 6 AM; 23 pieces over 47 hours (2 articles · 3 posts · 18 comments) Sep 22, 3 AM — 3 pieces · 2 articles · 1 post — Newswires 2, Hacker News 1Sep 22, 4 AM — quietSep 22, 5 AM — 4 pieces · 4 comments — Hacker News 4Sep 22, 6 AM — 6 pieces · 6 comments — Hacker News 6Sep 22, 7 AM — 1 piece · 1 comment — Hacker News 1Sep 22, 8 AM — 1 piece · 1 comment — Hacker News 1Sep 22, 9 AM — 1 piece · 1 comment — Hacker News 1Sep 22, 10 AM — quietSep 22, 11 AM — 1 piece · 1 comment — Hacker News 1Sep 22, 12 PM — 1 piece · 1 post — Mastodon 1Sep 22, 1 PM — 1 piece · 1 post — Mastodon 1Sep 22, 2 PM — quietSep 22, 3 PM — 2 pieces · 2 comments — Hacker News 2Sep 22, 4 PM — quietSep 22, 5 PM — quietSep 22, 6 PM — quietSep 22, 7 PM — quietSep 22, 8 PM — quietSep 22, 9 PM — quietSep 22, 10 PM — quietSep 22, 11 PM — quietYesterday, 12 AM — quietYesterday, 1 AM — quietYesterday, 2 AM — quietYesterday, 3 AM — quietYesterday, 4 AM — quietYesterday, 5 AM — quietYesterday, 6 AM — quietYesterday, 7 AM — quietYesterday, 8 AM — quietYesterday, 9 AM — quietYesterday, 10 AM — quietYesterday, 11 AM — quietYesterday, 12 PM — quietYesterday, 1 PM — quietYesterday, 2 PM — 2 pieces · 2 comments — Hacker News 2Yesterday, 3 PM — quietYesterday, 4 PM — quietYesterday, 5 PM — quietYesterday, 6 PM — quietYesterday, 7 PM — quietYesterday, 8 PM — quietYesterday, 9 PM — quietYesterday, 10 PM — quietYesterday, 11 PM — quietToday, 12 AM — quietToday, 1 AM — quiet 1–4
8 AM4 PMyesterday8 AM4 PMnow · 2:55 AM ET
  1. 4

    Bug identified as carry-flag misfire, not entropy failure

    A commenter clarifies that RDRAND16 likely produces zero correctly internally, but sets the carry flag (CF) to 0 erroneously when zero emerges, causing retry logic to discard the valid result.

    “But it looks like the rdrand16 instruction can produce zeros just fine, it just sets CF=0 erroneously (indicating an error and that the user program should retry).”
    — 0x000xca0xfe
    • Really interesting and surprising article. As a workaround, if you're skeptical about an RNG you can implement an algorithm using AES-CTR and putting some entropy in by hand, like mashing on the keyboard a lot. (Like, a lot though.) You can then keep encrypting it, returning some of the ciphertext as the "random" values and rekeying with the rest…

      logicalleeHacker News1d agoview on Hacker News ↗
    2 more of the top 3 · 9 posts in this stretch
    • atoponce@fosstodon.org

      AMD's random number generator (RDSEED, RDRAND) cannot generate a 0. https:// board.flatassembler.net/topic. php?t=24261 # crypto # cryptography

      atoponce@fosstodon.orgMastodon1d agoview on Mastodon ↗
    • Not sure if this finding is new, but the author from FASM Thread apparently has a Zen 2 (He doesn't directly mention anything besides "Ryzen 7", some other poster mentions it is a 4800HS). There were a number of articles about RDRAND being broken on Zen 2 and earlier generations but fixed via Microcode from about 6 years…

      zir_blazerHacker News1d agoview on Hacker News ↗
    all of them →
  2. background

    Users discover RDRAND16 bug across AMD Zen processors — Developers on Hacker News report testing AMD's RDRAND16 instruction and finding it unable to generate zero values on Zen 2 and some Zen 3 CPUs. One user on a Ryzen 5 3600 (Zen 2) confirmed the bug; another on a Zen 4 (7840U) could not reproduce it.

  3. 3

    Zen 4 user reproduces no issue with RDRAND16

    A Zen 4 user (7840U) runs a test with GCC intrinsics and confirms zero values generate normally on that architecture, showing the bug is not universal across all Zen generations.

    • Zen 4 reporting in. I'm unable to reproduce it (7840U). $ ./a.out | rg '\b\-?\d\b' | sort -n | uniq -c 15281 -2 15192 -1 15273 0 15243 1 15269 2 I used the GCC intrinsic ( _rdrand16_step ), #include <immintrin.h> short rdrand16() { // gcc -mrdrnd short ret; while (1 != _rdrand16_step(&ret)) { } return ret; }

      peri-clHacker News1d agoview on Hacker News ↗
    1 more of the top 2 · 2 posts in this stretch
    • I have a couple questions:Looks like they tried 16-bit numbers. Does the odd behavior happen also on 32 and 64 (might take a long time to check - I'd start scratching my head after a couple hundred years of no zeroes) ones? Is the zero masking as some other fixed number, increasing its output count? Is RDRAND implemented as multiple reads of an…

      rbanffyHacker News1d agoview on Hacker News ↗
    all of them →
  4. 2

    AMD security bulletin disclosed for hardware RNG flaw

    An AMD security bulletin (SB-7055) is cited as official acknowledgment of the RDRAND16 issue.

    “I always wonder how hardware bugs like this happen with the sheer amount of hardware validation that's done. It'd be fascinating to know how it slipped through the cracks, though I know almost nothing about this side of the industry sadly…”
    — 20k, HN commenter · source
    • This is why I use, in security critical contents of my software (where the numbers have to be computationally infeasible to produce), a type of random number generator called an XOF (extendable-output function).It takes entropy from multiple different sources, makes it all input to the XOF, then the XOF uses cryptography to output a stream that…

      strenholmeHacker News1d agoview on Hacker News ↗
    2 more of the top 3 · 5 posts in this stretch
    • I always wonder how hardware bugs like this happen with the sheer amount of hardware validation that's done. It'd be fascinating to know how it slipped through the cracks, though I know almost nothing about this side of the industry sadly

      20kHacker News1d agoview on Hacker News ↗
    • Does rdrand32 and then taking the lowest 16 bits of its result yield any zeroes?Basically I'm wondering if it's a bug in the version of the instruction that writes to a 16-bit reg, or a bug in the underlying RNG

      RandomOnyxHacker News1d agoview on Hacker News ↗
    all of them →
  5. 1

    Zen 3 user reports intermittent zero generation

    A user on Zen 3 reports being able to generate 16-bit zeros, suggesting the bug may have been fixed after Zen 2.

    “I'm getting 16-bit zeros on my Zen 3 chip (+1:3821, 0:3893, -1:3895), I will wait to get some statistically significant samples for the 32-bit values and update the forum thread. Maybe it was fixed after Zen 2?”
    — matja
    • This is not the first RNG bug on Zen 2, I recall after I first got mine that some application or other would quit immediately at startup because rdrand always returned -1, i.e. all 1s. It was fixed with a microcode update.Do we now learn that they fixed "always generate all 1s" with "never generate all 0s"??EDIT: I've been unable to reproduce the…

      jstanleyHacker News1d agoview on Hacker News ↗
    2 more of the top 3 · 3 posts in this stretch
    • I'm getting 16-bit zeros on my Zen 3 chip (+1:3821, 0:3893, -1:3895), I will wait to get some statistically significant samples for the 32-bit values and update the forum thread. Maybe it was fixed after Zen 2?

      matjaHacker News1d agoview on Hacker News ↗
    • Embarrassing, but probably little practical impact, since these hardware random numbers are typically not used directly and instead seed a CSPRNG.

      CodesInChaosHacker News1d agoview on Hacker News ↗
    all of them →

Also covered reported alongside — the timeline has no entry for these yet

  1. first by HN Best, 1d ago · also HN Frontpage

What people are saying 7 voices from 1 site · best of 19 · verbatim

Still unanswered
  • Does the bug affect rdrand32 and rdrand64, or only the 16-bit variant?
  • Was this bug fixed after Zen 2, or does it vary by specific Zen 3 SKU?
  • Why did AMD's hardware validation suite miss a statistically obvious failure in a core security primitive?