lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 19 Aug 2021 12:47:59 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Brijesh Singh <brijesh.singh@....com>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        linux-efi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-coco@...ts.linux.dev, linux-mm@...ck.org,
        linux-crypto@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Joerg Roedel <jroedel@...e.de>,
        Tom Lendacky <thomas.lendacky@....com>,
        "H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Sergio Lopez <slp@...hat.com>, Peter Gonda <pgonda@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        David Rientjes <rientjes@...gle.com>,
        Dov Murik <dovmurik@...ux.ibm.com>,
        Tobin Feldman-Fitzthum <tobin@....com>,
        Michael Roth <michael.roth@....com>,
        Vlastimil Babka <vbabka@...e.cz>, tony.luck@...el.com,
        brijesh.ksingh@...il.com
Subject: Re: [PATCH Part1 RFC v4 24/36] x86/compressed/acpi: move EFI config
 table access to common code

On Wed, Jul 07, 2021 at 01:14:54PM -0500, Brijesh Singh wrote:
> From: Michael Roth <michael.roth@....com>
> 
> Future patches for SEV-SNP-validated CPUID will also require early
> parsing of the EFI configuration. Move the related code into a set of
> helpers that can be re-used for that purpose.
> 
> Signed-off-by: Michael Roth <michael.roth@....com>
> Signed-off-by: Brijesh Singh <brijesh.singh@....com>
> ---
>  arch/x86/boot/compressed/Makefile           |   1 +
>  arch/x86/boot/compressed/acpi.c             | 124 +++++---------
>  arch/x86/boot/compressed/efi-config-table.c | 180 ++++++++++++++++++++
>  arch/x86/boot/compressed/misc.h             |  50 ++++++
>  4 files changed, 272 insertions(+), 83 deletions(-)
>  create mode 100644 arch/x86/boot/compressed/efi-config-table.c

arch/x86/boot/compressed/efi.c

should be good enough.

And in general, this patch is hard to review because it does a bunch of
things at the same time. You should split it:

- the first patch sould carve out only the functionality into helpers
without adding or changing the existing functionality.

- later ones should add the new functionality, in single logical steps.

Some preliminary comments below as far as I can:

> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 431bf7f846c3..b41aecfda49c 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -100,6 +100,7 @@ endif
>  vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o
>  
>  vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_thunk_$(BITS).o
> +vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi-config-table.o
>  efi-obj-$(CONFIG_EFI_STUB) = $(objtree)/drivers/firmware/efi/libstub/lib.a
>  
>  $(obj)/vmlinux: $(vmlinux-objs-y) $(efi-obj-y) FORCE
> diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
> index 8bcbcee54aa1..e087dcaf43b3 100644
> --- a/arch/x86/boot/compressed/acpi.c
> +++ b/arch/x86/boot/compressed/acpi.c
> @@ -24,42 +24,36 @@ struct mem_vector immovable_mem[MAX_NUMNODES*2];
>   * Search EFI system tables for RSDP.  If both ACPI_20_TABLE_GUID and
>   * ACPI_TABLE_GUID are found, take the former, which has more features.
>   */
> +#ifdef CONFIG_EFI
> +static bool
> +rsdp_find_fn(efi_guid_t guid, unsigned long vendor_table, bool efi_64,
> +	     void *opaque)
> +{
> +	acpi_physical_address *rsdp_addr = opaque;
> +
> +	if (!(efi_guidcmp(guid, ACPI_TABLE_GUID))) {
> +		*rsdp_addr = vendor_table;
> +	} else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID))) {
> +		*rsdp_addr = vendor_table;
> +		return false;

No "return false" in the ACPI_TABLE_GUID branch above? Maybe this has to
do with the preference to ACPI_20_TABLE_GUID.

In any case, this looks silly. Please do the iteration simple
and stupid without the function pointer and get rid of that
efi_foreach_conf_entry() thing - this is not firmware.

> diff --git a/arch/x86/boot/compressed/efi-config-table.c b/arch/x86/boot/compressed/efi-config-table.c
> new file mode 100644
> index 000000000000..d1a34aa7cefd
> --- /dev/null
> +++ b/arch/x86/boot/compressed/efi-config-table.c

...

> +/*

If you're going to add proper comments, make them kernel-doc. I.e., it
should start with

/**

and then use

./scripts/kernel-doc -none arch/x86/boot/compressed/efi-config-table.c

to check them all they're proper.


> + * Given boot_params, retrieve the physical address of EFI system table.
> + *
> + * @boot_params:        pointer to boot_params
> + * @sys_table_pa:       location to store physical address of system table
> + * @is_efi_64:          location to store whether using 64-bit EFI or not
> + *
> + * Returns 0 on success. On error, return params are left unchanged.
> + */
> +int
> +efi_bp_get_system_table(struct boot_params *boot_params,

There's no need for the "_bp_" - just efi_get_system_table(). Ditto for
the other naming.

I'll review the rest properly after you've split it.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ