From patchwork Tue Oct 25 16:39:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 618126 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3520025pvb; Tue, 25 Oct 2022 09:49:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QD6B6zB3LKnVAAyK3U++7JfbxskhOnXhNYeo5iDvDFpsCeeQke/oVrNM03kerObPirV0a X-Received: by 2002:a05:6214:ac6:b0:4ba:170c:1920 with SMTP id g6-20020a0562140ac600b004ba170c1920mr21653233qvi.35.1666716547702; Tue, 25 Oct 2022 09:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666716547; cv=none; d=google.com; s=arc-20160816; b=bk2PXD2NKNmfP9Ke6CzqHZfC9attNSFKWphnHD59VjQW9rTVYW6+CvW1v3lrD+fIHL abCFaPtkdm7P2WOE6hCNJVGzebhnyq5uZEP1HGVInHJx8NLdSvUkvC7VQSehI+NkE5bc uUk+WwQUR8iG6+XggSZEci4SBEeRWHsAznGk/Ibw8MqU/TnNkmVw00LrmqBdLO81IVVh lIjyb1uUR8ejjcKtMi9DH4KRCE4Ai9j3ANA7u6qz5kVKPxOnqZ+0eb67KFe5n4zMT6M+ XaS2jLrL+bV9bHD49fnhHghufzR4DiBSHJLinlQA7zq3usx34ELgWcLDA/WAAXzjlN7e +zAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Eln4ge06npuUpSMBwWAzr3VNU4hXMayNTGSGJ/gD114=; b=jawm6WPJW6vnUFFfPKcPZkG5OXdT604TexWK5jHloIgoECze17hURpKn2eRZn3l240 rixfWZKUR7WuAgT4xZGVMdv+XevJKHh4F6p0h3XvFin1ng+ETHkG8IZbFVnA8akZ+ECe ZLDGnNSAnoi7tjgZm+ovNsx7qpHEQvHfYSgcKuZhjz0Ktx+HQbHWjxF8xxBFOCNtvHLY K4OpTi9rZvyVJc4StM9csWzZzYZ01zOwYbeGOvrNeCr8k8eQXMz/fwMW86WMn2G3aKP1 RfgqgITilY8S77Xom5inTw8HKJ4B14EMD1Cj/zVWnOcRY1JkqED+Qb0JUWSbiXZqza0k eVTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BI0z7qfQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l21-20020a05622a175500b0039796437571si2276751qtk.739.2022.10.25.09.49.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2022 09:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BI0z7qfQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onMzf-0007Ua-9l; Tue, 25 Oct 2022 12:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onMz1-0006e0-7n for qemu-devel@nongnu.org; Tue, 25 Oct 2022 12:40:55 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onMyf-0001km-LL for qemu-devel@nongnu.org; Tue, 25 Oct 2022 12:40:50 -0400 Received: by mail-wr1-x432.google.com with SMTP id bs21so6188375wrb.4 for ; Tue, 25 Oct 2022 09:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Eln4ge06npuUpSMBwWAzr3VNU4hXMayNTGSGJ/gD114=; b=BI0z7qfQhZWPTltWMDsSY5di33s5cPeKHWgi5xTObpmqyYVM20k/xF6bl26N9oHQOQ R4TvZml04Yp4xNxZUwqma5WyEDbc2NGYm4EWf50R7Z0vXtooNE4tadhsP3KNZwOln1yH ifC784TLE65j2S9Ly32+pD/I2h7Rv1nFpLO818P6kmCmuhy/UEvwo4EaNCEKAIwZOOXT AbMpR089TM+iORgrblHvJNtHpzXQU9pFKM4PzNf0aCHy4q2uHlNa08l07HCyzlJVWl9N 8tZRx1QZHxVrJbSlsplM1YYnn4v4/ViUyeQ4t2CxFTBmw6qxKrB2hI/ViHtuCEgOqfr9 JCxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Eln4ge06npuUpSMBwWAzr3VNU4hXMayNTGSGJ/gD114=; b=wDkaYtGjSsjCKoR37g4I8TuEhdMPT/4wtvKo7SJGKg84F0NS8h7dLtV4o49P9DOwvu I4RmGKiuOeYNBBvuPAL+fOpI/jOYXBslyPzbqd5DWVIgUSxugQyc7GC8PuvTkKBc13qt R9/Ut1gyULV13xyBkup93okh7fn5lnRHJlEuqqh9hH12mIbgpi1+wK1oFIe+tsuXd4I6 4MLtiGkJU0F3gGSUc0pJcOphQN6lEaeplHxA5OJ5ffWFjmrJ8IGkKqKd9DKypvULAKth ei3sakj5RsYNAgV3w7MVopR5nE8NeOrdT6SnUgvvPzdDr2gPKbGeGGJxBAF9w5llOQ+h F4Tg== X-Gm-Message-State: ACrzQf3Yl8w+XV5iLV0CFRzLDiSlxM2ar/JTjHy4jmgRXsibGmpDM17M k0KbyxPYdIqpuwh3Lwo2HWanWgsha7nPXg== X-Received: by 2002:a05:6000:1143:b0:236:5ede:cdad with SMTP id d3-20020a056000114300b002365edecdadmr12723586wrx.410.1666716022828; Tue, 25 Oct 2022 09:40:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z12-20020a05600c220c00b003cd9c26a0basm2971084wml.40.2022.10.25.09.40.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 09:40:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/30] arm: re-randomize rng-seed on reboot Date: Tue, 25 Oct 2022 17:39:46 +0100 Message-Id: <20221025163952.4131046-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025163952.4131046-1-peter.maydell@linaro.org> References: <20221025163952.4131046-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org From: "Jason A. Donenfeld" 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: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Jason A. Donenfeld Message-id: 20221025004327.568476-5-Jason@zx2c4.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/boot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index b0b92af1889..b106f314685 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -683,6 +683,8 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, * the DTB is copied again upon reset, even if addr points into RAM. */ rom_add_blob_fixed_as("dtb", fdt, size, addr, as); + qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds, + rom_ptr_for_as(as, addr, size)); g_free(fdt);