mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Sumit Garg <sumit.garg@linaro.org>,
	Masahisa Kojima <masahisa.kojima@linaro.org>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org,
	Johan Hovold <johan+linaro@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	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)" <baocheng.su@siemens.com>
Subject: Re: [PATCH v5 3/3] efi: Add tee-based EFI variable driver
Date: Fri, 9 Jun 2023 08:40:03 +0200	[thread overview]
Message-ID: <da7d3871-3b2f-1172-62a8-70f6856e4968@siemens.com> (raw)
In-Reply-To: <CAC_iWjLdmmQ4+BVt_mOP5Ht9jDHQqoVV+-ATR-nDrmG37raGjQ@mail.gmail.com>

On 09.06.23 08:34, Ilias Apalodimas wrote:
> 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?

Obviously, this will need proper probing of the TA services in the
proper order so that the STMM driver is pulled in before efivarfs gets used.

> 
> 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.

I'm not against fixes crashes, but the r/w issue is a different thing IMHO.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


  reply	other threads:[~2023-06-09  6:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  1:07 [PATCH v5 0/3] introduce tee-based EFI Runtime Variable Service Masahisa Kojima
2023-05-26  1:07 ` [PATCH v5 1/3] efi: expose efivar generic ops register function Masahisa Kojima
2023-05-26  1:07 ` [PATCH v5 2/3] efi: Add EFI_ACCESS_DENIED status code Masahisa Kojima
2023-05-26  1:07 ` [PATCH v5 3/3] efi: Add tee-based EFI variable driver Masahisa Kojima
2023-06-06  6:39   ` Jan Kiszka
2023-06-06  6:51     ` Sumit Garg
2023-06-06  6:57       ` Ard Biesheuvel
2023-06-06  7:51         ` Sumit Garg
2023-06-06  7:52         ` Jan Kiszka
2023-06-07  6:34           ` Ilias Apalodimas
2023-06-07  6:35             ` Ilias Apalodimas
2023-06-07  7:25             ` Sumit Garg
2023-06-07  8:25               ` Ilias Apalodimas
2023-06-07 12:40                 ` Jan Kiszka
2023-06-07 15:18                   ` Sumit Garg
2023-06-07 16:04                     ` Jan Kiszka
2023-06-07 16:09                       ` Ilias Apalodimas
2023-06-07 16:59                         ` Ilias Apalodimas
2023-06-07 17:14                           ` Jan Kiszka
2023-06-07 18:17                             ` Ilias Apalodimas
2023-06-07 19:46                               ` Jan Kiszka
2023-06-08  6:21                                 ` Ilias Apalodimas
2023-06-08 13:52                                   ` Ard Biesheuvel
2023-06-08 19:38                                     ` Ilias Apalodimas
2023-06-09  6:18                                       ` Jan Kiszka
2023-06-09  6:34                                         ` Ilias Apalodimas
2023-06-09  6:40                                           ` Jan Kiszka [this message]
2023-06-09  8:00                                             ` Ilias Apalodimas
2023-06-09  6:16                                     ` Jan Kiszka
2023-06-09  6:22                                       ` Ilias Apalodimas
2023-06-09  6:36                                         ` Jan Kiszka
2023-05-26 13:09 ` [PATCH v5 0/3] introduce tee-based EFI Runtime Variable Service Ard Biesheuvel
2023-05-29  9:05   ` Jens Wiklander
2023-05-29 13:29     ` Ard Biesheuvel

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=da7d3871-3b2f-1172-62a8-70f6856e4968@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=ardb@kernel.org \
    --cc=baocheng.su@siemens.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jens.wiklander@linaro.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=masahisa.kojima@linaro.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sumit.garg@linaro.org \
    /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

all inboxes | Powered by JetHome®