Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1670927rwd; Thu, 8 Jun 2023 23:54:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RFuGS7YdVcQBD3edW23gEZthnJ7xYhvULOmQ1P+HyPELn992anPXOgjjavI3y3SaahhzH X-Received: by 2002:aa7:8882:0:b0:63d:45f3:9fc with SMTP id z2-20020aa78882000000b0063d45f309fcmr1364687pfe.5.1686293688449; Thu, 08 Jun 2023 23:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686293688; cv=none; d=google.com; s=arc-20160816; b=Ifd5fOtKIZhld4NeMKbXQ8rdOOedJWbSfN2JF3rKIjJKLEKuoslARAnHF44EoH0kcs biNHkfS03mXKcUnF4Lt4O5brSnCgDpPcS9Fexx82S6TkzhH5ZZsZoJvkJqGbruXUv3LV Xjs96eyP3rRLo432HyDK7etRlpQVHeELsDIeKGxRrwbtrt9E44NDl7lcTxvQQuT9oXye bw06PdpxImqSFZ6mkxC3Bie59/ibDWfgG0QRQ8iRlWyH9EM8dNYmkwjzIc8yy2qO8PnC JboCVeMFNKLWgPcdeOSahVRe+7OZcelK4aF8FKeOUhy9emvBGoJvp3AUw7rAxTcJLOam nJ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dWLk5AcoN1nlHpTB7u7FTqD5LcrlUnshiREnF2lH0hA=; b=gRYgA+EronsYfXoy2y6qp5/MFsKLC57zT9JPHZqd6/Q2desvUUUJsNgy2+xthhAjhk aSgspY10wXu6aT5w3JNiV5XI03A5/g9n85DdaMnDKkkQsTI9T4O72ooxwRNtIKDUIXTj Phw/vbTvAeJhAmN87e7VJnLWUav3+xeWK4qGgjo/3TX3YKrtMu5PMIgqz2CFX369nBjZ Er75HS5tJTfQi+yHzm8xmfwAHgRTI0GHbYlJEfxHyJBaCUXqN8HQwT3r01z2dfHDMcWI m2oJ6xgs2xdh9vUaZqJ1BuNbNOXaHwscK8oTH+Ow6Hq4N8SI1KLSzx1Ko882JLlGMOsU FxnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SiyMbDst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c30-20020a056a00009e00b00660b5630908si11600pfj.269.2023.06.08.23.54.34; Thu, 08 Jun 2023 23:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SiyMbDst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjFIGfZ (ORCPT + 99 others); Fri, 9 Jun 2023 02:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjFIGfY (ORCPT ); Fri, 9 Jun 2023 02:35:24 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 093C91BDF for ; Thu, 8 Jun 2023 23:35:23 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f63ab1ac4aso1697536e87.0 for ; Thu, 08 Jun 2023 23:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686292521; x=1688884521; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dWLk5AcoN1nlHpTB7u7FTqD5LcrlUnshiREnF2lH0hA=; b=SiyMbDstSJGUV5wBE0dpYExQgbaOi08fY3+NU4qvjtxBpyiifJ1mvtdFghvFrwEPAe 7Blad1GIxr5oIeEa6wGg/T+V4udWMlwAV77766KSvC5H1HGYODPSQiv7Pq+uu/Hcmymv DUz/OjpR15fmetfDry4q5tdRTQ0Q7C0UCnYDwiPeqrDLyH53Frf0/YhKxROT4dFk3FaD 6r/ltgKr0U4ZUdbnqOVKMWxxylbKjOBIcv8jrfjpuRn418OfY8XPonxRyKfaG748TaIl 5YNcEi/4VpJci09XC9e6ZcSYBKNF0ps8LHeRnAT/oX8y6vmUuaVpOuZuFpSBAexLn4A8 lF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686292521; x=1688884521; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dWLk5AcoN1nlHpTB7u7FTqD5LcrlUnshiREnF2lH0hA=; b=C+NIqxSZUJ/PiOfxCwcFnqhtwImoTzLZ4vGoHbzbSZ4QNHa2gyR9ZFiSrdpVauVHsZ chPxdK7Vtav9sShI2aJ3UL+KEaAeUUsOwl21YEAu9RLtEWEdfyKFRg5Q1YwRv7wJh5tW Knj48LKsmLowMnNuhh9a2B5CmSiSWiNK4HRs37NMFqguxVttRIlHoOtv0pG77lBN0mfi Bmb9BAb4Oyv1ruJ6XZXzexkQb9GBhDPattLNOAVuOg4eZEJvCjuk90hx/F29xZ5I8tMm ubLZVIYp5336a8NJQSUdGAMGcj47etTQoAG72RnD2zF3rHXA6WzvzBBjet3ZVAeQASaA PDoQ== X-Gm-Message-State: AC+VfDz+60cZScasfIBN/ial2X67H35iUMdpJr4Nk+AS4bIUOBzDD0KS K5zge/JPhh3JO+tZF2qAr1Ec1YHTCTlOM4etrU7LBQ== X-Received: by 2002:a05:6512:457:b0:4dd:9fd8:3a36 with SMTP id y23-20020a056512045700b004dd9fd83a36mr222016lfk.1.1686292521182; Thu, 08 Jun 2023 23:35:21 -0700 (PDT) MIME-Version: 1.0 References: <20230526010748.1222-1-masahisa.kojima@linaro.org> <76da826f-b608-6add-5401-6de818b180e3@siemens.com> <871ece13-7d6e-44d4-3bda-317658202f6f@siemens.com> <3eb9bf84-4cf0-6cfe-9ad3-f7eef7d775fb@siemens.com> In-Reply-To: <3eb9bf84-4cf0-6cfe-9ad3-f7eef7d775fb@siemens.com> From: Ilias Apalodimas Date: Fri, 9 Jun 2023 09:34:45 +0300 Message-ID: Subject: Re: [PATCH v5 3/3] efi: Add tee-based EFI variable driver To: Jan Kiszka Cc: Ard Biesheuvel , Sumit Garg , Masahisa Kojima , Jens Wiklander , linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Johan Hovold , Maxime Coquelin , Alexandre Torgue , linux-efi@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, "Su, Bao Cheng (RC-CN DF FA R&D)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jan, [...] > > --- a/drivers/firmware/efi/vars.c > > +++ b/drivers/firmware/efi/vars.c > > @@ -123,7 +123,7 @@ EXPORT_SYMBOL_GPL(efivars_unregister); > > > > bool efivar_supports_writes(void) > > { > > - return __efivars && __efivars->ops->set_variable; > > + return __efivars && __efivars->ops->set_variable != set_variable_int; > > } > > EXPORT_SYMBOL_GPL(efivar_supports_writes); > > > > diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c > > index e028fafa04f3..e40b5c4c5106 100644 > > --- a/fs/efivarfs/super.c > > +++ b/fs/efivarfs/super.c > > @@ -242,9 +242,6 @@ static int efivarfs_fill_super(struct super_block > > *sb, struct fs_context *fc) > > sb->s_d_op = &efivarfs_d_ops; > > sb->s_time_gran = 1; > > > > - if (!efivar_supports_writes()) > > - sb->s_flags |= SB_RDONLY; > > - > > inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0, true); > > if (!inode) > > return -ENOMEM; > > diff --git a/include/linux/efi.h b/include/linux/efi.h > > index 58d1c271d3b0..ec0ac6ef50a3 100644 > > --- a/include/linux/efi.h > > +++ b/include/linux/efi.h > > @@ -1084,6 +1084,10 @@ int efivars_register(struct efivars *efivars, > > const struct efivar_operations *ops); > > int efivars_unregister(struct efivars *efivars); > > > > +efi_status_t set_variable_int(efi_char16_t *name, efi_guid_t *vendor, > > + u32 attributes, unsigned long data_size, > > + void *data); > > + > > void efivars_generic_ops_register(void); > > void efivars_generic_ops_unregister(void); > > > > Thanks > > /Ilias > > As just written in my other reply: The root cause is the dependency on > tee-supplicant daemon. That needs to be resolved, and then also r/w > mounting will just work. That's partially true. If we solve the dependency your problem will go away only if everything gets compiled as built in. But if you have them as modules there's still a chance you mount the efivarfs before installing all the modules. In that case, you'll end up with the same problem no? That's why I think this patch (or a variation of it) is useful. It solves the kernel panic you are seeing if you remount the efivarfs as RW and It unifies the way the kernel responds to userspace no matter what the firmware does with its setvariableRT service. Thanks /Ilias > > Jan > > -- > Siemens AG, Technology > Competence Center Embedded Linux >