public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>,
	Alexander Graf <agraf@csgraf.de>,
	Jesper Schmitz Mouridsen <jesper@schmitz.computer>,
	Simon Glass <sjg@chromium.org>,
	u-boot@lists.denx.de
Subject: Re: [PATCH] efi: Restrict the simple file system protocol to support only FAT
Date: Thu, 3 Jun 2021 11:50:06 +0900	[thread overview]
Message-ID: <20210603025006.GA63177@laputa> (raw)
In-Reply-To: <162268667641.382839.15360535926598237804.stgit@localhost>

On Thu, Jun 03, 2021 at 11:17:56AM +0900, Masami Hiramatsu wrote:
> Because UEFI specification v2.9, 13.3 File System Format said "The
> file system supported by the Extensible Firmware Interface is based
> on the FAT file system.", the simple file system protocol might be
> better to support only FAT filesystem.

If I remember correctly, Heinrich rejected the idea a long time ago.

When I posted the commit 867400677cda ("efi_loader: disk: install
FILE_SYSTEM_PROTOCOL only if available"), he insisted that the UEFI
specification does require FAT support but that it doesn't deny
any support for other file systems.
So I had to change the code, allowing FS_TYPE_ANY.

-Takahiro Akashi

> There must be no problem from UEFI application to access only FAT
> because ESP must be formatted by FAT32 and the removable media is
> FAT12 or FAT16, according to the UEFI spec.
> 
> Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> ---
>  lib/efi_loader/efi_disk.c |   18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 307d5d759b..f69ae6587f 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -318,19 +318,25 @@ efi_fs_from_path(struct efi_device_path *full_path)
>  }
>  
>  /**
> - * efi_fs_exists() - check if a partition bears a file system
> + * efi_supported_fs_exists() - check if a partition bears a supported file system
>   *
>   * @desc:	block device descriptor
>   * @part:	partition number
> - * Return:	1 if a file system exists on the partition
> + * Return:	1 if a supported file system exists on the partition
>   *		0 otherwise
>   */
> -static int efi_fs_exists(struct blk_desc *desc, int part)
> +static int efi_supported_fs_exists(struct blk_desc *desc, int part)
>  {
>  	if (fs_set_blk_dev_with_part(desc, part))
>  		return 0;
>  
> -	if (fs_get_type() == FS_TYPE_ANY)
> +	/*
> +	 * Because UEFI specification v2.9, 13.3 File System Format said
> +	 * "The file system supported by the Extensible Firmware Interface
> +	 * is based on the FAT file system.", the simple file system protocol
> +	 * should support only FAT filesystem.
> +	 */
> +	if (fs_get_type() != FS_TYPE_FAT)
>  		return 0;
>  
>  	fs_close();
> @@ -428,10 +434,10 @@ static efi_status_t efi_disk_add_dev(
>  
>  	/*
>  	 * On partitions or whole disks without partitions install the
> -	 * simple file system protocol if a file system is available.
> +	 * simple file system protocol if a supported file system exists.
>  	 */
>  	if ((part || desc->part_type == PART_TYPE_UNKNOWN) &&
> -	    efi_fs_exists(desc, part)) {
> +	    efi_supported_fs_exists(desc, part)) {
>  		diskobj->volume = efi_simple_file_system(desc, part,
>  							 diskobj->dp);
>  		ret = efi_add_protocol(&diskobj->header,
> 

  parent reply	other threads:[~2021-06-03  2:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03  2:17 [PATCH] efi: Restrict the simple file system protocol to support only FAT Masami Hiramatsu
2021-06-03  2:27 ` Masami Hiramatsu
2021-06-03  2:50 ` AKASHI Takahiro [this message]
2021-06-03  3:53   ` Masami Hiramatsu
2021-06-03  4:03 ` Heinrich Schuchardt
2021-06-03  4:57   ` Masami Hiramatsu
2021-06-03  5:15     ` Heinrich Schuchardt
2021-06-03  5:39       ` Masami Hiramatsu
2021-06-03  6:14         ` Heinrich Schuchardt
2021-06-03  6:52           ` Masami Hiramatsu
2021-06-03  6:24         ` Ilias Apalodimas
2021-06-03  6:36           ` Masami Hiramatsu
2021-06-03  6:47             ` Ilias Apalodimas

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=20210603025006.GA63177@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=jesper@schmitz.computer \
    --cc=masami.hiramatsu@linaro.org \
    --cc=sakamoto.kazuhiko@socionext.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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