On 23/8/23 12:06, Greg KH wrote:
On Wed, Aug 23, 2023 at 11:27:11AM +0200, Babis Chalios wrote:
Hi Greg,What 32bit platforms care about this type of interface at all?
On 23/8/23 11:08, Greg KH wrote:
We made it 32 bits so that we can read/write it atomically in all 32bit
On Wed, Aug 23, 2023 at 11:01:05AM +0200, Babis Chalios wrote:
Sometimes, PRNGs need to reseed. For example, on a regular timerWhy not just use 32/32 for a full 64bit value, or better yet, 2
interval, to ensure nothing consumes a random value for longer than e.g.
5 minutes, or when VMs get cloned, to ensure seeds don't leak in to
clones.
The notification happens through a 32bit epoch value that changes every
time cached entropy is no longer valid, hence PRNGs need to reseed. User
space applications can get hold of a pointer to this value through
/dev/(u)random. We introduce a new ioctl() that returns an anonymous
file descriptor. From this file descriptor we can mmap() a single page
which includes the epoch at offset 0.
random.c maintains the epoch value in a global shared page. It exposes
a registration API for kernel subsystems that are able to notify when
reseeding is needed. Notifiers register with random.c and receive a
unique 8bit ID and a pointer to the epoch. When they need to report a
reseeding event they write a new epoch value which includes the
notifier ID in the first 8 bits and an increasing counter value in the
remaining 24 bits:
RNG epoch
*-------------*---------------------*
| notifier id | epoch counter value |
*-------------*---------------------*
8 bits 24 bits
different variables? Why is 32bits and packing things together here
somehow simpler?
architectures.
Do you think that's not a problem?
I think, any 32bit platform that gets random bytes from the kernel.