Linux Kernel 5.18.8: tiny RNG improvement

The PowerPC architecture receives a tiny improvement for the hypervisor-backed random generation.

As we pointed out previously, the kernel random generator (RNG) is a complex engine that needs to be initialized properly, especially if we need to get high quality random numbers very early during boot time. Until the system gets more entropy from input events, interrupts and other random-looking actions, it remains highly dependent in how the RNG is "seeded".

Though Linux kernel has wide support for PowerPC hardware types, like Sony PS3, this particular change addresses the so-called pseries machine type which includes IBM pSeries and new POWER5-based IBM iSeries servers. For these machines, Linux can be run in partitioned mode where the server's firmware contains a hypervisor that executes one ore more guest virtual machines, where a guest machine runs AIX or Linux in a logical partition (LPAR). In this mode, this the hypervisor that loads the kernel into memory.

Running Linux directly on Power hardware is also supported, but on a limited set of models (typically, pSeries). In this mode, the Linux kernel is loaded directly by a bootloader. We won't talk about it here.

So, when run under the Power hypervisor, the guest OS can request certain useful services, very similar to how EFI provides services for x86 platforms. Each service has its name and opcode. One of the types of services is to get a 64-bit trusted random number and its codename is H_RANDOM.

The change is about installing a proper callback function in the right place so that the kernel can benefit from getting a trusted random number early on boot time.

Useful Links