mbox series

[v4,00/11] rerandomize RNG seeds on reboot and handle record&replay

Message ID 20221025004327.568476-1-Jason@zx2c4.com (mailing list archive)
Headers show
Series rerandomize RNG seeds on reboot and handle record&replay | expand

Message

Jason A. Donenfeld Oct. 25, 2022, 12:43 a.m. UTC
When the system reboots, the rng seed that QEMU passes should be
re-randomized, so that the new boot gets a new seed. This series wires
that up for FDT.

Then, since the record&replay subsystem makes use of reset as well, we
add a new reset cause for record&replay, so that we can avoid
re-randomizing in these cases.

Version 4 prevents the new reset type from leaking over QAPI, documents
this alongside which version it was introduced, and adds mips and m68k
machine types to the queue.

Jason A. Donenfeld (11):
  reset: allow registering handlers that aren't called by snapshot
    loading
  device-tree: add re-randomization helper function
  x86: do not re-randomize RNG seed on snapshot load
  arm: re-randomize rng-seed on reboot
  riscv: re-randomize rng-seed on reboot
  m68k/virt: do not re-randomize RNG seed on snapshot load
  m68k/q800: do not re-randomize RNG seed on snapshot load
  mips/boston: re-randomize rng-seed on reboot
  mips/malta: pass RNG seed via env var and re-randomize on reboot
  openrisc: re-randomize rng-seed on reboot
  rx: re-randomize rng-seed on reboot

 hw/arm/aspeed.c              |  4 ++--
 hw/arm/boot.c                |  2 ++
 hw/arm/mps2-tz.c             |  4 ++--
 hw/core/reset.c              | 15 ++++++++++++++-
 hw/hppa/machine.c            |  4 ++--
 hw/i386/microvm.c            |  4 ++--
 hw/i386/pc.c                 |  6 +++---
 hw/i386/x86.c                |  2 +-
 hw/m68k/q800.c               | 33 +++++++++++++--------------------
 hw/m68k/virt.c               | 20 +++++++++++---------
 hw/mips/boston.c             |  3 +++
 hw/mips/malta.c              | 25 +++++++++++++++++++++++++
 hw/openrisc/boot.c           |  3 +++
 hw/ppc/pegasos2.c            |  4 ++--
 hw/ppc/pnv.c                 |  4 ++--
 hw/ppc/spapr.c               |  4 ++--
 hw/riscv/boot.c              |  3 +++
 hw/rx/rx-gdbsim.c            |  3 +++
 hw/s390x/s390-virtio-ccw.c   |  4 ++--
 include/hw/boards.h          |  2 +-
 include/sysemu/device_tree.h |  9 +++++++++
 include/sysemu/reset.h       |  5 ++++-
 migration/savevm.c           |  2 +-
 qapi/run-state.json          |  5 ++++-
 softmmu/device_tree.c        | 21 +++++++++++++++++++++
 softmmu/runstate.c           | 11 ++++++++---
 26 files changed, 145 insertions(+), 57 deletions(-)

Comments

Peter Maydell Oct. 25, 2022, 4:39 p.m. UTC | #1
On Tue, 25 Oct 2022 at 01:43, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> When the system reboots, the rng seed that QEMU passes should be
> re-randomized, so that the new boot gets a new seed. This series wires
> that up for FDT.
>
> Then, since the record&replay subsystem makes use of reset as well, we
> add a new reset cause for record&replay, so that we can avoid
> re-randomizing in these cases.
>
> Version 4 prevents the new reset type from leaking over QAPI, documents
> this alongside which version it was introduced, and adds mips and m68k
> machine types to the queue.
>
> Jason A. Donenfeld (11):
>   reset: allow registering handlers that aren't called by snapshot
>     loading
>   device-tree: add re-randomization helper function
>   x86: do not re-randomize RNG seed on snapshot load
>   arm: re-randomize rng-seed on reboot
>   riscv: re-randomize rng-seed on reboot
>   m68k/virt: do not re-randomize RNG seed on snapshot load
>   m68k/q800: do not re-randomize RNG seed on snapshot load
>   mips/boston: re-randomize rng-seed on reboot
>   mips/malta: pass RNG seed via env var and re-randomize on reboot
>   openrisc: re-randomize rng-seed on reboot
>   rx: re-randomize rng-seed on reboot

Hi; I've taken all of these except the mips/malta patch into
target-arm.next. I have some comments on that one but I
don't see any reason to hold up the rest of these while we
sort those out.

thanks
-- PMM
Jason A. Donenfeld Oct. 25, 2022, 4:53 p.m. UTC | #2
On Tue, Oct 25, 2022 at 05:39:27PM +0100, Peter Maydell wrote:
> On Tue, 25 Oct 2022 at 01:43, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > When the system reboots, the rng seed that QEMU passes should be
> > re-randomized, so that the new boot gets a new seed. This series wires
> > that up for FDT.
> >
> > Then, since the record&replay subsystem makes use of reset as well, we
> > add a new reset cause for record&replay, so that we can avoid
> > re-randomizing in these cases.
> >
> > Version 4 prevents the new reset type from leaking over QAPI, documents
> > this alongside which version it was introduced, and adds mips and m68k
> > machine types to the queue.
> >
> > Jason A. Donenfeld (11):
> >   reset: allow registering handlers that aren't called by snapshot
> >     loading
> >   device-tree: add re-randomization helper function
> >   x86: do not re-randomize RNG seed on snapshot load
> >   arm: re-randomize rng-seed on reboot
> >   riscv: re-randomize rng-seed on reboot
> >   m68k/virt: do not re-randomize RNG seed on snapshot load
> >   m68k/q800: do not re-randomize RNG seed on snapshot load
> >   mips/boston: re-randomize rng-seed on reboot
> >   mips/malta: pass RNG seed via env var and re-randomize on reboot
> >   openrisc: re-randomize rng-seed on reboot
> >   rx: re-randomize rng-seed on reboot
> 
> Hi; I've taken all of these except the mips/malta patch into
> target-arm.next. I have some comments on that one but I
> don't see any reason to hold up the rest of these while we
> sort those out.

Too bad. Philippe does not respond to my emails, so no discussion has
been possible. If you or someone more responsive would like to take over
in that discussion, that'd be great. Let's talk.

Jason