From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 896D8C4708F for ; Thu, 3 Jun 2021 02:50:21 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95B67613E6 for ; Thu, 3 Jun 2021 02:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95B67613E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B8CB82F44; Thu, 3 Jun 2021 04:50:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MEKnm5xm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7944A82F45; Thu, 3 Jun 2021 04:50:16 +0200 (CEST) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2B9F382EF0 for ; Thu, 3 Jun 2021 04:50:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x62e.google.com with SMTP id x10so2139403plg.3 for ; Wed, 02 Jun 2021 19:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=q096xdnldF/PCIpwYjtAXI55+c0VEsbHUUFUy16Yi2M=; b=MEKnm5xmvbvbO5FQer0VyhxYwPeYkHzA+9WgXpOiprUVphR2+lKGJ29qAnXSByXF27 3JHB1JyaPY6lkCRR68AP+//zKNueu83I+9hG+yPAEEseDaWFKKPcL0HJK62DeglHe0pq TCw0J9mPqFGm4rPpxYWjLWmBxHzyLB2XzMsCQEFkg0XeI6FkRQrb+vActHvGADmeha2R 5KENc+T72kKS2eMj1SiotPnFPNwCtREdeqcFgLVIlCJe/1QX9yMQOSOBFDRBaohbkb+Y czBVtiRdA92n814v7JR1a4Wgx2Gvdk9uRp4VbsrH0h3JyVH9HKpi3ytwNFH0bBI2NEYZ V6RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=q096xdnldF/PCIpwYjtAXI55+c0VEsbHUUFUy16Yi2M=; b=ECjjXgFt8p5krRcxtcyjgiqXdQY55b38bcT1EbFN/eowivoE6c92917C6un8UnyHqq u7PGiyS7qSl8MkamDHe1XrDVksl3JmUl4LfJgrjuxpN02FBlfVGwICUNipTmX538doJm BiD30lJJXwJra6yJ7g88DGX43pwRsi5hLlxoYVpd7fSuLrkVEVDLoRx3YU3F8LtqjdJF 5qgvrIxQ3FAIIdsa9c9Xworc/i6jX090I37x9uULsyfJnw0rbfZSvGBt8mx0dM9jsMdn u3ohxLuJ7oXLB2mbV/k9KRfZXql4S9jiqNiRZnpqrhhwdwJIU5NLUHZI8cPwQ7det3ly 89jQ== X-Gm-Message-State: AOAM5333zEDtIioDzo07hITsom72V5HZ4V0rvtLEyygeCdY1xpvQKz9c +loGApFuUZ86otc5tLJD4uM9TQ== X-Google-Smtp-Source: ABdhPJy/hS7nUi5hDdKDgoZ0VWy9GiHfuL1jznZEA75pk6rKOIvCtvp6tkIWOvZKkumsCvdFjNtMGw== X-Received: by 2002:a17:902:bb8e:b029:f8:b497:825c with SMTP id m14-20020a170902bb8eb02900f8b497825cmr33604720pls.82.1622688611425; Wed, 02 Jun 2021 19:50:11 -0700 (PDT) Received: from laputa (p3dd30534.tkyea130.ap.so-net.ne.jp. [61.211.5.52]) by smtp.gmail.com with ESMTPSA id s123sm740022pfb.78.2021.06.02.19.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 19:50:10 -0700 (PDT) Date: Thu, 3 Jun 2021 11:50:06 +0900 From: AKASHI Takahiro To: Masami Hiramatsu Cc: Heinrich Schuchardt , Kazuhiko Sakamoto , Alexander Graf , Jesper Schmitz Mouridsen , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH] efi: Restrict the simple file system protocol to support only FAT Message-ID: <20210603025006.GA63177@laputa> Mail-Followup-To: AKASHI Takahiro , Masami Hiramatsu , Heinrich Schuchardt , Kazuhiko Sakamoto , Alexander Graf , Jesper Schmitz Mouridsen , Simon Glass , u-boot@lists.denx.de References: <162268667641.382839.15360535926598237804.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <162268667641.382839.15360535926598237804.stgit@localhost> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean 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 > Signed-off-by: Masami Hiramatsu > --- > 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, >