From: Thomas Zimmermann <tzimmermann@suse.de>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: 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,
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
Subject: Re: [PATCH v2 2/3] arch/x86: Add <asm/ima-efi.h> for arch_ima_efi_boot_mode
Date: Wed, 3 Jan 2024 14:45:28 +0100 [thread overview]
Message-ID: <71c8ef97-5824-4f82-8fc1-d0bb2bc8cc03@suse.de> (raw)
In-Reply-To: <CAMj1kXF-1TXYzheS-e_rGKnV+6FrkZe+e2sfCixyUzxSQE7X6w@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2733 bytes --]
Hi
Am 03.01.24 um 14:11 schrieb Ard Biesheuvel:
> On Tue, 2 Jan 2024 at 15:07, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> Hii Ard
>>
>> Am 19.12.23 um 12:38 schrieb Ard Biesheuvel:
>>> Hi Thomas,
>>>
>>> On Fri, 15 Dec 2023 at 13:26, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>>
>>>> The header file <asm/efi.h> contains the macro arch_ima_efi_boot_mode,
>>>> which expands to use struct boot_params from <asm/bootparams.h>. Many
>>>> drivers include <linux/efi.h>, 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 <asm/ima-efi.h> and including
>>>> <asm/setup.h> 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, <asm/bootparam.h> can
>>>> later be removed from further x86 header files.
>>>>
>>>
>>> Apologies if I missed this in v1 but is the new asm-generic header
>>> really necessary? Could we instead turn arch_ima_efi_boot_mode into a
>>> function that is a static inline { return unset; } by default, but can
>>> be emitted out of line in one of the x86/platform/efi.c source files,
>>> where referring to boot_params is fine?
>>
>> I cannot figure out how to do this without *something* in asm-generic or
>> adding if-CONFIG_X86 guards in ima-efi.c.
>>
>> But I noticed that linux/efi.h already contains 2 or 3 ifdef branches
>> for x86. Would it be an option to move this code into asm/efi.h
>> (including a header file in asm-generic for the non-x86 variants) and
>> add the arch_ima_efi_boot_mode() helper there as well? At least that
>> wouldn't be a header for only a single define.
>>
>
> Could we just move the x86 implementation out of line?
>
> So something like this in arch/x86/include/asm/efi.h
>
> enum efi_secureboot_mode x86_ima_efi_boot_mode(void);
> #define arch_ima_efi_boot_mode x86_ima_efi_boot_mode()
>
> and an implementation in one of the related .c files:
>
> enum efi_secureboot_mode x86_ima_efi_boot_mode(void)
> {
> return boot_params.secure_boot;
> }
>
> ?
Well, that's just enough to avoid boot_params within the header file.
But it should work.
Best regards
Thomas
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2024-01-03 13:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 12:18 [PATCH v2 0/3] arch/x86: Remove unnecessary dependencies on bootparam.h Thomas Zimmermann
2023-12-15 12:18 ` [PATCH v2 1/3] arch/x86: Move UAPI setup structures into setup_data.h Thomas Zimmermann
2023-12-19 10:50 ` Ard Biesheuvel
2024-01-02 14:02 ` Thomas Zimmermann
2023-12-15 12:18 ` [PATCH v2 2/3] arch/x86: Add <asm/ima-efi.h> for arch_ima_efi_boot_mode Thomas Zimmermann
2023-12-19 11:38 ` Ard Biesheuvel
2024-01-02 14:07 ` Thomas Zimmermann
2024-01-03 13:11 ` Ard Biesheuvel
2024-01-03 13:45 ` Thomas Zimmermann [this message]
2023-12-15 12:18 ` [PATCH v2 3/3] arch/x86: Do not include <asm/bootparam.h> in several header files Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71c8ef97-5824-4f82-8fc1-d0bb2bc8cc03@suse.de \
--to=tzimmermann@suse.de \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=hpa@zytor.com \
--cc=javierm@redhat.com \
--cc=jmorris@namei.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).