From patchwork Wed Dec 6 12:38:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 174567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4081782vqy; Wed, 6 Dec 2023 04:54:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7DBo/XyRMxQUqM/biCZD2b6LVvRZx12I0hvglr0GO/TZdG11z3z3WX1sQTU6FcdD6dWxd X-Received: by 2002:a17:902:eb88:b0:1d0:6ffd:f230 with SMTP id q8-20020a170902eb8800b001d06ffdf230mr630390plg.134.1701867293877; Wed, 06 Dec 2023 04:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701867293; cv=none; d=google.com; s=arc-20160816; b=auiuL8cjvnTQ30dH6rT3etMbj6dShmQ6pt+xh9f/IDRmHgkRLpjVCzMwq+N7QzMvi/ bbegNk+RPXn4iR5gM4ZAoXQyRiU6u0HlkRdTUFRWHpjQhKn58mkSL6QVoZsNmRT1ahVW d+iLJqiIGQ3KPOFv8QHkaPJG9S6FVkoR6/jExiLi8UBZ2jgZv0NQFIPlIs6XyKt0HSsF c4QznulO0jxqysmNj62OcFddX4rT7cihHWZol/sMIGo6zxqKN+uw3voVNoFReCgkB61S /j64aCNBAChXh4aNuracSVZkFWo7E18n9UcWeqvqaSGTetborc3MNG4vQLroS/zFQvCm Fa1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Qj72gcam6ZOgbPA7jLBKhrKJdI1UayiC+aw5zIvz5kc=; fh=3EXpYsI7hLQV0a9eUbfkxmF0Cz25dlM5iw5kZeQ5VbU=; b=zH8nkxbklZC1ddAIdN0k10ebdpjAVRydlbfnM1raDsprUsD3AjLJMPbw64dIj10/uj UDvksGL3NalM2B3yWO4ujhQLzuOchxw1EiwEMkuKEdBNWPltf0otPnWaiaiCvGsYe4Hy dQ6CpWVf9Eh8pDvrs0cFiKCIviI3Ee8MPf9w0Jq0CaIGkX1C13ThPvoqf7kbsDU8zTIE JA/iu/zSKNDFCcHa/+RLskkBj/e2XGR+pZocWRUdLv/Tzh/OaJiDSzJo3wRTD/uKvUah PkIgntxgawDFsOwcKtCTq2G53IwAY9KtorWVco24y3s99suqZbRPNgwzxEDuarQKBsRf YrYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=v8TF6YlG; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id m16-20020a170902db1000b001cfc3295702si2157642plx.109.2023.12.06.04.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 04:54:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=v8TF6YlG; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 78FA5826ED22; Wed, 6 Dec 2023 04:54:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378222AbjLFMye (ORCPT + 99 others); Wed, 6 Dec 2023 07:54:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378112AbjLFMyc (ORCPT ); Wed, 6 Dec 2023 07:54:32 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D5021A5; Wed, 6 Dec 2023 04:54:38 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 2D3A31FD0D; Wed, 6 Dec 2023 12:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1701867276; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qj72gcam6ZOgbPA7jLBKhrKJdI1UayiC+aw5zIvz5kc=; b=v8TF6YlGTAT1dsLbU/AVFy+6XxDM+kdUJtr49J2z3Bw3ADPgdGoUrU2R8jqYhHSEotD2qb aQTWPlmzT0sXvVmlPhIA9GMJ36dp/FzFtQ04p405WlZm4+BbXY8RQiXbrsKpwDszp9bh9k g4cJ069YEwpwDP5TnEN5bXCKmHeVAUI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1701867276; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qj72gcam6ZOgbPA7jLBKhrKJdI1UayiC+aw5zIvz5kc=; b=/P2CsblDpuVxsZ2yqCSmzm+k2EfrrjxiEkHJLU5p8b7TLQmLZqvccqgBsvL2ofBonAkkcn h4Y9dyfCFjPcD5Dw== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id A25AE13B3C; Wed, 6 Dec 2023 12:54:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id AORtJgtvcGV6dAAAn2gu4w (envelope-from ); Wed, 06 Dec 2023 12:54:35 +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 1/3] arch/x86: Move struct pci_setup_rom into pci_setup.h Date: Wed, 6 Dec 2023 13:38:37 +0100 Message-ID: <20231206125433.18420-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206125433.18420-1-tzimmermann@suse.de> References: <20231206125433.18420-1-tzimmermann@suse.de> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 3.20 X-Spamd-Result: default: False [3.20 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWELVE(0.00)[22]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FREEMAIL_TO(0.00)[kernel.org,linutronix.de,redhat.com,alien8.de,linux.intel.com,zytor.com,google.com,arndb.de,linux.ibm.com,gmail.com,paul-moore.com,namei.org,hallyn.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 04:54:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784537199613063123 X-GMAIL-MSGID: 1784537199613063123 The type definition of struct pci_setup_rom in requires struct setup_data from . Many drivers include , but do not use boot parameters. Changes to bootparam.h or its included header files could easily trigger a large, unnecessary rebuild of the kernel. Moving struct pci_setup_rom into its own header file avoid including in . Update the only two users of the struct in the x86 PCI code and in the EFI code. Also remove the include statement for x86_init.h, which is unnecessary but pulls in bootparams.h. Signed-off-by: Thomas Zimmermann --- arch/x86/include/asm/pci.h | 13 ------------- arch/x86/include/asm/pci_setup.h | 19 +++++++++++++++++++ arch/x86/pci/common.c | 1 + drivers/firmware/efi/libstub/x86-stub.c | 1 + 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 arch/x86/include/asm/pci_setup.h diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index b40c462b4af3..b3ab80a03365 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -10,7 +10,6 @@ #include #include #include -#include struct pci_sysdata { int domain; /* PCI domain */ @@ -124,16 +123,4 @@ cpumask_of_pcibus(const struct pci_bus *bus) } #endif -struct pci_setup_rom { - struct setup_data data; - uint16_t vendor; - uint16_t devid; - uint64_t pcilen; - unsigned long segment; - unsigned long bus; - unsigned long device; - unsigned long function; - uint8_t romdata[]; -}; - #endif /* _ASM_X86_PCI_H */ diff --git a/arch/x86/include/asm/pci_setup.h b/arch/x86/include/asm/pci_setup.h new file mode 100644 index 000000000000..b4b246ef6f2b --- /dev/null +++ b/arch/x86/include/asm/pci_setup.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_PCI_SETUP_H +#define _ASM_X86_PCI_SETUP_H + +#include + +struct pci_setup_rom { + struct setup_data data; + uint16_t vendor; + uint16_t devid; + uint64_t pcilen; + unsigned long segment; + unsigned long bus; + unsigned long device; + unsigned long function; + uint8_t romdata[]; +}; + +#endif /* _ASM_X86_PCI_SETUP_H */ diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index ddb798603201..c6cbb9182160 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 1bfdae34df39..0c878ebe5257 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "efistub.h" #include "x86-stub.h" From patchwork Wed Dec 6 12:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 174569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4081954vqy; Wed, 6 Dec 2023 04:55:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8Ft0r8GCgNhz/9iV9mpQ4lcTUeZKh1LkgoMImGDHER6eX50G+MpCHrTIPmOf4MA2T5vZA X-Received: by 2002:a05:6a20:a498:b0:18f:97c:8a51 with SMTP id y24-20020a056a20a49800b0018f097c8a51mr735860pzk.124.1701867316060; Wed, 06 Dec 2023 04:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701867316; cv=none; d=google.com; s=arc-20160816; b=y0kvSmnnM9YFI7mLvEvHL9NdVNXQUBxxyo+X15nFxM9hsrwwydRcvN9KCpvzIyLP0p wpQrmXDGWH9E+WfBTTHqKijNPMObK0xKFpYDdL9zUYsMnbshmyFcvP3IUGJGNLFevlVB 35fhRokuNJfUJf1NKRl2h1yj7gzZPik759IJbU1oFgXxRS+hOxHyCDNjB9MNRRWftC+m 9hJpcsFNXJ7MkbzFNHUE++XElVSaIaH7LRQLzZ/PfA6onKa7LxfK35LilyZVuR9EmQZH kNQYBQbBPTODJrsam0W1/uVHr7LHzLT2ccXlppOCEx1klX3BvsNxKvFQxRtHfyt349Th 63Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JzPj2MtM74V2UciUm10S/hZD0oPPPOX5f1O6bzhZN1M=; fh=3EXpYsI7hLQV0a9eUbfkxmF0Cz25dlM5iw5kZeQ5VbU=; b=d6PcbHaGKi/t4OP1PDorDdxMPYjPSzppcIzz0MrWqa8Q9uIHYIY9MPw7zju8s70LKp DV8I5CTPcuNdDQjFPdPiJVHvwJuX3tuq3nRQBycTDxDzZpTNEodv6w8EKDFAA+bwl3nh PtxbJC3JT/4F4+rXXew3isys16gLNOaBuHNaKM1e1POI5OIpgwXKc+OB1rQ7PZ1kQxil dUGPyPUgl2m5SUgMGiaJWUTL462Djl30o83fyaPPX4rhV+9Meri4jG6vxxIMy5HqwIOm tEXHoA4b6iNogw9vVxUfzkH74V5TP1erLdCoxvHaCdS6HmGT41KgzuzoRQdfRAkbid4m fORw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b3-20020a056a000cc300b006ce499d7befsi5878310pfv.41.2023.12.06.04.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 04:55:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 89CC380505DB; Wed, 6 Dec 2023 04:55:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378112AbjLFMyg (ORCPT + 99 others); Wed, 6 Dec 2023 07:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378169AbjLFMyc (ORCPT ); Wed, 6 Dec 2023 07:54:32 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322591BD; Wed, 6 Dec 2023 04:54:38 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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-out1.suse.de (Postfix) with ESMTPS id B204321EFD; Wed, 6 Dec 2023 12:54:36 +0000 (UTC) Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 341EC13403; Wed, 6 Dec 2023 12:54:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id gGSICwxvcGV6dAAAn2gu4w (envelope-from ); Wed, 06 Dec 2023 12:54:36 +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 2/3] arch/x86: Add for arch_ima_efi_boot_mode Date: Wed, 6 Dec 2023 13:38:38 +0100 Message-ID: <20231206125433.18420-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206125433.18420-1-tzimmermann@suse.de> References: <20231206125433.18420-1-tzimmermann@suse.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: B204321EFD X-Spam-Score: 3.49 X-Spamd-Result: default: False [3.49 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(0.00)[~all]; R_RATELIMIT(0.00)[to_ip_from(RL8bnzzinbm939qqjaserdumcx)]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[]; FREEMAIL_TO(0.00)[kernel.org,linutronix.de,redhat.com,alien8.de,linux.intel.com,zytor.com,google.com,arndb.de,linux.ibm.com,gmail.com,paul-moore.com,namei.org,hallyn.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWELVE(0.00)[22]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(0.10)[suse.de : No valid SPF, No valid DKIM,none] X-Spamd-Bar: +++ Authentication-Results: smtp-out1.suse.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=suse.de (policy=none); spf=softfail (smtp-out1.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of tzimmermann@suse.de) smtp.mailfrom=tzimmermann@suse.de X-Rspamd-Server: rspamd1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 06 Dec 2023 04:55:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784537222899863352 X-GMAIL-MSGID: 1784537222899863352 The header file contains the macro arch_ima_efi_boot_mode, which expands to use struct boot_params from . Many drivers include , but do not use boot parameters. Changes to bootparam.h or its included headers can easily trigger large, unnessary rebuilds of the kernel. Moving x86's arch_ima_efi_boot_mode to and including separates that dependency from the rest of the EFI interfaces. The only user is in ima_efi.c. As the file already declares a default value for arch_ima_efi_boot_mode, move this define into asm-generic for all other architectures. With arch_ima_efi_boot_mode removed from efi.h, can later be removed from further x86 header files. Signed-off-by: Thomas Zimmermann --- arch/x86/include/asm/efi.h | 3 --- arch/x86/include/asm/ima-efi.h | 12 ++++++++++++ include/asm-generic/Kbuild | 1 + include/asm-generic/ima-efi.h | 16 ++++++++++++++++ security/integrity/ima/ima_efi.c | 5 +---- 5 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 arch/x86/include/asm/ima-efi.h create mode 100644 include/asm-generic/ima-efi.h diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index c4555b269a1b..99f31176c892 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -418,9 +418,6 @@ 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; }) - #ifdef CONFIG_EFI_RUNTIME_MAP int efi_get_runtime_map_size(void); int efi_get_runtime_map_desc_size(void); diff --git a/arch/x86/include/asm/ima-efi.h b/arch/x86/include/asm/ima-efi.h new file mode 100644 index 000000000000..3fe054937077 --- /dev/null +++ b/arch/x86/include/asm/ima-efi.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_IMA_EFI_H +#define _ASM_X86_IMA_EFI_H + +#include + +#define arch_ima_efi_boot_mode \ + ({ extern struct boot_params boot_params; boot_params.secure_boot; }) + +#include + +#endif /* _ASM_X86_IMA_EFI_H */ diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild index def242528b1d..4fd16e71e8cd 100644 --- a/include/asm-generic/Kbuild +++ b/include/asm-generic/Kbuild @@ -26,6 +26,7 @@ mandatory-y += ftrace.h mandatory-y += futex.h mandatory-y += hardirq.h mandatory-y += hw_irq.h +mandatory-y += ima-efi.h mandatory-y += io.h mandatory-y += irq.h mandatory-y += irq_regs.h diff --git a/include/asm-generic/ima-efi.h b/include/asm-generic/ima-efi.h new file mode 100644 index 000000000000..f87f5edef440 --- /dev/null +++ b/include/asm-generic/ima-efi.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __ASM_GENERIC_IMA_EFI_H_ +#define __ASM_GENERIC_IMA_EFI_H_ + +#include + +/* + * Only include this header file from your architecture's . + */ + +#ifndef arch_ima_efi_boot_mode +#define arch_ima_efi_boot_mode efi_secureboot_mode_unset +#endif + +#endif /* __ASM_GENERIC_FB_H_ */ diff --git a/security/integrity/ima/ima_efi.c b/security/integrity/ima/ima_efi.c index 138029bfcce1..56bbee271cec 100644 --- a/security/integrity/ima/ima_efi.c +++ b/security/integrity/ima/ima_efi.c @@ -6,10 +6,7 @@ #include #include #include - -#ifndef arch_ima_efi_boot_mode -#define arch_ima_efi_boot_mode efi_secureboot_mode_unset -#endif +#include static enum efi_secureboot_mode get_sb_mode(void) { From patchwork Wed Dec 6 12:38:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 174568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4081941vqy; Wed, 6 Dec 2023 04:55:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPSKHa1xi54hQEU1Z017ygiaZShn98Ui5lKD77C41tTEeVcb3DqAQNXs7MJ6zm51Dulr2R X-Received: by 2002:a17:90b:3b50:b0:286:900c:71ef with SMTP id ot16-20020a17090b3b5000b00286900c71efmr1315174pjb.23.1701867314927; Wed, 06 Dec 2023 04:55:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701867314; cv=none; d=google.com; s=arc-20160816; b=IRB8anE1Xq6kF6nwNENzbXzvtq60bffMME3CzKsUJi4ZjUlBRtRI6nNNPvgKMOWsn4 3zo141AI3DTPit0ULralHSDWBgl6AaMZ42wyZPPii9/T/SLs+1wfkt+u63IIXzNK/V+I 184/9Px38Ssxptszyrr+x7diJ+gQkazDdJNbzjFZvQZ4Kv9AdCiTbb+9kG72eNzt1j8B 4KnslJgX8dD0lvkKP/hxBz44t3mHo9dAmCs6N/0yvvHwYKLNIlWha3DHgHk76MtfeGos RzAG+SeDeGPtSFuCglZeZ2E3q6IhCBJyDkwL8JUkH39xRS1E94wzWxoLiXkYqTK0I9YZ i6Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=vgAv+rqLbU6w0LVClulr1cB9z6lInpwbja3q5sciudk=; fh=3EXpYsI7hLQV0a9eUbfkxmF0Cz25dlM5iw5kZeQ5VbU=; b=aIUKOiUR1EvdRd1WG3MDt8U75tsDdmGCF5pzvpFQ6bIcA1Meb8qWyE/J56juIUvsZY tuLdAi2ET1vBqHakrCMXXVHO9BwjMrzy1hVr2Ldbja2s6ygSTbuk8AI1IT/iewu76dZh lTHNSgF8qWM/xiiMjMA46KUCo6p4ep3scWBcTeL2CaDUxl49aoyg7h46OmebzgaSmRhJ c+FFAhubNl2lgPWRGVsTQ8dl66zuqWwHSgW8Yix0uUtA8iFEO2LC8VK9fRuBmL/O7wEy RzbMxfFptYSje5NUGoSAm5VGR2bbsFAdhgOgY1DMRyyKv2K1IoGj0JbQl5kHcPm+liTM FUBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=k5hz+99R; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cn6-20020a17090af08600b002859aae3eaasi5058312pjb.66.2023.12.06.04.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 04:55:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=k5hz+99R; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DF78C80C3A39; Wed, 6 Dec 2023 04:55:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378352AbjLFMyi (ORCPT + 99 others); Wed, 6 Dec 2023 07:54:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378195AbjLFMyc (ORCPT ); Wed, 6 Dec 2023 07:54:32 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4717D3; Wed, 6 Dec 2023 04:54:38 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 3FEB41FD0E; Wed, 6 Dec 2023 12:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1701867277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vgAv+rqLbU6w0LVClulr1cB9z6lInpwbja3q5sciudk=; b=k5hz+99RYKwZsroqjLBxkB/U3C5hKqBgas0nloQbvkUq3oSf38JP79Bgi5oXNYxtGotrFc A8g1vcs+lZjQCSL5ETYEY2e2V3KiWDbekLlr1f8eyZLus1QKpcCpDj1FknH4RFL9xZWjH8 eZ/1Wb41ky8XwGTT8Q+NgQl0SurWYyI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1701867277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vgAv+rqLbU6w0LVClulr1cB9z6lInpwbja3q5sciudk=; b=qcsCDE6KXwKVocclIX+Mj5qpbPQv11BgmfV/NvxP84Kx+mUcswyGkXGCGNOlLn7JYX1c/X B8IOFuD33BSoyEDw== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id B8ED713B3C; Wed, 6 Dec 2023 12:54:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id uPn0KwxvcGV6dAAAn2gu4w (envelope-from ); Wed, 06 Dec 2023 12:54:36 +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 3/3] arch/x86: Do not include in several header files Date: Wed, 6 Dec 2023 13:38:39 +0100 Message-ID: <20231206125433.18420-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206125433.18420-1-tzimmermann@suse.de> References: <20231206125433.18420-1-tzimmermann@suse.de> MIME-Version: 1.0 X-Spam-Score: 3.40 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [3.40 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLthqzz6q5hnubohss7ffybi86)]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[22]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FREEMAIL_TO(0.00)[kernel.org,linutronix.de,redhat.com,alien8.de,linux.intel.com,zytor.com,google.com,arndb.de,linux.ibm.com,gmail.com,paul-moore.com,namei.org,hallyn.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 04:55:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784537221578966224 X-GMAIL-MSGID: 1784537221578966224 Remove the include statement for from several header files that don't require it. Limits the exposure of the boot parameters within the Linux kernel code. Signed-off-by: Thomas Zimmermann Acked-by: Ard Biesheuvel --- arch/x86/include/asm/kexec.h | 1 - arch/x86/include/asm/mem_encrypt.h | 2 +- arch/x86/include/asm/sev.h | 3 ++- arch/x86/include/asm/x86_init.h | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index c9f6a6c5de3c..91ca9a9ee3a2 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -25,7 +25,6 @@ #include #include -#include struct kimage; diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 359ada486fa9..c1a8a3408c18 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -15,7 +15,7 @@ #include #include -#include +struct boot_params; #ifdef CONFIG_X86_MEM_ENCRYPT void __init mem_encrypt_init(void); diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h index 5b4a1ce3d368..8dad8b1613bf 100644 --- a/arch/x86/include/asm/sev.h +++ b/arch/x86/include/asm/sev.h @@ -13,7 +13,6 @@ #include #include -#include #include #define GHCB_PROTOCOL_MIN 1ULL @@ -22,6 +21,8 @@ #define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); } +struct boot_params; + enum es_result { ES_OK, /* All good */ ES_UNSUPPORTED, /* Requested operation not supported */ diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index c878616a18b8..f062715578a0 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -2,8 +2,6 @@ #ifndef _ASM_X86_PLATFORM_H #define _ASM_X86_PLATFORM_H -#include - struct ghcb; struct mpc_bus; struct mpc_cpu;