linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: "Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	kernel-dev@igalia.com, kernel@gpiccoli.net, anton@enomsg.org,
	ccross@android.com, tony.luck@intel.com,
	linux-efi@vger.kernel.org
Subject: Re: [PATCH 8/8] efi: pstore: Add module parameter for setting the record size
Date: Fri, 7 Oct 2022 11:11:08 +0200	[thread overview]
Message-ID: <CAMj1kXF4UyRMh2Y_KakeNBHvkHhTtavASTAxXinDO1rhPe_wYg@mail.gmail.com> (raw)
In-Reply-To: <202210061614.8AA746094A@keescook>

On Fri, 7 Oct 2022 at 01:16, Kees Cook <keescook@chromium.org> wrote:
>
> On Thu, Oct 06, 2022 at 07:42:12PM -0300, Guilherme G. Piccoli wrote:
> > By default, the efi-pstore backend hardcode the UEFI variable size
> > as 1024 bytes. That's not a big deal, but at the same time having
> > no way to change that in the kernel is a bit bummer for specialized
> > users - there is not such a limit in the UEFI specification.
>
> It seems to have been added in commit
> e0d59733f6b1 ("efivars, efi-pstore: Hold off deletion of sysfs entry until the scan is completed")
>

Yeah fortunately that kludge is gone now.

> But I see no mention of why it was introduced or how it was chosen.
>

There is some cargo cult from prehistoric EFI times going on here, it
seems. Or maybe just misinterpretation of the maximum size for the
variable *name* vs the variable itself.

> I remember hearing some horror stories from Matthew Garrett about older
> EFI implementations bricking themselves when they stored large
> variables, or something like that, but I don't know if that's meaningful
> here at all.
>

This was related to filling up the variable store to the point where
SetVariable() calls in the firmware itself would start failing,
bricking the system in the process.

The efivars layer below efi-pstore will take care of this, by ensuring
upfront that sufficient space is available.

> I think it'd be great to make it configurable! Ard, do you have any
> sense of what the max/min, etc, should be here?
>

Given that dbx on an arbitrary EFI system with secure boot enabled is
already almost 4k, that seems like a reasonable default. As for the
upper bound, there is no way to know what weird firmware bugs you
might tickle by choosing highly unusual values here.

If you need to store lots of data, you might want to look at [0] for
some work done in the past on using capsule update for preserving data
across a reboot. In the general case, this is not as useful, as the
capsule is only delivered to the firmware after invoking the
ResetSystem() EFI runtime service (as opposed to SetVariable() calls
taking effect immediately). However, if you need to capture large
amounts of data, and can tolerate the uncertainty involved in the
capsule approach, it might be a reasonable option.

[0] https://lore.kernel.org/all/20200312011335.70750-1-qiuxu.zhuo@intel.com/

  reply	other threads:[~2022-10-07  9:11 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 22:42 [PATCH 0/8] Some pstore improvements Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 1/8] pstore: Improve error reporting in case of backend overlap Guilherme G. Piccoli
2022-10-06 23:27   ` Kees Cook
2022-10-06 23:35     ` Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 2/8] pstore: Expose kmsg_bytes as a module parameter Guilherme G. Piccoli
2022-10-06 23:32   ` Kees Cook
2022-10-12 15:33     ` Guilherme G. Piccoli
2022-10-12 17:58       ` Kees Cook
2022-11-01 19:08         ` Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 3/8] pstore: Inform unregistered backend names as well Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 4/8] pstore: Alert on backend write error Guilherme G. Piccoli
2022-10-06 23:27   ` Kees Cook
2022-10-06 23:34     ` Guilherme G. Piccoli
2022-10-06 23:44       ` Kees Cook
2022-10-06 22:42 ` [PATCH 5/8] pstore: Fix long-term implicit conversions in the compression routines Guilherme G. Piccoli
2022-10-06 23:36   ` Kees Cook
2022-10-07  8:47     ` Ard Biesheuvel
2022-10-07 19:37       ` Kees Cook
2022-10-08 14:14         ` Guilherme G. Piccoli
2022-10-08 15:53           ` Ard Biesheuvel
2022-10-08 16:03             ` Guilherme G. Piccoli
2022-10-08 17:52               ` Ard Biesheuvel
2022-10-08 18:12                 ` Guilherme G. Piccoli
2022-10-08 19:44                 ` Kees Cook
2022-10-10  7:24                   ` Ard Biesheuvel
2022-10-06 22:42 ` [PATCH 6/8] MAINTAINERS: Add a mailing-list for the pstore infrastructure Guilherme G. Piccoli
2022-10-06 23:22   ` Kees Cook
2022-10-06 23:29     ` Luck, Tony
2022-10-06 23:37       ` Kees Cook
2022-10-07 16:19         ` Luck, Tony
2022-10-07 16:21     ` Colin Cross
2022-10-07 16:32     ` Guilherme G. Piccoli
2022-10-07 19:25       ` Kees Cook
2022-10-06 22:42 ` [PATCH 7/8] efi: pstore: Follow convention for the efi-pstore backend name Guilherme G. Piccoli
2022-10-06 23:16   ` Kees Cook
2022-10-07  8:47     ` Ard Biesheuvel
2022-10-14 17:41   ` (subset) " Kees Cook
2022-10-06 22:42 ` [PATCH 8/8] efi: pstore: Add module parameter for setting the record size Guilherme G. Piccoli
2022-10-06 23:16   ` Kees Cook
2022-10-07  9:11     ` Ard Biesheuvel [this message]
2022-10-07 13:00       ` Guilherme G. Piccoli
2022-10-07 13:19         ` Ard Biesheuvel
2022-10-07 13:45           ` Guilherme G. Piccoli
2022-10-07 15:06             ` Ard Biesheuvel
2022-10-07 17:01               ` Guilherme G. Piccoli
2022-10-07 19:32             ` Kees Cook
2022-10-07 23:29               ` Guilherme G. Piccoli
2022-10-08  2:36                 ` Kees Cook
2022-10-06 23:24 ` [PATCH 0/8] Some pstore improvements Kees Cook
2022-10-12 15:50   ` Guilherme G. Piccoli
2022-10-12 17:59     ` Kees Cook

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=CAMj1kXF4UyRMh2Y_KakeNBHvkHhTtavASTAxXinDO1rhPe_wYg@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=gpiccoli@igalia.com \
    --cc=keescook@chromium.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).