From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jEb6D-0001B0-Gs for mharc-grub-devel@gnu.org; Wed, 18 Mar 2020 11:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49486) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEb6A-00017K-LQ for grub-devel@gnu.org; Wed, 18 Mar 2020 11:59:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEb69-0004r7-1o for grub-devel@gnu.org; Wed, 18 Mar 2020 11:59:14 -0400 Received: from mail-eopbgr30080.outbound.protection.outlook.com ([40.107.3.80]:47075 helo=EUR03-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEb68-0004XU-MA for grub-devel@gnu.org; Wed, 18 Mar 2020 11:59:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j7S4BJXKgg4eq0gZ28zwWseVf0fCOQHvprGlEp7JDbox9B1Ouit6D/wRVBuneo9twY3B46YokDIKw/8+ZhOxOWT/S3HWiXKXbu+KBa+lgaytanMzIrvriEccqKPPutmPNfL8m18EwZvO++SMytoMphZcOcDDN4cYdkM6qAvKwEKYn12O3EZjwMjRkLrT25a916I1ozKqz7j8AwT+6ybDYO2BN5i2RNZgWVQNNns3a9tTJx/ztbACZ1hX2MZzSPKv4zhem2IHPDWpyZHGk0PoTXvTpBxScw2m8olJOmqRjX9wYThEFSgcB+wCo9CQDOY1vbnOYFDMJqG+dcczzpgCLA== 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-SenderADCheck; bh=3yVOe+JgXQhvwqY3SAZYE6BvFVyfRvn/pNfXEl4T6ZE=; b=FlLo4opKErowcMPWMXjT2SpDLZw51KGP/ufc7eImb96kZtDlCGFoG2lf3Z1HqeGqz2Qtbd/qUXiifmPkUot9w4+wJ7La53mAsiK6yKD3SiNOyPq5/WHpuTE3+XQSJXIC1jr2HJh60bmhY4mOI8NsVs5h3E8uZ5r9p+yQb7F3iCQ2e2XmtH0Jdle2WxqrskZfo4MM9HoUuxqRFR4qKH8okgjH87Vts+LS+JiRcSGHC6CWmwg/t0h0S3RtyaLWQ8Px9Abr7cpsefPbJXdknmMtscVy8R+hoLbJ9crXw7AdKLu0TvGnUO9IkurbF2wvzAO+u3pUs5RgMubW1dej9o8PSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=itdev.co.uk; dmarc=pass action=none header.from=itdev.co.uk; dkim=pass header.d=itdev.co.uk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itdevltd.onmicrosoft.com; s=selector2-itdevltd-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3yVOe+JgXQhvwqY3SAZYE6BvFVyfRvn/pNfXEl4T6ZE=; b=WKJT+oTCqUvz7LQ2zoYWzb/b3laL/sTMEBqIdvobMo+qYF/ZQjdVV7qxCeTeZiyKcEZNmSani5PnSqTFtaZ6CeVQsN+vRxn+K00mC3q/fCMGuEDMB/lEofQPOM1vioUH8SxcBHyU2As3WTVp0uvbfhjg0p+gCLq12CB+J4J3M9g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.hardy@itdev.co.uk; Received: from DB8PR08MB5257.eurprd08.prod.outlook.com (10.255.18.14) by DB8PR08MB4940.eurprd08.prod.outlook.com (10.255.18.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18; Wed, 18 Mar 2020 15:59:09 +0000 Received: from DB8PR08MB5257.eurprd08.prod.outlook.com ([fe80::ccae:4f34:1ab9:946e]) by DB8PR08MB5257.eurprd08.prod.outlook.com ([fe80::ccae:4f34:1ab9:946e%6]) with mapi id 15.20.2814.021; Wed, 18 Mar 2020 15:59:09 +0000 Date: Wed, 18 Mar 2020 15:59:07 +0000 From: Simon Hardy To: The development of GNU GRUB Subject: Re: Verifier running out of memory on ieee1275/powerpc64 Message-ID: <20200318155906.GC2186@itdev.co.uk> References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: LNXP265CA0073.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::13) To DB8PR08MB5257.eurprd08.prod.outlook.com (2603:10a6:10:e8::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from itdev.co.uk (82.24.20.222) by LNXP265CA0073.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Wed, 18 Mar 2020 15:59:09 +0000 X-Originating-IP: [82.24.20.222] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69a42ca4-a9b0-4929-e1ac-08d7cb554b60 X-MS-TrafficTypeDiagnostic: DB8PR08MB4940: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 03468CBA43 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(376002)(366004)(396003)(346002)(39830400003)(199004)(2616005)(6916009)(36756003)(956004)(2906002)(1076003)(316002)(44832011)(7696005)(8936002)(81166006)(8676002)(86362001)(81156014)(5660300002)(186003)(55016002)(16526019)(26005)(52116002)(33656002)(66556008)(66476007)(508600001)(66946007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB8PR08MB4940; H:DB8PR08MB5257.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; Received-SPF: None (protection.outlook.com: itdev.co.uk does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7YztTWlROnidy4gBh/ItLY3BzmfUmMv3xU9ZwG8YRd6X6pEZ/3Puc8TZuoehTBahaXxioqiglXwwRKZxCZLgXQk/ASRPaLu1YbdxxCmZw6QubiXPpJWDFNvaiwNbq/0i0gAQRkGD+6SPtzAKoM8eLXvAr8NBT6NGjQLd8opL2/WSGVJpfCMFJJdK3TMpzvZQ3I7ocqg9J46dEj0jsatHMuRBku5eGX14hwlE8H+XnJHjDAqdLz95LvnUhJ0ZxuhLo2pWSu1TGroUJlvdwR0P+057d/hzUOXka2TyxYPZyzUNlXo01CjbAHiq9zhpn6wi1WflnaNNQv5giyLtKpkOcDUqO92o6wl74vhG2icoiZg2Za5OQxPkFNpmgD5lXXr9qk113fhUsJG2xkCTVPlEmVbV956aH0W8BgJ/jM70pEkfl4uDdt/3aGZwVudqEZNG X-MS-Exchange-AntiSpam-MessageData: xGJGOuepJCCdNs9Au4orX/1K1IvUIvXgx3ejGdPhFKB9IWZiChyAaoVMhTmwB290px43dv+hUuQDChMJpaq/+gp+V/QTmwmSoKr2g81e/uvodxUDCpkI7/ZqMsU/SjRdGdSAi7xGyWX/W7ooubKI7A== X-OriginatorOrg: itdev.co.uk X-MS-Exchange-CrossTenant-Network-Message-Id: 69a42ca4-a9b0-4929-e1ac-08d7cb554b60 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2020 15:59:09.5242 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 2d2930c4-2251-45b4-ad79-3582c5f41740 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: voFjcfVFNxK7qKPZToxtpr7InQdnnhdcefHLJ+nCs0+K4ou7LFoDjI9qkhTtjOAREdSvW5ZOawR2tkXFdR560A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4940 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.3.80 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 15:59:16 -0000 The 2020/03/17 13:15, Stefan Berger wrote: > =C2=A0I trying to add (v)TPM support for the ieee1275/powerpc64 platform = to grub. > The issue I have been running into is that the verifier runs out of memor= y. > At that point it has loaded the (~ 32MB) Linux kernel and now the verifie= r > is invoked to load the file. Unfortunately it cannot load the file since = it > doesn't have enough memory to grub_malloc. I have played with increasing > heap size(es) but it still doesn't work. The kernel and initramfs files o= n > ppc64 can be rather big, thus we do not a lot of memory. The rescue > initramfs here is for example 78MB, a regular initramfs from Fedora 31 is > ~34MB. The kernel sizes on my system are 32MB, though a colleague was usi= ng > an unstripped kernel of 127MB, so lots of (unfragmented) memory needs to = be > available to run verifiers. The verifiers framework has a flag, GRUB_VERIFY_FLAGS_SINGLE_CHUNK, that is used by the platform-independent TPM module. This could be deferred to the platform-specific TPM file (see point 3 below). With this flag unset for yo= ur platform, you could verify the files in small chunks. This requires three further elements:=20 1. You will need to implement the chunk-by-chunk behaviour in verifiers.c, it doesn't exist yet. 2. You will need to add functionality to calculate a hash from chunks, or require that the crypto module is built into the core. 3. The firmware interface needs to support HashLogExtend with a user suppli= ed hash instead of a memory buffer. For example the PC Conventional BIOS API h= as this, but the UEFI API does not.