From nobody Fri Oct 17 10:32:20 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EF7EC433FE for ; Wed, 19 Oct 2022 13:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233832AbiJSN52 (ORCPT ); Wed, 19 Oct 2022 09:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiJSNxU (ORCPT ); Wed, 19 Oct 2022 09:53:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7BEB1DB271; Wed, 19 Oct 2022 06:36:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A235B82323; Wed, 19 Oct 2022 08:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99325C433C1; Wed, 19 Oct 2022 08:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169305; bh=092M7OPnrt1mOCb9Id4pJ6ZjTgDA13Ex/8+A7MU3ylw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d38KlR/MuYzxPAAbdRNEgBP8Mql75O7n8rJdEqjMQ+DcZdfqx36RTT3/gnMBJN9IJ tBunQN7Q9IRqaD+L7F8AJpkQKO6/yOwB0ijH14fusqOB4sUCHYEg50Wj7u/ZZZDr8B KTLW0leq7EhBdmDDkm3YUDHmnder2HztqtcCadIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.0 227/862] m68k: Process bootinfo records before saving them Date: Wed, 19 Oct 2022 10:25:14 +0200 Message-Id: <20221019083300.092742604@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 7c236d93c6764dcaca7ab66d76768a044647876d ] The RNG seed boot record is memzeroed after processing, in order to preserve forward secrecy. By saving the bootinfo for procfs prior to that, forward secrecy is violated, since it becomes possible to recover past states. So, save the bootinfo block only after first processing them. Fixes: a1ee38ab1a75 ("m68k: virt: Use RNG seed from bootinfo block") Signed-off-by: Jason A. Donenfeld Link: https://lore.kernel.org/r/20220927130835.1629806-1-Jason@zx2c4.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/kernel/setup_mm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index e62fa8f2149b..7e7ef67cff8b 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -109,10 +109,9 @@ extern void paging_init(void); =20 static void __init m68k_parse_bootinfo(const struct bi_record *record) { + const struct bi_record *first_record =3D record; uint16_t tag; =20 - save_bootinfo(record); - while ((tag =3D be16_to_cpu(record->tag)) !=3D BI_LAST) { int unknown =3D 0; const void *data =3D record->data; @@ -182,6 +181,8 @@ static void __init m68k_parse_bootinfo(const struct bi_= record *record) record =3D (struct bi_record *)((unsigned long)record + size); } =20 + save_bootinfo(first_record); + m68k_realnum_memory =3D m68k_num_memory; #ifdef CONFIG_SINGLE_MEMORY_CHUNK if (m68k_num_memory > 1) { --=20 2.35.1