Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pTyEn-0000FF-9c for mharc-grub-devel@gnu.org; Sun, 19 Feb 2023 23:57:17 -0500 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 1pTyEj-0000Et-1l for grub-devel@gnu.org; Sun, 19 Feb 2023 23:57:13 -0500 Received: from mail-am0eur02on2057.outbound.protection.outlook.com ([40.107.247.57] helo=EUR02-AM0-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 1pTyEg-0002pn-Jk for grub-devel@gnu.org; Sun, 19 Feb 2023 23:57:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8j8gQH8z2vlJdNdyvmChijjUCZMiyUKISAK2vzvCGj5jcb4kyRWmDQ0yOKNTCzJPRZxsqcNU1zi9B2EoKx18GlNlJPqHNeBeubJBMF/OQmZZhRMWCoiw+b1ZwwdM40OHVFpIu8hyjeUzBYHAD9dCszEUmJgUyrEJ88jWlERHPDnKn4NhIaniCM8ZCeoQXS+YVRP97Y2AOkGGorbCAsCNDVzeHztD2Jjscu/XXs11Bj0mQSQBg+YjMctRRLC6/n3MRb+4lF+/S8VLPo6E8FoHq3TZWSNUMbz2cfFqqc+bXY0RB54qhNmpbT66jTrKnUynGBu8HBuqPFu019keuNPog== 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=L4zXGwHKWOSNdctiIwdoth6mMbb595wP2oS3Z/YTOrQ=; b=Yb9D7TYfUhHjbT4Q0csHiOkQn9m9W2XNYBOO6vKV3Ry4Y+eAS66rZIg1wbawdARG7KzZT4r/wYAARX4bI9V5kTgMjNHDFmdME75RtqvTrcOm2pTt4IAzRGBd3W/V5B4dPwXu7bCn30zoQXS2onzHgcqhsXVHIJ003rzv+NkR/tF8eI+Jw8MQ5BH68Yh6jxRFjJqoUlFKLfFXgaKoH2zC5HjuXfKI8n1JPPIAFE6X9b6QBoLYzqZy6e0xnkZ6r3MtBSWNXv7ilcIMKTMFi9bubuzpmDy4PE4jSXUaoGUQzkJBRNyapHF6S7RMj7vnrIiftM630ibwIu0SqX84VEAtwQ== 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=L4zXGwHKWOSNdctiIwdoth6mMbb595wP2oS3Z/YTOrQ=; b=RJX9BxDn0IOhV7DvShj2Vmgil9BKBbcSzKwxQKrYJYxU/Py1I4ip/oqi55iP6UOPG0GFC70ZrOCmzzda+g+hiYI20JqRbQf88U6bfC4pWcyytlT9ggBb+AStcwfobSF8FEMKOGWZYsvZMmWMgCDGvfwJboCiZ9ldKez2FHZU3VzKgMr+zBV9RBhrm23EBCEgkYgBU9if4OJwQ7HJfknNe35zhXBGIcdbPRRYOK+Bgr118LQHFrer3zratSLFYzt9uuvsLeDV9kSyIfzMfPWnfDTsqokQ5qN/R32mRdxG8byW8Fat1zYKqIQ0Oc/6Hka/PQUZHI6w0FFdNrJ3GHXYRw== 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 AM9PR04MB8747.eurprd04.prod.outlook.com (2603:10a6:20b:408::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20; Mon, 20 Feb 2023 04:57:06 +0000 Received: from DU2PR04MB9081.eurprd04.prod.outlook.com ([fe80::298c:3cad:5c55:4b5e]) by DU2PR04MB9081.eurprd04.prod.outlook.com ([fe80::298c:3cad:5c55:4b5e%4]) with mapi id 15.20.6111.019; Mon, 20 Feb 2023 04:57:06 +0000 Date: Mon, 20 Feb 2023 12:57:01 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH v2] tpm: Disable tpm verifier if tpm is not present Message-ID: <20230220045701.h2tf5q3jzcsyurim@lore> References: <20221007053710.18345-1-mchang@suse.com> <20221014094001.dqoncqektby34etb@tomti.i.net-space.pl> <20221017051908.GA21185@mazu> <20221124160448.zzcuix5atyhggj7j@tomti.i.net-space.pl> <20221125070048.GA5792@mazu> <20221129151148.rwt2rfwql2ufhfew@tomti.i.net-space.pl> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221129151148.rwt2rfwql2ufhfew@tomti.i.net-space.pl> X-ClientProxiedBy: FR2P281CA0102.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9c::16) To DU2PR04MB9081.eurprd04.prod.outlook.com (2603:10a6:10:2f0::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB9081:EE_|AM9PR04MB8747:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f989f61-ac2a-48e8-9db4-08db12fee977 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h85cLhB6yqk1q/whcPjk34ki7Zo9fz6cQBGzFFcQq0vNOobl/eZKWi2g2cJSJ70PvqylgOhm0H0k4bjQShMZH7iDoPutXDFRjq+Hc7QBq/W4QufT+lYvTgs+TYEctoqY0gSbJRs2mcEQzh6ciMUQUBLp9fgiT9fJVFxV+aNzSEpz0TcKt20ndI++5DgqSBl6Y6Qk6jerAXlFiF9ZMARDHLhN0gQ+ofPEuejTGNIRjFeymHzGqpzHzkCnOgAwoPenr5oTmJc9Gg9lcj6KS8UI1wEm3L/LI+XoSHTrdK2bGI5LQQ37mbKA7iwRlrVlXgLsTS+H5Myyde7f+cgDuYkktuEYu/cWe7+eFukkEq5WltCjRqc9qOU9Z2YgcQbNR2usqWde4l1dkt4ojMXqfgOMZko5Yp4TfI5/Lefons4OeyxZoxwet4SY57t1GJkfZnbgbeZKIpTIYQ4d3tJsKu5UAJYw6mAQ4xvXnfHS8yaHN38b5j089EaLZHdsVt22RV+KKtHUvW7EIB1vz256OkKXTqkWKL9WyPYS44rI58FJnthAWKLoxVhFDhnj6rptmp7qVNZVPp4kMUl0whES3MIzweCdeqpJNbl+sKed94cgeuzFjbRypInB20WGJCAGGQfMKvnOEiWlK5WZ/hib4KRbPEcvSoL/ASCGSuPtK8CsNB0= 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)(39860400002)(136003)(346002)(396003)(366004)(376002)(451199018)(5660300002)(8936002)(83380400001)(316002)(6916009)(8676002)(41300700001)(478600001)(66556008)(66476007)(66946007)(6512007)(1076003)(6506007)(6666004)(9686003)(186003)(2906002)(66899018)(966005)(6486002)(38100700002)(86362001)(33716001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bAef9uiHOx5YzMFhd4sZUjkRjfknVIblu41VG+LIxhesN1o09AzLT0vRSPYb?= =?us-ascii?Q?cSTpVx7q770I9MV78q3mzUfjuWVNMI41H2+S33CrqoXC7N5HFQoFUnTf97QB?= =?us-ascii?Q?sEDSnT98Q7nsFXxHC2t8qiCZFU+y7ULgNMagHT1/4EQI/29A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8YaseYTn3uq7sCCoAaWVXU0EI6dwE6Wh+HL7axRx/QZTb3p?= =?us-ascii?Q?5S+mGhm3OZ8VCAtwC/qj6B5/qCBi1cn2vfqaL//dF3vE8Pn9w1nLOqpqNUGm?= =?us-ascii?Q?AmRLfp2uxDeUeZRGZ/lYvbJPQFCOSwhkzXtvZghz7EbDGTF05ZpZ+0etrkNY?= =?us-ascii?Q?Ys8f0OJe3ugHTA+0cqb6HFIigYNSmVcdjbLVV0QJdeHJl1RMKrcCFJxRVM+T?= =?us-ascii?Q?rZt01TBaX1z7ckGefXHV8qGejmFM/gU7X20LKVZkcBVQz5vNAqmvWEYwF8kW?= =?us-ascii?Q?WSFA4CHK5BLbM0dAeVj1qXekWEhhoEaqMsyl+sdxDfvwaPyk9H7nO9xtiyja?= =?us-ascii?Q?c7AlJ77C3SUiW7F4PJzWfSxLgkaGdUCzanvWypdvos2SFzgX/5FE9jK/EG5G?= =?us-ascii?Q?BEt38hpBUiDZ97p5aSAahrGqb7O0qp42So7/A+Qk3/cfNEhroqq7fveBZHbS?= =?us-ascii?Q?9iKuVuW76d2YVmSEnnWETH3ouFyLfcRlr5xcq1Tjie4BUywUlA5iNSlBmprF?= =?us-ascii?Q?u0nrDHEbEf3nsy58u+z69l07VtlHmxnoUlmcT2grN61N0KlVpdDVKDQ4ft5d?= =?us-ascii?Q?TgMIT+msIcqfuVeSBPxoJt5NhVdk9Iy4czCCfnWrPE2t?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f989f61-ac2a-48e8-9db4-08db12fee977 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB9081.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 04:57:05.9260 (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: ocguj5E5xYWctlX43LiS/9hvAe6FlkOSBJ55aE43xtBlMrz/Jj1rHD7rTYCD3VHL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8747 Received-SPF: pass client-ip=40.107.247.57; envelope-from=MChang@suse.com; helo=EUR02-AM0-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: Mon, 20 Feb 2023 04:57:13 -0000 On Tue, Nov 29, 2022 at 04:11:48PM +0100, Daniel Kiper wrote: > On Fri, Nov 25, 2022 at 03:00:48PM +0800, Michael Chang via Grub-devel wrote: > > On Thu, Nov 24, 2022 at 05:04:48PM +0100, Daniel Kiper wrote: > > > On Mon, Oct 17, 2022 at 01:19:08PM +0800, Michael Chang via Grub-devel wrote: > > > > On Fri, Oct 14, 2022 at 11:40:01AM +0200, Daniel Kiper wrote: > > > > > On Fri, Oct 07, 2022 at 01:37:10PM +0800, Michael Chang via Grub-devel wrote: > > > > > > This helps to prevent out of memory error when reading large files via disabling > > > > > > tpm device as verifier has to read all content into memory in one chunk to > > > > > > measure the hash and extend to tpm. > > > > > > > > > > How does this patch help when the TPM is present in the system? > > > > > > > > If the firmware menu offers option to disable TPM device, then this > > > > patch can be useful to get around 'out of memory error' through > > > > disabling TPM device from firmware in order to make tpm verifier won't > > > > be in the way of reading huge files. > > > > > > > > This is essentially a compromised solution as long as tpm module can be > > > > a built-in module in signed image and at the same time user may come > > > > across the need to open huge files, for eg, loopback mount in grub for > > > > the rescue image. In this case they could be opted in to disable tpm > > > > device from firmware to proceed if they run into out of memory or other > > > > (slow) reading issues. > > > > > > I think I would prefer something similar to this [1] patch. Of course > > > if [1] is not enough... > > > > The tpm verifier attempts to set GRUB_VERIFY_FLAGS_SINGLE_CHUNK for all > > incoming files, which gets loaded into memory in its entirety as an > > duplicated copy to disk files. The overhead is too huge to some low > > profile hardwares with smaller memory or when the boot path has to cover > > very large files, hence the out of memory error. > > > > I think it inevitable to use GRUB_VERIFY_FLAGS_SINGLE_CHUNK as tpm > > measures and extends file intergrity. But we ought to avoid the overhead > > when TPM device is not present or disabled by the user. > > > > The patch [1] seems to deal with the tpm error which prevents a file > > from being opened, which is orthogonal to the memory allocation issue in > > the common verifier before tpm doing measurement. > > This is what I expected. So, that is why I said "Of course if [1] is not > enough..."... :-) Now I think it would be nice if TPM verifier is > disabled when the TPM device is broken/disabled/... and/or somebody sets > a separate environemnt variable in the GRUB. WDYT? I'm not sure if a separate environment a good idea, because it would expose the funtion to disable verifier in a way much readily accessible through one of grub command line interface, grub.cfg and grubenv file so that the intention have to be very carefully reviewed here. Thanks, Michael > > Daniel > > [1] http://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=a4356538d03c5a5350790b6453b523fb9214c2e9 > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel