Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1528315rdb; Mon, 8 Jan 2024 02:00:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEp8IiTiySmKptAfEK/NKMgAcC+3A0EBiZxjg9/C7AWxFy+SZCk7bauguzbl3emk2xcjU8D X-Received: by 2002:a05:6902:4c7:b0:dbd:5aae:2f75 with SMTP id v7-20020a05690204c700b00dbd5aae2f75mr1107261ybs.100.1704708001622; Mon, 08 Jan 2024 02:00:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704708001; cv=none; d=google.com; s=arc-20160816; b=mbOueWCe9mV7NLk/KsMP7pkQrRtxMBi3iTMqaALP9btDco9R3d6jQ1DmbqrLVy4b4h vnzApOWz9nN92zbr9VjA9/2NFCfWCaMLsWxRSkbopxAKDI0VGjp/a7IHG7ILnOS5shbl ntgwG7KHlxAISPlIe6khTfhphQcTrXMyYldA+Y0394aYmZ5YKWse+fvGpM26t89YsRu/ T8sJYLNoBY0xKDSlXKKYL7I9mEuxltAhTKROpUFreEJyrlbVDZcRmTb7MwR+8W68GhcO RGzc/xavUK88WIofmgfCX8CbszTSD2jN5Nb/EsvyIEl1tl70bO/SskbvkxtPjVYyu/63 tjrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+9cuiaFBoH53rifqhpcKmv1PSCTBZIUqSH8muwBZX6s=; fh=3EXpYsI7hLQV0a9eUbfkxmF0Cz25dlM5iw5kZeQ5VbU=; b=iJ9Mm895DnOWF1PYfBh4YPgMg4/JZGF7BmxTqLS2Ejxp5wHT1UaEeMWaaA0iA3E8G6 ewQd79/VHyLNv426mRmvtrp77/qQRZjWA3Gobc2AQ7d6o16He0NRwPMct0wplYriVG9x yfC4njmyQoLsjP4il06hTmyAKpvaK7mFI1iII6YOgUnyBztFUvSxg1zzsiM/Hw9D1A5J eh3iKtPfgPYzoq9tDobgsyCj+w322Kg92je3E6MYfdHWYGVSVrMWsKzM3knyMdvQRqAa //03Yc+qgEkew+icNQ8NeSv5mDBClg93QLFVZghFZ/+/pwwk1c8jQGAc6VMLfo422Db6 AR/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-19308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w4-20020ac87e84000000b0042993049221si2265891qtj.253.2024.01.08.02.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 02:00:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-19308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 608481C20835 for ; Mon, 8 Jan 2024 10:00:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96A261429B; Mon, 8 Jan 2024 09:59:11 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 89D2D12B84; Mon, 8 Jan 2024 09:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AB47E1F799; Mon, 8 Jan 2024 09:59:07 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 34C0A1392C; Mon, 8 Jan 2024 09:59:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GDHEC2vHm2XFMwAAD6G6ig (envelope-from ); Mon, 08 Jan 2024 09:59:07 +0000 From: Thomas Zimmermann To: ardb@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, bhelgaas@google.com, arnd@arndb.de, zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, javierm@redhat.com Cc: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v4 3/4] arch/x86: Implement arch_ima_efi_boot_mode() in source file Date: Mon, 8 Jan 2024 10:57:29 +0100 Message-ID: <20240108095903.8427-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240108095903.8427-1-tzimmermann@suse.de> References: <20240108095903.8427-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: AB47E1F799 Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -4.00 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] The x86 implementation of arch_ima_efi_boot_mode() uses the global boot_param state. Move it into a source file to clean up the header. Avoid potential rebuilds of unrelated source files if boot_params changes. Suggested-by: Ard Biesheuvel Signed-off-by: Thomas Zimmermann --- arch/x86/include/asm/efi.h | 5 +++-- arch/x86/platform/efi/efi.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index a5d7a83e4c2a..1dc600fa3ba5 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -409,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, void *buf, struct efi_mem_range *mem); -#define arch_ima_efi_boot_mode \ - ({ extern struct boot_params boot_params; boot_params.secure_boot; }) +extern enum efi_secureboot_mode __x86_ima_efi_boot_mode(void); + +#define arch_ima_efi_boot_mode __x86_ima_efi_boot_mode() #ifdef CONFIG_EFI_RUNTIME_MAP int efi_get_runtime_map_size(void); diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index e9f99c56f3ce..f090ec972d7b 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) } return attr->mode; } + +enum efi_secureboot_mode __x86_ima_efi_boot_mode(void) +{ + return boot_params.secure_boot; +} -- 2.43.0