[External Mail]Re: [RFC] um: reproducible randomness for time-travel tests

Johannes Berg johannes at sipsolutions.net
Thu Nov 19 05:16:47 PST 2026


Hi Lingao,

> In BSWorld, we run BlueZ in a 32-bit UML guest with time-travel=ext.

Right, =ext to integrate with a scheduler for whatever transport, and
multiple machines, presumably.

> We preload a small shared library into the UML process to intercept
> the host libc's getrandom().

Ah, OK.

> The harness derives a seed from the guest
> label. We also reuse the same kernel build and read-only rootfs,

Right, read-only rootfs simplifies some things over hostfs.

> disable CONFIG_UML_RANDOM, and keep the boot command line stable,

Ah right, command line stable is another thing - we had to resort to
mount namespaces IIRC.

> including the HCI serial file descriptor.

:) That's an extra quirk you have, we use virtio, so there's no FD on
the commandline.

> https://github.com/XiaoMi/bsworld
> https://github.com/XiaoMi/bsworld/blob/d809b998fd42866bd94cddd05edcc0a0b99428a7/src/bsworld/uml/getrandom.c

That looks fairly similar to what we have, just implemented outside
instead of patching.

> We compared two runs in the same image and got byte-identical HCI and
> over-the-air captures for the BlueZ cases. That's the scope of our
> reproducibility check.

Ah OK. We actually did (at some point in the past at least) validate
that /dev/urandom returns the same stream :) But I guess BT would also
have keys derived etc. that depends on that anyway.

> The awkward part is that we have to build a separate 32-bit shared
> library and rely on UML calling the interposable libc symbol. The shim
> fixes the bytes UML gets from the host through that call. The guest
> RNG still mixes in other inputs, including the kernel build
> information, command line, and interrupt timing you mentioned.

Right.

> Would it make sense to start with the os_getrandom() seed from your
> list, enabled only when a seed is explicitly supplied for a
> time-travel boot? If your patch is available, I'd be happy to try it
> against our BlueZ tests.

I'll just send all of our related patches, there's no real secret here,
we just didn't think anyone would care, and didn't bother polishing the
changes enough to be upstreamable :)

johannes



More information about the linux-um mailing list