Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2187818pxb; Wed, 9 Feb 2022 12:46:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLSi+epjl/88/JWnjpCm02xhLPtvM+T9aJUj7o8s0+awU+/VBZW47HT5hgZKccRnT9w+m6 X-Received: by 2002:a05:6a02:18f:: with SMTP id bj15mr2542228pgb.603.1644439576006; Wed, 09 Feb 2022 12:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644439576; cv=none; d=google.com; s=arc-20160816; b=wXQNyQpzKnkoj6tKcuZvIW4+T+beVxNAuaD9GI622XJHGyuib1PyLUsXjOWppeTSvB vMHLSptYE5zsqzY6aHQh16O6bosS11i5G/dqsxVArX+EN9xLG3C5BvwSvE9z2ROHFyRN SunbaWc9V85SMAZEpkClPw3PReY8CJ/1OsaGYzD8sFKj3rWPLqPlXs7BUP5qDfsSImp3 sEegzed0P84Fs8TKJbyawmWcTN5HJKhuWQXAmeTU+l7NpwJK+S+LQwaC4BkhTKs5pCFm o6GNYqDc7Ct/3gKyW6Goa0v2Y793RSCJqBjl+Xz6BaO5Ans2bx+4jyXvFanDlGfIzpd6 UwLQ== 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=5bf18GuCGqS9GFBdL5fFbv8Po7PqQRoYOx0/XquVR34=; b=g5Y9zxdPnJd15kUGUNx5EmSmVUf4ul1/KGDAI8bemv4ofLF1pO6PKpU2tWSF7fiMWk AIMaTfsKtzHBycb8zIv92Q8D2LE+qJ/wJSbRcb4pyMRDTsX9GJpDs3th7qd9cyrgaElc 9ZAmmHDRTfd5cSXYOZfeV49esyN+cyBLZlUnfNlpnsV8QZeElC7xxGwdjFq2DEd8PF/z HkZBAvrPXfZPE+ZYq9z3rKlU4UOdLRZQXzwp5REpHmOUEQpeT8IpO3K0Fzse+vnjLBxT jvPMLZXxnQ7cvABDrQrZhJEY46SMQQki2F0Kp3usMAeSNIeYMbmSZIwMdSsD3NKQS+kq l3Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y70si2995212pgd.761.2022.02.09.12.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 12:46:15 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1F15DE091EE0; Wed, 9 Feb 2022 12:11:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231445AbiBITh2 (ORCPT + 99 others); Wed, 9 Feb 2022 14:37:28 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiBIThL (ORCPT ); Wed, 9 Feb 2022 14:37:11 -0500 Received: from cavan.codon.org.uk (irc.codon.org.uk [IPv6:2a00:1098:84:22e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C989BC050CF9; Wed, 9 Feb 2022 11:37:08 -0800 (PST) Received: by cavan.codon.org.uk (Postfix, from userid 1000) id B196F40A63; Wed, 9 Feb 2022 19:37:05 +0000 (GMT) Date: Wed, 9 Feb 2022 19:37:05 +0000 From: Matthew Garrett To: Aditya Garg Cc: Ard Biesheuvel , Jeremy Kerr , "joeyli.kernel@gmail.com" , "zohar@linux.ibm.com" , "jmorris@namei.org" , "eric.snowberg@oracle.com" , "dhowells@redhat.com" , "jlee@suse.com" , "James.Bottomley@hansenpartnership.com" , "jarkko@kernel.org" , "mic@digikod.net" , "dmitry.kasatkin@gmail.com" , Linux Kernel Mailing List , "linux-efi@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "stable@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-integrity@vger.kernel.org" , Orlando Chamberlain , Aun-Ali Zaidi Subject: Re: [PATCH] efi: Do not import certificates from UEFI Secure Boot for T2 Macs Message-ID: <20220209193705.GA15463@srcf.ucam.org> References: <9D0C961D-9999-4C41-A44B-22FEAF0DAB7F@live.com> <20220209164957.GB12763@srcf.ucam.org> <5A3C2EBF-13FF-4C37-B2A0-1533A818109F@live.com> <20220209183545.GA14552@srcf.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209183545.GA14552@srcf.ucam.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 09, 2022 at 06:35:45PM +0000, Matthew Garrett wrote: > The LOAD_UEFI_KEYS code isn't doing anything special here - it's just > trying to read some variables. If we simply disable that then the > expectation would be that reading the same variables from userland would > trigger the same failure. So the question is which of the variables that > LOAD_UEFI_KEYS accesses is triggering the failure, and what's special > about that? If it's a specific variable GUID or name that's failing, we > should block that on Apple hardware in order to avoid issues caused by > userland performing equivalent accesses. ie, can you try something like this? diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index f3e54f6616f0..01cbd4811d1e 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include @@ -203,6 +205,21 @@ static void efi_call_rts(struct work_struct *work) (efi_time_t *)arg2); break; case EFI_GET_VARIABLE: + unsigned long utf8_name_size; + char *utf8_name; + char guid_str[sizeof(efi_guid_t)+1]; + + utf8_name_size = ucs2_utf8size((efi_char16_t *)arg1); + utf8_name = kmalloc(utf8_name_size+1, GFP_KERNEL); + if (!utf8_name) { + printk(KERN_INFO "failed to allocate UTF8 buffer\n"); + break; + } + + ucs2_as_utf8(utf8_name, (efi_char16_t *)arg1, utf8_name_size + 1); + efi_guid_to_str((efi_guid_t *)arg2, guid_str); + + printk(KERN_INFO "Reading EFI variable %s-%s\n", utf8_name, guid_str); status = efi_call_virt(get_variable, (efi_char16_t *)arg1, (efi_guid_t *)arg2, (u32 *)arg3, (unsigned long *)arg4, (void *)arg5);