From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796390534; b=vtEj9FtstZPLLDLPc7PlUi+hnp3tbdCk5sHhGRcH6v7GY17yh+wPUguEK8m6gw70SSBk ypk6CKxX9FLNH7uScDg9q0Ui8IspN5HjfdOgYlwOZlx+qBEnf5+CQTq8N7EKLrt0U+j6f UHVPFEi5svSotOp4QKoNSMs1SSdUaeTkyyIZFUHvS51JCRJn9xtXwwt2cnWmmbrm4Hcu0 Blrv+vCDvRvCvcKl6HspJl3lZV/SD7dJI+N024hf5SzA3L/GTxXoWJPpsNB03nK4jQx2p 7pLideoqtu8CC2mBOFoFosR0VuF7Btmb0Ts+o3weEB62avwZQYQ6NpJjEWO0gaPimCw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796390534; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=lIibvsWB661XC+lAEOv4TgErlSAMYwaQpxM5FSJSrv0=; b=W4kDUNPbRZTU4U15TNdK+ChlvtbSMD3t0tLyypGvFJljVkiBVWF4RZ3PREdRAlY1SHBP d8v4ZwJbu9lbv7pt6aRo3ijzNh4QjITCDgxtingNgc3sDE1Ouln5WAmdqIB6OywkA1TmS i1Fu8ZJiAf+ZycQphK/xjhdBXumMX9n+840M1L9/ACJuPHWE48ow0acv7ICRUNsYtnvmz eFeP4xDyx58rFsBwmxeUEkwJrS/s6wCeNfDuNAKBTZQAJXVwz5Cm/+tFUgzqsQVMvMHdp 6TXj75rvGKhRMFAJqp3B1Dvjb8GdF/MEw/FZ3y2OffJG3n1dUpLUs7CdNpBsqDEaH3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tUJElrIu; arc=none smtp.remote-ip=74.125.82.182 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EBB8606A339 for ; Fri, 4 Dec 2026 13:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1EBB8606A339 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tUJElrIu Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-387504e1934so989930eec.1 for ; Fri, 04 Dec 2026 05:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796390533; x=1796995333; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=lIibvsWB661XC+lAEOv4TgErlSAMYwaQpxM5FSJSrv0=; b=tUJElrIur/23rNNYVz1Sp26m5jZHviCgWgYV6hv+UKjTb5yuS0uOkrzZ9Z2opUsdXK HkIGK5v/ZhOlYfh2TNPphqR1v3FqLljvh4L7G4YtLIWICgU1cBDKLTp6c03ck9CiJlGf WKhTvgSrgiy9VgP/zFyM19/O+fRbgb1rjP/ehUZ/z9FeDDNQZF1mrx7CYykBTmq8lWsC bF7dLvf9PWnukrvGxyTZ2KI3KBZT0tjMJx15JUaRBFKAxM+Eh9DyuO2ybF5LTSn/+xql 22PORd7GOWbaUW3XcTmjJYQOgLqDJaZhcUl3rI4BKP1fU/ZenX3WYSdsG1WHTm/Adm6K aF4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796390533; x=1796995333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=lIibvsWB661XC+lAEOv4TgErlSAMYwaQpxM5FSJSrv0=; b=Io8StjxX3cy6MboKPVzaXmj/Uz7sDPKVpaKrwNi6fp4bJPNxOmq4zcUnpQ3RJHfPrn YklkVlEbmRMg1UywxNjk3bc1YTZOfIcSeURwUue0t2QGuGeZCasScaMXsGsC3mwBkvzm XSjKCBAtJrYQ95NUi13lwO17vRVe1fZOTGmf5TS5smfvhrhg8Zn9t3W5uSY0cnPOWjqq g31FL/eX9mgQ5noVeGGaWzDsARV+z0C2gQdn+XaqohcEp53p316HuDzZa/SMmjZRvvDn 1P1vV5aFZaPoIbhjS086rTxAjbwoEmDy+VGhdDJhj9uMlQ/h9NbeHsMT6Ysi0q++4544 1BUQ== X-Forwarded-Encrypted: i=1; AL+hErFftXloQyW7+E4DkMlmJTuS10oLfsiHfXccBwZLkU0CxR07yLHlfMLwjIEukdIr09kvhJ6tMlDHclnV@vger.kernel.org X-Gm-Message-State: AB4q+uFXuC8NN5K0X6+uki2cvnNEi4zbVqoOh+nCTFBFQxTh92NELMDJ 1TaTv8FuOISHpWORQ5An9nxWLh7GdQ3w8KlhWfrBjannO+CE1T9HjXI= X-Gm-Gg: AZFdTZfSwWCcSBwRlJ+aoMdYHeQIURD4/un3gdDKNpqzmyfKQNONKPcynmLiHqEzBae O9ChKbGy3+GeWmzXwDCAFHzpkSNeIZgnR2bb7JUsvxSYuzoKsW/MVzBctlBgTIR3O+Wty0U45uM Cx/UAdTCMCFOUyP2xVyrmaTrjX42NNzDv2SPQxIvzn7yV+//MJifOBP/Zg11Cz1jGtOAHUas1I0 xq2i9sxsXbjlSxzxrNNm76X1s23y/3wlSTFL/2Lj4Nx8cfWc3SXdLIXQZwc44MjBr+wkOapz60p Gsbm80iCuGcmv1EreUTboxwZLoWQnvNPdRMnwpLExtawxaNBK5n0IQtWv19dpTl6Amqsb12s0mT ul3VZBx3ovux2BI3hPE4DWHDqrfcHML3Az9O+GJArJhmM4/4juCrzUfCHd+rtv+NYy1X+POlJ/Z hoPQgF7KOeSaG0TNnd1IurvTa+qtRJNAbvY/PRPh/o5FoFgpz4c47k6PL6Q3x2nogSQj/RpxQ4A c1yDmMUoCoDLFhbSa/wgf8ymh5+FowRl4kpmY9h7l5eH561Wnlg1qK8a6/zywDswWSqBLsGp/OO y1tKViMiMOCiFxYKlN4jS4veRJwdzomK9OFpo3zrPQB1iJ8AP0FYMBsYFPlVgR0= X-Received: by 2002:a05:693c:65d2:b0:386:a01f:a31e with SMTP id 5a478bee46e88-387521a0cb2mr1918718eec.29.1796390533119; Fri, 04 Dec 2026 05:22:13 -0800 (PST) Received: from at-Standard-PC-Q35-ICH9-2009 ([27.60.19.167]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521e1c55sm7152700eec.16.2026.12.04.05.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 05:22:12 -0800 (PST) From: Atharva Tiwari To: Cc: Atharva Tiwari , Aditya Garg , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Linus Walleij , Bartosz Golaszewski , Sven Peter , Janne Grunau , Neal Gompa , Guenter Roeck , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Lee Jones , Pavel Machek , Griffin Kroah-Hartman , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sebastian Reichel , Alexandre Belloni , Wim Van Sebroeck , Jarkko Sakkinen , Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , Paul Moore , James Morris , "Serge E. Hallyn" , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, mfd@lists.linux.dev, platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH 08/14] treewide: Add a flag to detect the Apple T2 chip Date: Fri, 4 Dec 2026 08:12:48 -0500 Message-ID: <20261204131619.5059-9-atharvatiwarilinuxdev@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261204131619.5059-1-atharvatiwarilinuxdev@gmail.com> References: <20261204131619.5059-1-atharvatiwarilinuxdev@gmail.com> X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a flag to detect Apple T2 chips on Intel Macs. Cache the result to avoid repeated checks. That will be used in upcoming patches. Tested-by: Aditya Garg Signed-off-by: Atharva Tiwari --- arch/x86/kernel/quirks.c | 37 ++++++++++++++++++ include/linux/platform_data/x86/apple.h | 5 +++ .../platform_certs/keyring_handler.h | 8 ---- security/integrity/platform_certs/load_uefi.c | 38 ++++--------------- 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index a92f18db9..6651e5d4d 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c @@ -664,8 +664,45 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2083, quirk_intel_purley_xeon_ras bool x86_apple_machine; EXPORT_SYMBOL(x86_apple_machine); +bool has_apple_t2_chip; +EXPORT_SYMBOL(has_apple_t2_chip); + +static const char * const __initconst apple_t2_models[] = { + "MacBookPro15,1", + "MacBookPro15,2", + "MacBookPro15,3", + "MacBookPro15,4", + "MacBookPro16,1", + "MacBookPro16,2", + "MacBookPro16,3", + "MacBookPro16,4", + "MacBookAir8,1", + "MacBookAir8,2", + "MacBookAir9,1", + "Macmini8,1", + "MacPro7,1", + "iMac20,1", + "iMac20,2", + "iMacPro1,1", +}; + void __init early_platform_quirks(void) { x86_apple_machine = dmi_match(DMI_SYS_VENDOR, "Apple Inc.") || dmi_match(DMI_SYS_VENDOR, "Apple Computer, Inc."); + + if (x86_apple_machine) { + const char *product_name = dmi_get_system_info(DMI_PRODUCT_NAME); + int i; + + if (!product_name) + return; + + for (i = 0; i < ARRAY_SIZE(apple_t2_models); i++) { + if (!strcmp(product_name, apple_t2_models[i])) { + has_apple_t2_chip = true; + break; + } + } + } } diff --git a/include/linux/platform_data/x86/apple.h b/include/linux/platform_data/x86/apple.h index 079e816c3..47b27dcea 100644 --- a/include/linux/platform_data/x86/apple.h +++ b/include/linux/platform_data/x86/apple.h @@ -6,8 +6,13 @@ * x86_apple_machine - whether the machine is an x86 Apple Macintosh */ extern bool x86_apple_machine; +/** + * has_apple_t2_chip - whether the machine has the Apple T2 chip + */ +extern bool has_apple_t2_chip; #else #define x86_apple_machine false +#define has_apple_t2_chip false #endif #endif diff --git a/security/integrity/platform_certs/keyring_handler.h b/security/integrity/platform_certs/keyring_handler.h index f92895cc5..a355f4400 100644 --- a/security/integrity/platform_certs/keyring_handler.h +++ b/security/integrity/platform_certs/keyring_handler.h @@ -45,11 +45,3 @@ efi_element_handler_t get_handler_for_code_signing_keys(const efi_guid_t *sig_ty efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type); #endif - -#ifndef UEFI_QUIRK_SKIP_CERT -#define UEFI_QUIRK_SKIP_CERT(vendor, product) \ - .matches = { \ - DMI_MATCH(DMI_BOARD_VENDOR, vendor), \ - DMI_MATCH(DMI_PRODUCT_NAME, product), \ - }, -#endif diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c index c0d694844..b4096d4c8 100644 --- a/security/integrity/platform_certs/load_uefi.c +++ b/security/integrity/platform_certs/load_uefi.c @@ -3,42 +3,16 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include "../integrity.h" #include "keyring_handler.h" -/* - * On T2 Macs reading the db and dbx efi variables to load UEFI Secure Boot - * certificates causes occurrence of a page fault in Apple's firmware and - * a crash disabling EFI runtime services. The following quirk skips reading - * these variables. - */ -static const struct dmi_system_id uefi_skip_cert[] = { - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,2") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,3") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro15,4") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,2") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,3") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookPro16,4") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,2") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir9,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "Macmini8,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacPro7,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,2") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMacPro1,1") }, - { } -}; - /* * Look to see if a UEFI variable called MokIgnoreDB exists and return true if * it does. @@ -165,10 +139,14 @@ static int __init load_uefi_certs(void) unsigned long dbsize = 0, dbxsize = 0, mokxsize = 0; efi_status_t status; int rc = 0; - const struct dmi_system_id *dmi_id; - dmi_id = dmi_first_match(uefi_skip_cert); - if (dmi_id) { + /* + * On T2 Macs reading the db and dbx efi variables to load UEFI Secure Boot + * certificates causes occurrence of a page fault in Apple's firmware and + * a crash disabling EFI runtime services. The following quirk skips reading + * these variables. + */ + if (has_apple_t2_chip) { pr_err("Reading UEFI Secure Boot Certs is not supported on T2 Macs.\n"); return false; } -- 2.55.0