From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D68740A93F for ; Mon, 27 Jul 2026 21:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785187116; cv=none; b=WMLSt8AGuPsCB59EK8xxCX55wFi4yo8CGy/0COMaYhaFF6tqLkW3ceutiuN2RrwcxefVEaookS+BmC6jXc3uNpcOmUNcZwD70n9OZzUqtH7dCy+qVncAytjpU4JD3aPfQQ8bEs6BWpwQnd+p0cQdTSGT/OI8IqxVO3bYVFc4HnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785187116; c=relaxed/simple; bh=G9P3Gm9X6VHormYF4PiT6UNlB1syHT2Cmg6ZgiMV8f8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JsUFWxfTThPKmOHifdoCaAP+paY9PAu85V00OtPPndPx/Ow+aROKWRt5/6jOhj5Y8zycg45CXtXA0wbMjhcP8eU3qBsIu75JA10G4dyaHpbIP7E8TlQF8XxGr8oK6OVNTFIDNR48EmCXF/Y2kg7UaB+jVTp2WCBMMA/X8F5yTcw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K5i2LVCP; arc=none smtp.client-ip=209.85.215.181 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.b="K5i2LVCP" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-c9cf07d2df6so2241864a12.2 for ; Mon, 27 Jul 2026 14:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785187114; x=1785791914; 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=/e05uQAC/MWsadOTV5ro3O8ihJOAfbb/VcbPjWI2HCQ=; b=K5i2LVCPZ2XO0tLyO2XD47rgx0M4ImH26RaBaZQxJwdu/ZHkKNROtznlKrEwtxkYTD 3LVzx7vY85nIRbe/5q2ZfVFDQsgmPzsONIcCkVr3JjSK+4Lkr2EW9X+p2fQQRIrM9s7D l3iTBFKdFQ1ZgRR/r4X3+BpqaUfIR4Dc7SH0ZgSUs4hUKxxbL2x5AodQuV7229UNzqF4 yVG6gbAZ/tJG3a8vx2L8ZH+QW/O+0OIG4PpzxUBgwfeb7BsZh0g8UwgLzibEgX5s4+kK y/awZOH5+zRb40DUdy+y3jaFoSSbKfL1mSvBrvajcZTw+OMsfOriKsReWaNH6ZLFIBQf LAHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785187114; x=1785791914; 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=/e05uQAC/MWsadOTV5ro3O8ihJOAfbb/VcbPjWI2HCQ=; b=VOVLEeZQCoMqk2hlZR+0U49KC8/kvTQ/3z3DltTKmO3F/eAXn9Fan88+jMVtvfzhGw ymyZmfuW/V1/T6lTQBBgmhqefx+lpW6+K/TqccvKX38PKNRtTSK2iDp/+HgxfTEskmlq 7qo6HmjMMlULBRVprAEsY7jJFkjuMs3ogwpXXjZKfBq1rT09wbXwwHeXoaUtbI8hvpvV No0QTJozzlbnxJaOHZheLsfnQuhQMFoQV/o/2+zrPjh2p2L5kn/uTu7e/DhZwqctJpM6 +Lu4zCtVZyOWv4EikQ8bmgd2x9ezEHI0AHlzZZZ6s+utM29ABeoFqeUiWdz/iKx8JrOS tccA== X-Forwarded-Encrypted: i=1; AHgh+RrVgkgYCgpdf3+Wxw6bKeZhMCERopKDoW6EM6eXIqz9AzFDdM+AlRKcRLtWinQNAxe0mG8aoip9SYdFgdE=@vger.kernel.org X-Gm-Message-State: AOJu0YwCOHL4Pbx6LCPx/dHspxuXt9a80WcaFK0ATQyek+y561Nui8cE 8StKdfFDD8cwZlGLxmElv9VYL70/UOgFsoisig9JyAwZzMt4s/f/eN8= X-Gm-Gg: AR+sD10n1ExOT5fjxZwINu2ltaU9WSuRZ9A/teORj/lIg+Nza3+QU4a7gpRUhLE+zHG RC+keIb317nKIZpevlEJ54HlHo6JW1jsttTdkKmUc3FMlK9AI0mzEwXoEPnTqz2a1IH/GLTCGD7 ssaF+F+c97eGh6soNEWobhzCaP7l4AbZqgpmRmgrmro8zuhMrd9FK1z9Eb3zjn57dDZisTyPD7j Z8oPsqJXOfxaliXrBbNULGFSc0emsZBRDIvtux+PldEMNfiS0VTQtNLOqo3DLfal1kqLoZoBeM5 WqZrar5y724FYwBr4l7VaBzZ7q+1X1fTTvPjAqb/Q1lGpoB1cCB6bx53X4bOgcTecDJbRwPQGsB 8j9riYC/qewWza7TqoFCsLV7ahTornpCDIXh26JYO4s4+LueXIeZHg/7Gj4Y/f1Ilc99Aqkb5aH ojsOUPUpNaEHrU0VuMi3ki9PUWjzrrq46K7qnnsGLIHHbPtZSIWszM2LD0nj0J1crBKnMZBXkHg kaS84R0ivC2HshMhqz2zho= X-Received: by 2002:a05:6a21:497:b0:3c3:96dd:9ecc with SMTP id adf61e73a8af0-3c6c8046134mr1094107637.57.1785187114177; Mon, 27 Jul 2026 14:18:34 -0700 (PDT) Received: from at-Standard-PC-Q35-ICH9-2009.. ([27.59.84.42]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314e17a6f5fsm7916699eec.31.2026.07.27.14.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 14:18:33 -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" , Andreas Noever , Mika Westerberg , Yehezkel Bernat , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jarkko Sakkinen , Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , Paul Moore , James Morris , "Serge E. Hallyn" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v5 1/2] treewide: Add a flag to detect the Apple T2 chip Date: Mon, 27 Jul 2026 17:18:02 -0400 Message-ID: <20260727211807.1223-2-atharvatiwarilinuxdev@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260727211807.1223-1-atharvatiwarilinuxdev@gmail.com> References: <20260727211807.1223-1-atharvatiwarilinuxdev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 a92f18db9610..6651e5d4d106 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 079e816c3c21..47b27dceab18 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 f92895cc50f6..a355f4400179 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 c0d6948446c3..b4096d4c828d 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.43.0