From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E49D2C433FE for ; Sat, 1 Oct 2022 13:15:28 +0000 (UTC) Received: from localhost ([::1]:59038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oecL1-0000in-Ip for qemu-devel@archiver.kernel.org; Sat, 01 Oct 2022 09:15:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oecJl-0008SP-Tj for qemu-devel@nongnu.org; Sat, 01 Oct 2022 09:14:09 -0400 Received: from hsmtpd-def.xspmail.jp ([202.238.198.237]:50934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oecJk-00041S-5s for qemu-devel@nongnu.org; Sat, 01 Oct 2022 09:14:09 -0400 X-Country-Code: JP Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) by hsmtpd-out-1.asahinet.cluster.xspmail.jp (Halon) with ESMTPA id 7b15c719-9a7f-4ee3-aed4-7f93b05a2757; Sat, 01 Oct 2022 22:13:59 +0900 (JST) Received: from SIOS1075.ysato.ml (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id DBA111C0075; Sat, 1 Oct 2022 22:13:57 +0900 (JST) Date: Sat, 01 Oct 2022 22:13:55 +0900 Message-ID: <87zgef1yb0.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: "Jason A. Donenfeld" Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: Re: [PATCH 5/6] rx: re-randomize rng-seed on reboot In-Reply-To: <20220929232339.372813-5-Jason@zx2c4.com> References: <20220929232339.372813-1-Jason@zx2c4.com> <20220929232339.372813-5-Jason@zx2c4.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Received-SPF: softfail client-ip=202.238.198.237; envelope-from=ysato@users.sourceforge.jp; helo=hsmtpd-def.xspmail.jp X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 30 Sep 2022 08:23:38 +0900, Jason A. Donenfeld wrote: > > When the system reboots, the rng-seed that the FDT has should be > re-randomized, so that the new boot gets a new seed. Since the FDT is in > the ROM region at this point, we add a hook right after the ROM has been > added, so that we have a pointer to that copy of the FDT. > > Cc: Yoshinori Sato > Signed-off-by: Jason A. Donenfeld > --- > hw/rx/rx-gdbsim.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c > index 8ffe1b8035..198d048964 100644 > --- a/hw/rx/rx-gdbsim.c > +++ b/hw/rx/rx-gdbsim.c > @@ -25,6 +25,7 @@ > #include "hw/rx/rx62n.h" > #include "sysemu/qtest.h" > #include "sysemu/device_tree.h" > +#include "sysemu/reset.h" > #include "hw/boards.h" > #include "qom/object.h" > > @@ -148,6 +149,8 @@ static void rx_gdbsim_init(MachineState *machine) > dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16); > rom_add_blob_fixed("dtb", dtb, dtb_size, > SDRAM_BASE + dtb_offset); > + qemu_register_reset(qemu_fdt_randomize_seeds, > + rom_ptr(SDRAM_BASE + dtb_offset, dtb_size)); > /* Set dtb address to R1 */ > RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset; > } > -- > 2.37.3 > Reviewed-by: Yoshinori Sato -- Yosinori Sato