Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1253564pxa; Thu, 20 Aug 2020 06:51:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAopwajCBHjTCD8k6HzMD4QlUI5NfWDQZHO4bMlZYOUBz/T6QO1JiXrCOSJkVauaibH9Iz X-Received: by 2002:a17:906:7688:: with SMTP id o8mr3284288ejm.508.1597931484543; Thu, 20 Aug 2020 06:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931484; cv=none; d=google.com; s=arc-20160816; b=HeiCp4WRaC960WPOmJ5my9mS4U4TJcaJEdMqEu9NA0IHzDq7oU1RK1P0R8r5Ui+5bk 0EI/oSFr0nzjvPwad4OHAJxGxfB2V4x/KgH1lcVocYHZCq2v9qiX+KmeN/n+YQGVf+qB 70cvtIFAra7p3nsAdXnkiJZTHJw2DldOMfkiAG9FOwWijw8oh+mzz5EeTFzRbDtON29B +YJBdln2fgmBEzpYX9jBMhPHkh0RPSaz1gu8ahTfzKHk4wcRUh+FA8b29DogQYteYEYb gCnax60YshJSgKB49uaS1cx0eoBp8ci1XzGrbTICB7y02U2hoOzjJ9WNyWiArvLx4DCN JFgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JqXXm0ETRVCfDV4akHxyTLe+KX7e4JZMFI+Ll68PumI=; b=pNG+KdrGi1iGjyNbt9vIYhadKOpZocoFcInoaruy+P4wIDV2Me5Filb3O6i7WLB6TD LD33CLAELBT2Suahz2TTtsc736Q5Z6S7JRnlxziD9RjMgIDI3nxbM2x6+gBNtVFIpaQE QXgeWuXvVTDoF4OiqX8IP5UZpbiULCk0suqWPxGJoPAXAh0BWTGwrcn2uk41YBB4PAh0 JoRNvUpnbOdWqkbvfqrPMpPqaf+JPb4B4gXosL2W5XZc4eu0P4Bv2dR4a5DEBiGj9VLL sQZycbgQkN0tfP2Y2mN2/9eUkJV32CyItUaImeOzHmbMACWHOB/ubAmHVzltwG0LjkzL W5BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f4sMLbF3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id os22si1231615ejb.693.2020.08.20.06.51.00; Thu, 20 Aug 2020 06:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f4sMLbF3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730458AbgHTNje (ORCPT + 99 others); Thu, 20 Aug 2020 09:39:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgHTJal (ORCPT ); Thu, 20 Aug 2020 05:30:41 -0400 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD926207FB; Thu, 20 Aug 2020 09:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915839; bh=aMJupPBQ4LxbwYlKEK/6QB+6fhqLMcVfiMNCpsaL+xs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=f4sMLbF3Ul/oSOcXWDtf7iwQrI3+vQvCq5y7Yl3ym07AuGuA3UOAR7s39x12gHGk1 bdOJyPHLfbdDmAyl1/S0WykPWX7i9HcBevqZzcszcsR/S/s/QWZrnc/71hV3B+fF8y IcfGhTLfd4jaho8ZwXiXIA1vEWA3QC+wAsjyhP+c= Received: by mail-oi1-f171.google.com with SMTP id z22so1331795oid.1; Thu, 20 Aug 2020 02:30:38 -0700 (PDT) X-Gm-Message-State: AOAM530RY4IMwYFWRqpHw7op23RTsLivnLutRFYlTm1Uz4U7Ip3WnfBC p1RcQx7Ozr82/YTz8SB2y97mUtf5D4JW6HxcJPk= X-Received: by 2002:a05:6808:b:: with SMTP id u11mr1168892oic.33.1597915838236; Thu, 20 Aug 2020 02:30:38 -0700 (PDT) MIME-Version: 1.0 References: <20200819092838.11290-1-jlee@suse.com> In-Reply-To: <20200819092838.11290-1-jlee@suse.com> From: Ard Biesheuvel Date: Thu, 20 Aug 2020 11:30:27 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] efi/efivars: create efivars mount point when get variable services are available To: "Lee, Chun-Yi" Cc: Ard Biesheuvel , linux-efi , Linux Kernel Mailing List , "Lee, Chun-Yi" , Ilias Apalodimas Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Aug 2020 at 11:28, Lee, Chun-Yi wrote: > > The efivars filesystem depends on GetVariable or GetNextVariable EFI > runtime services. So the /sys/firmware/efi/efivars does not need to be > created when GetVariable and GetNextVariable are not available. > > It is useful for userland to determine the availability of efivars > filesystem. > > Cc: Ilias Apalodimas > Cc: Ard Biesheuvel > Signed-off-by: "Lee, Chun-Yi" Hello Joey, This is not the right check to perform here: the efivarfs code could be instantiated using a different efivars abstraction, so whether the RT services are implemented is not entirely relevant. Please look at commit f88814cc2578c121e6edef686365036db72af0ed ("efi/efivars: Expose RT service availability via efivars abstraction") for an explanation of the underlying issue, and update your patch accordingly. > --- > drivers/firmware/efi/efi.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index fdd1db025dbf..929fbf4dfd5d 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -404,11 +404,14 @@ static int __init efisubsys_init(void) > if (error) > goto err_remove_group; > > - /* and the standard mountpoint for efivarfs */ > - error = sysfs_create_mount_point(efi_kobj, "efivars"); > - if (error) { > - pr_err("efivars: Subsystem registration failed.\n"); > - goto err_remove_group; > + if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE | > + EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)) { > + /* and the standard mountpoint for efivarfs */ > + error = sysfs_create_mount_point(efi_kobj, "efivars"); > + if (error) { > + pr_err("efivars: Subsystem registration failed.\n"); > + goto err_remove_group; > + } > } > > if (efi_enabled(EFI_DBG) && efi_enabled(EFI_PRESERVE_BS_REGIONS)) > -- > 2.16.4 >