[RFC] um: reproducible randomness for time-travel tests
Johannes Berg
johannes at sipsolutions.net
Thu Nov 19 04:47:22 PST 2026
Hi,
> We use UML's time-travel mode for Bluetooth(BlueZ) integration tests. To make
> runs reproducible, we currently use an LD_PRELOAD shim to control the
> random data that the UML kernel obtains from the host.
Interesting. We do that for WiFi and have a number of patches to make
/dev/random reproducible :)
> Would UML accept an opt-in way to supply reproducible random input for
> time-travel tests? Normal boots would continue to use host randomness.
> I'd appreciate feedback on the scope and interface before preparing a
> patch.
It's a good question - thing is that it's fairly involved, and somewhat
difficult to maintain? In fact, I'm surprised you managed to make it
work with LD_PRELOAD, given that we patch out:
- interrupt random source (basically stub add_interrupt_randomness,
otherwise signal timing from the host can affect it)
- utsname (in random_init_early) because the build time is there
- os_getrandom() to take a seed from environment
(probably the least controversial patch here)
- not directly affecting random, but reproducibility, we sort hostfs
directory entries so that their host order doesn't affect tests
- similarly, dentry allocation in hostfs
- similarly, patch hostfs to retry on EINTR (this is actually a bugfix
we should probably upstream?)
- similarly, some hostfs patch for updating the host inode timestamps
when a file is closed (marked as needing extra work for non-TT) and
setting timestamps on file creation
- some patches to force out CRYPTO_JITTERENTROPY which doesn't work,
but that may no longer be necessary and just historic
I don't conceptually object to having these upstream, specially if
there's another user (you) actually interested in reproducibility, but
some of these might need work. Benjamin can maybe comment better on many
of these.
johannes
More information about the linux-um
mailing list