Skip to content

RDSEED support for the Linux kernel

H. Peter Anvin lkml 2 versions – Applied

Status from this message: Thanks, applied to the random.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 3 repliesApplied
  2. v13 patches 3 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4x86, random: Enable the RDSEED instructionarch/powerpc/include/asm/archrandom.h arch/x86/include/asm/archrandom.h include/linux/random.h+50 -10 replies
2/4random: Use arch_get_random_seed*() at init time and once a seconddrivers/char/random.c+20 -40 replies
3/4random: If we have arch_get_random_seed*(), try it before blockingdrivers/char/random.c+33 -00 replies
4/4random: Add arch_has_random[_seed]()arch/powerpc/include/asm/archrandom.h arch/x86/include/asm/archrandom.h drivers/char/random.c +1 more+23 -02 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchIngo Molnar
1/4R-b
2/4R-b
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] RDSEED support for the Linux kernel

Upcoming Intel silicon adds a new RDSEED instruction. Whereas RDRAND returns output from a PRNG, the RDSEED instruction returns fully conditioned entropy that is suitable for use as seeds to a PRNG.

This patchset adds support for RDSEED in the Linux kernel in three places:

1. During bootup, use RDSEED to initialize the entropy pool if available (we already use RDRAND for this). We don't add any credit at this point, but it will give much better starting point.

2. In the slow path to add_interrupt_randomness, executed once per second, we take a single RDSEED sample and mix it into the entropy pool, crediting it at 50% of its rated entropy. This was suggested by Linus.

3. If we are about to block on /dev/random due to lack of entropy, attempt an "emergency pool refill" using RDSEED.

Changes since version 1:

a. Rebased on top of random.git:dev.
b. Unbreak the PowerPC build (I had managed to miss that PowerPC had
grown archrandom.h support.)
c. Remove duplicate dummy function definitions in <linux/random.h>. d. Add a fourth patch containing a microoptimization: avoid the loop
in arch_random_refill() if arch_get_random_seed*() is unavailable.

Comments are, of course, appreciated.

Ted, if you are OK with this could you add this to random.git:dev so linux-next can pick it up?

-hpa