Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1peqJC-000445-5S for mharc-grub-devel@gnu.org; Wed, 22 Mar 2023 00:42:46 -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 1peqJA-00043v-TE for grub-devel@gnu.org; Wed, 22 Mar 2023 00:42:45 -0400 Received: from mail-he1eur04on2070.outbound.protection.outlook.com ([40.107.7.70] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peqJ8-0005qS-Tt for grub-devel@gnu.org; Wed, 22 Mar 2023 00:42:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHKkPdQLO4JxgMHqckbpgxnraXS2RtNtNY2T9up9YGCy/nVgb0ijiOn+a1Lj5sbLsKNkqgOzXr6kZDYv2wJSFOqjljrF/FLMHWHRvP9Ydt9iWgpGVgXbH4QvXxyqihnaGqL0a2Oq90D7sNQXFw5VGy/5C6m1tf+P5Ue+9ITCZC4PQO1jpGhRE/b/SUaNAliaxtVqQcTaHYeqzuTtQN7x3D+QsfjRvJCQInkAu5bmthW/i83IPIxD8sKC/AWbN30SQslMAcF4Vc49AFg+xogU29CCJIZ+iuuf6PM8lpgeJA46ZMaGIJoAKBbyRhNQ4T3NorVX/Qi1mOHknJinu5qh2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/B9FavlhKDHxf2PKJUay06pLGLwnCo+IThRVPhhBAMM=; b=M+iIRunBm39D1f/2GV1K2rFF976brWrWIRcUA8LUqB3AgKPnuuQq8QVO2bi2VF1BleAyWUAWpJBTgnkhKwz2oF7TGOCNfqlvADIKig6KRTQoHvBW1Fjvj+f9iB33GUGhuJu0hNRfMIMlEMiIc9+3bZwN67a0tQ/BZFcI5zkc3MikzvTtL+I5z00N6VtsIgOyFqm8jRmR1NGqVv4jksBFxjsP++lVgB44+dpjybYgHiWGg8p4D4v8O+VNA+nD/TDpV82SE1iD4gxt16IeItFd/CtmXYAoGCnG2Z6TRJcP2TrqsU8SZOQbi6+xTAi9hxIzDkT4sQatWxISlDilKRTQ9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/B9FavlhKDHxf2PKJUay06pLGLwnCo+IThRVPhhBAMM=; b=GU1ANWzV+E6GjdniYAbRmwNWeT7szSa8tESUzDtLMsz9Ko5vWeeoB77hFduIB7LOebLsNK4eyw1jiKxGwBB3i2gX3o/QR6cWgGWezeFns9DF33m5Va/mp0/Blygt4wA7UIQCdZtJ1pCvgoNi8WU1DydsMrbbZ127L7h/UsGCwPgzRHE9ruIfCvWSaF7SgWFYLegTmYkRs7Ki4gyaoSVpRwSW4qelzZO0B+Z+Ln2BLRKHSOU98s/TCnKEV0tGI86cpfPaegpvMruqYA15JO8zoU/S1U0GeT8f3xxEMpA5xHk1au217PW+3JH3iv1Pry2RrzCI5VtV+qZupyir02jBqQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB9081.eurprd04.prod.outlook.com (2603:10a6:10:2f0::13) by AM9PR04MB8777.eurprd04.prod.outlook.com (2603:10a6:20b:408::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 04:42:36 +0000 Received: from DU2PR04MB9081.eurprd04.prod.outlook.com ([fe80::f24e:f7d1:14f:b945]) by DU2PR04MB9081.eurprd04.prod.outlook.com ([fe80::f24e:f7d1:14f:b945%4]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 04:42:36 +0000 Date: Wed, 22 Mar 2023 12:42:25 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH v4] tpm: Disable tpm verifier if tpm is not present Message-ID: <20230322044225.uldtz2os5ihdr67t@lore> References: <20230320101826.8539-1-mchang@suse.com> <20230321143533.3ch6pna3cnkfv65p@tomti.i.net-space.pl> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230321143533.3ch6pna3cnkfv65p@tomti.i.net-space.pl> X-ClientProxiedBy: TY2PR02CA0055.apcprd02.prod.outlook.com (2603:1096:404:e2::19) To DU2PR04MB9081.eurprd04.prod.outlook.com (2603:10a6:10:2f0::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB9081:EE_|AM9PR04MB8777:EE_ X-MS-Office365-Filtering-Correlation-Id: c4af5c3a-ef21-4c4a-137a-08db2a8fdb92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3STojHBG+G0OPIwE1sMemi7Aa8pagxcgjCgY513UcB+aFd/0vvh5nisd2ahRhTU5Kqr/r+HxZW8ZbpTtpzeAuuirvWNlRImwUg3Qidmzk7M5RwhRAiFOmLmzr3/YgygYc3LjUZohJlwr+Q2anGOzMwHki0rS8yspywRu07j4FlFXj+kMhTlw9DSsAZRi8hpaaO1kpfZNYm1OUnh9ateiRdfhdQmhx1Dqt4KoVd+2m96ADtuOf8ElD4z2I8WO1q25PNQbZJfmUO1ATS2bddrEWz7tXr0VWh3WmAdu48ehM9b+kkgD5exUZzySdcmq60OtsQaqqXydPD6XQY18y5eGYE7SnrXmfQ2RJ/gZnsAz7GouKKQzCwCG9OwKiE5vrmelwwsvItDpXRKPfl8ffbpVfrzMHvqKoPGljk/oIK1zeLqx3NDggy70Mn8Xl+rwOYfihFfHbGQcZ3n91cRch0SqSJcULlC+R8iuus5+NeauoRxo/+QjgdT074GmBuHaKV9P9rBlT2/PMOYyE5HfSoCBO/LtXdl5CyHmKQcGmuiUGc2WDOwMD9dca/I8WLSNiA4dQBsPt4K9MWsirNrDjM3enJ5R/qLyEkaDHKmpr9rVLrlh6RJbP058QfC+4iBCr9m7 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB9081.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(7916004)(136003)(366004)(346002)(376002)(396003)(39860400002)(451199018)(9686003)(6512007)(83380400001)(1076003)(6486002)(186003)(66476007)(66946007)(966005)(6506007)(6916009)(316002)(6666004)(8676002)(478600001)(66556008)(41300700001)(2906002)(5660300002)(8936002)(66899018)(38100700002)(33716001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8ofEcHPCEePLw3a6t+pqNA3EyHk+SnyrhJOjAG9MAA4v9btNM/BSVjL+txDT?= =?us-ascii?Q?YegQebdGNdQabIEzDXkxiq7hx9vc/MXMQE3dZTzMM54Osq4fgVJ9R5Lvri5i?= =?us-ascii?Q?tuUmq1DomMg90AHf9lZ1+YbpScUV9IyThEXkV4BuIGS5MUMJCimqIWf9AHAy?= =?us-ascii?Q?z5eo8ba+MDo/LTvV0So+z3UfXn1r8WrmHEplAzurQXkxooBriXYyNE1yRVIM?= =?us-ascii?Q?9OZdCTs0g4MEEEMsHdYvFZYTJBahuwCBf5x2CZWWoxNyLnWA1II4MVkV1psf?= =?us-asc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b/4LhTY4DsTwqzNGCk/?= =?us-ascii?Q?gh9iDx6PJPiCLKIoPswB1L9HvivaHjPBFSHR9hTWz/C1eYyE5EKQgRyTUS/I?= =?us-ascii?Q?/eBtlJCdyffSvciNztdIh0ANnkUpRBnLwq9kdSEL1Xb+xHhWWfyN8jlsNxln?= =?us-ascii?Q?dWQtOWerYuYLTMIQ/YWCFcaz7n5NbVoKognhTAxkmcPcjQplJLgAp1Bf1gxp?= =?us-ascii?Q?XmwZxs0mt68SYbSQ8sF2HoaSIxPuMVW0Z7KzTwQt4yYJX6cef5k+RkRpIZlB?= =?us-ascii?Q?0BrbR07V/8+S7sFtdNcT+/r1Y/l6RActT1U5+2qdJAYEM3Gja8t3p0DdzCC/?= =?us-ascii?Q?bsAAwg4+Vxf1vYXZCExEafW1VjfjqyEjsRYzo5ch53EoP598osrCz9YqPxVv?= =?us-ascii?Q?ouKaISzPwkGQFfgOkNCOPdW1gsSQuOdthYDuXP5/QbJX7emjUtDRnqL9pbig?= =?us-ascii?Q?mrLr0d+u89J7FCHgUy27XQZxdJ6E0url8M3/2fskzEo4?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4af5c3a-ef21-4c4a-137a-08db2a8fdb92 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB9081.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 04:42:36.4258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XNPkjF06vvrTMUpH6ZT/o+TO/KNMnYCUxQhEGnPpOJ6WEhOOSNPFdbIO8WAVemZ8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8777 Received-SPF: pass client-ip=40.107.7.70; envelope-from=MChang@suse.com; helo=EUR04-HE1-obe.outbound.protection.outlook.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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2023 04:42:45 -0000 On Tue, Mar 21, 2023 at 03:35:33PM +0100, Daniel Kiper wrote: > On Mon, Mar 20, 2023 at 06:18:26PM +0800, Michael Chang via Grub-devel wrote: > > When the TPM module is loaded, the verifier reads the entire file into > > memory, measures and extends the hash, and uses the verified content as > > a backing buffer for disk files. However, this process can result in a > > high memory utilization cost per file operation, sometimes causing the > > system to run out of memory, which can lead to boot failure. To address > > this issue, previous patches have optimized memory management by > > I would mention at least commit 887f98f0d (mm: Allow dynamically > requesting additional memory regions) here. OK. I will do it. > > > dynamically allocating heap space to maximize memory usage and reduce > > the threat of memory exhaustion. But in some cases, problems may still > > arise, such as when large ISO images are mounted using loopback or when > > dealing with embedded systems with limited memory resources. > > > > Unfortunately, the current implementation of the TPM module doesn't > > allow for the elimination of the back buffer once it is loaded, even if > > no TPM device is present or the device has been explicitly disabled. > > This can lead to wasted memory. To solve this issue, a patch has been > > developed to detect the TPM status at the time of loading and skip > > verifier registration if the device is missing or deactivated. This > > prevents the allocation of memory for a back buffer, avoiding wasted > > memory when no real measure boot functionality is performed. This patch > > also provides users with the option to disable the TPM device to free up > > memory in scenarios where the system can't afford the high memory > > utilization cost. > > The last sentence is confusing because it gives an impression the patch > adds an option to the GRUB to "disable the TPM device". Which of course > is not true. I expect you wanted to say something like that: "disabling > the TPM device in the system reduces memory usage in the GRUB. This can > be useful in scenarios where the system can't afford the high memory > utilization cost and nobody cares about the measurements of loaded > artifacts." Initially, I want to emphasize that after this proposed change, disabling TPM will become an option to free up memory for others. However, my previous expression may have been confusing, and I apologize for that. Thank you for your review, and I have updated the v5 patch to address your comment. Regards, Michael > > Otherwise patch LGTM... > > Daniel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel