From patchwork Tue Oct 25 16:39:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 618141 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3525919pvb; Tue, 25 Oct 2022 10:00:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lmH64Bm3vTGrLR03ftsvjTlIhbzA1RKV13d+lGep0+OqqLfgLXNyyCfl61QJXNuKmCqsp X-Received: by 2002:a05:620a:17a5:b0:6ee:9c6a:208d with SMTP id ay37-20020a05620a17a500b006ee9c6a208dmr27969530qkb.337.1666717243783; Tue, 25 Oct 2022 10:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666717243; cv=none; d=google.com; s=arc-20160816; b=bk6/OBZ8CFRAxIzJLcOf9ySQxmTP2C84YxjYOr34lOj3jS48kAFqH2yEU26gXc7yz8 lpyRT5GsUIjeyFi/XrPwFHubgJDIIqPAz6954A5WHECu0SdYqeEpUsyjM39gnhroJbIs BMNi89y9R500jbCC7M1FWKVVgHdC/tmp+fNMfLZWJADBZPo5y8yWmV+sUfmEnqij3SZ5 O+L+6cpdM737Z72XkVHG2jvMeB444q2LW76vBuDxM0sRaZNaP+KBIYZKUO1eB23wKTHS I3KqaIKGt0iqBU2+eyrtTTJTYcUpFSzUIwjnIVm9zfWxfz5V+JlgejBQtoemDuUW0Zq+ kMIw== 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=Zx92dKbW4mIOFyLLly74Mf4cM2iwFKImdqM4lHqQOyE=; b=CHdDdHwhgQFhQrsisxLQn5iGylQ6HoALPQScPbttsjlUD6CCNka3kIo803v8z1OVYD J+2stn/bxJR+L2Hv+eR4xnfwP0q5W42UFlxLuJrOO3ad3nqKru56rpocqn/DYfHNjltB 6FEv9Xpvni3EPvWOcpNuYR/vACYbHsadCm4gkSa22TWCkfnm0ueS0qVrd31GjHZ9LL7A 4SAMnjJHLi6BMmCOUmb/VGd2Oc56IFqTQA6JwKvx1ZZ016hsl91p3k5g86umC0PMxbEx tjecs2C/W0OAb39JI46no6H8ENKl4JavHHwN59FWTk5OClT8LiydiJ0i5rCQY/L9F302 W+8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tr8hiPJ2; 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 fn6-20020ad45d66000000b004a4bfa1c513si2266650qvb.314.2022.10.25.10.00.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2022 10:00:43 -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=Tr8hiPJ2; 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 1onMze-0007PG-Eo; Tue, 25 Oct 2022 12:41:34 -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-0006ed-B8 for qemu-devel@nongnu.org; Tue, 25 Oct 2022 12:40:55 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onMyf-0001mf-M6 for qemu-devel@nongnu.org; Tue, 25 Oct 2022 12:40:53 -0400 Received: by mail-wr1-x42a.google.com with SMTP id bu30so22089995wrb.8 for ; Tue, 25 Oct 2022 09:40:28 -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=Zx92dKbW4mIOFyLLly74Mf4cM2iwFKImdqM4lHqQOyE=; b=Tr8hiPJ2AX3zJabGsiir7dVeV8v1pYsteXT8GT2b6mjuVTCQ2zv1qYpqtWZIGb8kPS TUsHrGfEDzYYvHkxM2SoZvk7WaTygeV9kQ+vZZjGjEGxu+cqXo+ifYavR9hyGCi6sdQH dcfkfzdCXrAruIUTLneFuEDpog+0SSxFb1HSzVOXzduF+nPO8uNiVYVio97eAi/7hwgh /S+0SR9R+CeboxrkizFhqQIIPx4Dw7QkR6UyQKqK5v502OGkqMMr/80QTfjaIR0sn43t NgU+kz1ktqYYaFOfHJZ+jsgXVPoljOsD02h60n64bKKbuuxnZW9UZ1Ntnrz5Y+QUgCPX 8Gng== 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=Zx92dKbW4mIOFyLLly74Mf4cM2iwFKImdqM4lHqQOyE=; b=aRsiklA38LrsAAM4vi4vbMcK3XfvwcEGC8LjT1JSIxWFfQa/taG1XF83JnKxtNJi0w cZcnfk4w/ckrmK5HwlPpMA1jFCIOZjiPuBO5j1ov0MKccTo/si9CyrmIcWvQsq9bwsum NAij/XJ3sbe0yBtC56RfGtSd1XIjPIZWiFH1x/nTdS99/boDItXHb8P37419g8AC76dm RRzd4JTPEg6mp1EqvYWcbevHIQR3j180q12w3YcBOKpe35Ehj8rfFd8cvH3SpmsPu+69 +06Di9KN3lPhFrCbDDjyLsffclVOnSqAzk6cTyukKV0ptrXYoNVBcFGqV7cKW5N5OvWe rYlw== X-Gm-Message-State: ACrzQf2T6Uv9/Zf+aSYdctvxD1rHOmXW83AUseSBcbdjvVQdK1QvrepI uPnMxpsgqPFtk+baYZpG30FOXsi3ZOLjNg== X-Received: by 2002:a5d:64c7:0:b0:22e:43a6:2801 with SMTP id f7-20020a5d64c7000000b0022e43a62801mr27167355wri.612.1666716027853; Tue, 25 Oct 2022 09:40:27 -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.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 09:40:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/30] openrisc: re-randomize rng-seed on reboot Date: Tue, 25 Oct 2022 17:39:51 +0100 Message-Id: <20221025163952.4131046-30-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::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: Stafford Horne Signed-off-by: Jason A. Donenfeld Message-id: 20221025004327.568476-11-Jason@zx2c4.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/openrisc/boot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/openrisc/boot.c b/hw/openrisc/boot.c index 128ccbcba24..007e80cd5a0 100644 --- a/hw/openrisc/boot.c +++ b/hw/openrisc/boot.c @@ -14,6 +14,7 @@ #include "hw/openrisc/boot.h" #include "sysemu/device_tree.h" #include "sysemu/qtest.h" +#include "sysemu/reset.h" #include @@ -111,6 +112,8 @@ uint32_t openrisc_load_fdt(void *fdt, hwaddr load_start, rom_add_blob_fixed_as("fdt", fdt, fdtsize, fdt_addr, &address_space_memory); + qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds, + rom_ptr_for_as(&address_space_memory, fdt_addr, fdtsize)); return fdt_addr; }