[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/efi: Fix Grub2 boot on arm64


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 2 Nov 2021 15:45:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tjwWGVTKUtax20fmTtf2tDRpp4RyO2cmOXoKcqufmQk=; b=j6uUXm1OW4b048jAkoyc17Ote7cKJlECeY1a7MpNB7yNdAdqy0lBfTXYL6znxvNtHrgxy3GYqiPR7KXNVUB7BatlJtzxf1F8tHUhMqEne4flVcJk1xFGQe62VagbOrV1Yr1DUf4IATgttWAeV3vPkx0mJ8/OCCaLubku63nH/5+agLfyRjvNVxbuuwT9AYNy4PtWMH8Xdj4S+v2joMgWGbE68ZqWwkxZgzG/LAtURxE5S34MUyH6Q5Pkp2dfpDikdgVZvo0RMCD5W12kwuIJv74HK0llTM7YCoYuiEDh/+Y/j8IUaGjZ+pr839CKWmG0tbEUmQ0ISsBl1uCMwkeQgA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dvuizsvHABtqjFt13zQWMzLVkqsb0tZ5S28Bsgfi9oLpsS1BquSzDMPYou387eqeOzyWgC7yFJ1UFGaIcGLjrXX/dHMaolm7vJbf4ToUnYoEd7sR8c89gff/u6GuAPiPNFl1IQ63eOsHOJFWSa5Wk56fW0IlUbcXFqunn9JHNh+HeW8cahWTGW75Eod5YKtLsOpYGYGbyaIu90qTS7gKW+vUc5jNeyYVMWmn7NQo0A011bdxz0Iue6VAW1e4/R+XOVxR67lE3h+xdMS3lD4iR+EY/+dyPCJ4YN7FE7OnuTM9cnEC2kdRrCV+6vYPCpnLIy67D0uPN8doSpKDxjcHpg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: bertrand.marquis@xxxxxxx, wei.chen@xxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 02 Nov 2021 14:45:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.11.2021 15:05, Luca Fancellu wrote:
> The code introduced by commit a1743fc3a9fe9b68c265c45264dddf214fd9b882
> ("arm/efi: Use dom0less configuration when using EFI boot") is
> introducing a problem to boot Xen using Grub2 on ARM machine using EDK2.
> 
> The problem comes from the function get_parent_handle(...) that inside
> uses the HandleProtocol on loaded_image->DeviceHandle, but the last
> is NULL, making Xen stop the UEFI boot.

According to my reading the UEFI spec doesn't (explicitly) allow for
this to be NULL. Could you clarify why this is the case? What other
information may end up being invalid / absent? Is e.g. read_section()
safe to use?

> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -449,6 +449,13 @@ static EFI_FILE_HANDLE __init 
> get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
>      CHAR16 *pathend, *ptr;
>      EFI_STATUS ret;
>  
> +    /*
> +     * If DeviceHandle is NULL, we can't use the SIMPLE_FILE_SYSTEM_PROTOCOL
> +     * to have access to the filesystem.
> +     */
> +    if ( !loaded_image->DeviceHandle )
> +        return NULL;

I couldn't find anything in the spec saying that NULL (a pointer with
the numeric value zero) could actually not be a valid handle. Could
you point me to text saying so?

> @@ -581,6 +588,8 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, 
> CHAR16 *name,
>      EFI_STATUS ret;
>      const CHAR16 *what = NULL;
>  
> +    if ( !dir_handle )
> +        blexit(L"Error: No access to the filesystem");

dir_handle also gets passed to efi_arch_cfg_file_{early,late}() -
those don't need any adjustment only because they merely pass the
parameter on to read_file()?

> @@ -1333,6 +1342,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
> *SystemTable)
>              EFI_FILE_HANDLE handle = get_parent_handle(loaded_image,
>                                                         &file_name);
>  
> +            if ( !handle )
> +                blexit(L"Error retrieving image name: no filesystem access");

I don't think this should be fatal - see the comment ahead of the
enclosing if().

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.