Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4347001pxb; Sat, 5 Feb 2022 10:34:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3uFs1RxvgZ5ZYzdcmEgXk9utglatUP9E5O3pRQpewEzDmVCM/XQQF8uwDvpKJmGP9X2CT X-Received: by 2002:a17:903:41d0:: with SMTP id u16mr153105ple.144.1644086051663; Sat, 05 Feb 2022 10:34:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644086051; cv=none; d=google.com; s=arc-20160816; b=ypBy2ZpWZkrVlBaM2wKpoTXj3Mt5XyK51I9MUagfSfCYKcIWFfs0T/eBdxo0UMcGna AIud+4Cqyy3gS9+oiYjYQYcPKBfWkKfQMekMOis1fIU76deYX6Ns/o/4gXEbhKYgQAYX 7hn0WfD94rpSp6n4QZQ/VGJBUxaSQbKidfTE5yE+zbzpn8cUjLKit6dNQBM6FHW4pTW7 ufwUPjeiSEsM5fHikLYXy5H0DI1uSa5B3XL/pofZ9z78BmkwRbu+MtgOiVE+tWFCe4Fw w0R6ITLSZLH/fbb8F2nreWons+AVGgGK1ahsvMDXj1VqR3SVmlJ/PfnBpGfmNRG2tx1I V/ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=z88qgcTdBzz6tmzKkOFdFrvyySLSYDtXG4jGg0rD0XE=; b=oMVA2kcnGm/N19sjCaNPzM6veRDaMw2iAfdibWp8uanVa5HjrJKYsLO0/KwVUAFgDT 4N5O07tCx3DDGmt5VAiqV6WoSXZ900YaKTujBmb+tywNmOVeUbq5ObAjYtEnbkdXv3Ke qRGNs9ST0ENlLYOBBXhfjHutM2YqbLoArT0kvqEPxttMjpko/2BWO+5mtdDNKjAFt6yB z3Zfmc4en7uda+zV4GwLBFWoBLUvQSk/d5smogb0n3o+bQUvZfl8usnSRyhU5Ula9t4m AHHCO9+GWHy/iLiB1hT48qSh2/eTbP5xhxRhSBasdQlrPw49FzuNH7bZ9d7wPXaY7jJ2 8ryQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l71si5284272pge.724.2022.02.05.10.33.59; Sat, 05 Feb 2022 10:34:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbiBCUw0 (ORCPT + 99 others); Thu, 3 Feb 2022 15:52:26 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:52632 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbiBCUwY (ORCPT ); Thu, 3 Feb 2022 15:52:24 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 6317B1C0B79; Thu, 3 Feb 2022 21:52:23 +0100 (CET) Date: Thu, 3 Feb 2022 21:52:23 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Jeremy Kerr , Matthew Garrett , Aditya Garg , Orlando Chamberlain , Ard Biesheuvel Subject: Re: [PATCH 5.10 011/100] efi: runtime: avoid EFIv2 runtime services on Apple x86 machines Message-ID: <20220203205223.GA19153@duo.ucw.cz> References: <20220131105220.424085452@linuxfoundation.org> <20220131105220.835281614@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <20220131105220.835281614@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Aditya reports [0] that his recent MacbookPro crashes in the firmware > when using the variable services at runtime. The culprit appears to be a > call to QueryVariableInfo(), which we did not use to call on Apple x86 > machines in the past as they only upgraded from EFI v1.10 to EFI v2.40 > firmware fairly recently, and QueryVariableInfo() (along with > UpdateCapsule() et al) was added in EFI v2.00. >=20 > The only runtime service introduced in EFI v2.00 that we actually use in > Linux is QueryVariableInfo(), as the capsule based ones are optional, > generally not used at runtime (all the LVFS/fwupd firmware update > infrastructure uses helper EFI programs that invoke capsule update at > boot time, not runtime), and not implemented by Apple machines in the > first place. QueryVariableInfo() is used to 'safely' set variables, > i.e., only when there is enough space. This prevents machines with buggy > firmwares from corrupting their NVRAMs when they run out of space. >=20 > Given that Apple machines have been using EFI v1.10 services only for > the longest time (the EFI v2.0 spec was released in 2006, and Linux > support for the newly introduced runtime services was added in 2011, but > the MacbookPro12,1 released in 2015 still claims to be EFI v1.10 only), > let's avoid the EFI v2.0 ones on all Apple x86 machines. So Apple x86 machines claim they support EFI v2 but really don't? > +++ b/drivers/firmware/efi/efi.c > @@ -719,6 +719,13 @@ void __init efi_systab_report_header(con > systab_hdr->revision >> 16, > systab_hdr->revision & 0xffff, > vendor); > + > + if (IS_ENABLED(CONFIG_X86_64) && > + systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION && > + !strcmp(vendor, "Apple")) { > + pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n"); > + efi.runtime_version =3D EFI_1_10_SYSTEM_TABLE_REVISION; > + } > } This problem is not 64-bit specific, right? Should it depend on CONFIG_X86, instead? Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYfxAhwAKCRAw5/Bqldv6 8msJAJ9YUK6hbmRnGSAZkOrAk3efCqjCMACgkSvffri+H6ZcNVutTAGrx7CZ0LI= =lKcG -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--