From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793264383; b=GI4lahA+brcHrzuwU1fgOujHKfiemQXd0M6l0AiVFyPjim32yk7cabeHs7WrNUSb39Mj Kbx/SKKUKlDvhedeDi+v0iGMasTwdPPeUCBDOI4XrZ7B5ABTYuQ3nyJYEyHz4e3KfdvQ2 /URKNuC+4cYD/AhIo23B3qIIEBMdnV4mmha1eUZQzUdg8JsP8Xnbh03thPm71//OREu3u nsRGzvQBcR8OlPIExLQIKSVKIA3VL27p2oYM356CVWenKwrZgPlU3V98rMtdPoNbjkMOr v5mL5ZGbrSl2SK3Er/YNDYtBtujMpDgSF/FrPpLfoS6nmDmby3r8mCRytR+Ho0WiB5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793264383; 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=EWgIkiGG+9C3t4UZx8jQyb/h8aaD9D1BomPU2LdA7YI=; b=uzf0WzLAjR+ilJlJTE7xX2gmSD0Dtbk8332ZSbykvzFHS+9J/M9jUAUopPK9i40FYpGA zkwR2OZ3z53IEbAVVhYBXQOw/4c/t1Z+6SIX5AgOfyuKpaA8s/rjj9kA8ZimKviWjvsQ2 8TzbN8loZ/FHYCvcUMtPxIyV2QumwmMu9Eo5Wgy1mdCcUnxGIXLRC1PcSBY/sS+6yKSRq ONnOVlPVi7sRAsJPo1fODuzFzfJ5UbnCrq83Nwy507G2wxf4wogSuOdAir3k2KwDTY5+I VOa67GQ/BIz6RcuzhTkagtieIsndGcLxu2nOvHI1LrRHoEdXQG65GhSW+aWhsWq5ozA== 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=lXaoyEhr; arc=none smtp.remote-ip=74.125.82.173 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (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 A2FE2606A324 for ; Thu, 29 Oct 2026 08:59:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A2FE2606A324 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, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lXaoyEhr Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-36a0f27c9f4so2887495eec.1 for ; Thu, 29 Oct 2026 01:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793264382; x=1793869182; darn=lists.linux.dev; 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=EWgIkiGG+9C3t4UZx8jQyb/h8aaD9D1BomPU2LdA7YI=; b=lXaoyEhrjc8uekEIO6YWP3/brz7WYPE+wmrLDJ/J6npTg5Q8OjHkqzlLEAUHsH1vm8 fdp5Fv1Anw7n7pBGSe3wjgLG3NHiFKAOBA9Y8u+XknLKtYXNqp5qOQUlL3tgll+3Sx6T mHKyf11CKIIO0nipBVs8ezCadGzrR0DWLzSuS+9+09fnFUsXGWYJnKI7/YtJ5alu5pva Ml4IZAUSI1S0wIMoJu8QPndKlq0BFzRQdO0aA3L9HjamN+uHHonXJCicVhbRpJA6xHgy 5X71MOpgsXUmSD3KhxA+wsjhDdssuxv9JoaCsrKfIivn8ec8ww2C06zeCrbZkWQMjQ9T 5FJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793264382; x=1793869182; 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=EWgIkiGG+9C3t4UZx8jQyb/h8aaD9D1BomPU2LdA7YI=; b=WPfrhYiZ1q5ckIPo0fE+PA0jlZ5CvYoyZTq+Tb+MQ5Bvj1pWQj5E8tumwNO/xoabxL K7Q2L9oeZZCDOpTUxBYEs75EcpdPITUmueEYx6slL0zn4P/u4nSRXxkbCqKPOdIGyQaA kl4bhTlYlsburuCZuTc9ZaTszaqRaXP7jXcdQACZWwRBD65fFcv8m4cfppGFFWWnkvdN x5UUrUF9bsvLb/+hHMOgDihmOZ1c62ien0q/K7Dywtl6Bdj5UJgZtHYzLYc06mHNGKy3 oj8dgiRTfgfnPTNFGUp/sV7MVTdUKFn+kGxv732pf/npvIePfWKCIjXuPn1tGx8AH3Wa sBxQ== X-Forwarded-Encrypted: i=1; AKwUvBwdit5kDwbzSrX+G0+3S3BGYKe3XK3fHHmrumQY5X7oxsX2IjOKXsWBNqbfzZNwXkIm2EHzxw==@lists.linux.dev X-Gm-Message-State: AFq9FYJ4Ycak6kJ3ozo8qR5oqqO3nNe3XODVEcmwA4Uhj5VsIh5zUdxc RSQulXceNMois5101SBnu8A6sSBGZnafpE4EvFNk/oqnhcFygpdWanA= X-Gm-Gg: AYBFou1JtRkDzhs8dJYzLO4LNTSOcD/pImZQNlPbrujU0VJN74p8yLotUEZ3Pi+OwmK BKn1/SNe2luhNY0fcpHCGlWEpjKTN7bQojdfcM4ilxTr/tXpsqYnd1Fn0xYwx9Sokg8JIFeyqTM mg2V9horpwgjk2xRwaXynU+RjGkvGXY9fphYg2ewt6Bg31SISwEBputyIfGN4oVGsYuaGB668BG Q4UoqdVuI0UU3WzqX8MGmWei/zQH3zZTfPINjLaaPw5S28AOAYdEzoAm6jVypGFSPwb1sHANU6d iL01/lei/C9h68cBFuwZEsp1trScdZ9PcassO0gT4uq2NQzfjCEwH6DhFbLzn01VBvtPx8kk9G0 OuUx1/LVqxlyUkEQdtF6uBWhUBIeBRVKCWt6uTFYk48XiAr0ZZEoLkn0OmILIWUMZiiWtMHeI+j QjGGOwGMg+89CXLhpyCUM2EVw3La6GT10bsQdF6afhBw9r7rEWTdWbcM8L+3ZVJcfRI+dx7VjSF nJVstXILyA0IizD0bMmi84r3iD7n0Td+kwZIXyt19FkKiv/0p0KOqpJukKijDNy5K8HGJmBaepG ARV347y+WKTfdQ1m2rYShMPYSnDkJB/DF9OM0mvjgalDynYPx/KjKIVlX+tQ3g== X-Received: by 2002:a05:693c:20c8:10b0:36a:1e0a:accb with SMTP id 5a478bee46e88-36a203e2f43mr7265770eec.35.1793264381578; Thu, 29 Oct 2026 01:59:41 -0700 (PDT) Received: from at-Standard-PC-Q35-ICH9-2009 ([27.60.20.232]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-36a23641e78sm16497937eec.0.2026.10.29.01.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2026 01:59:41 -0700 (PDT) From: Atharva Tiwari To: Cc: Atharva Tiwari , 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: [RFC PATCH 08/14] treewide: Add a flag to detect the Apple T2 chip Date: Thu, 29 Oct 2026 04:52:05 -0400 Message-ID: <20261029085504.3547-9-atharvatiwarilinuxdev@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261029085504.3547-1-atharvatiwarilinuxdev@gmail.com> References: <20261029085504.3547-1-atharvatiwarilinuxdev@gmail.com> X-Mailing-List: asahi@lists.linux.dev 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. 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