From: Kees Cook <keescook@chromium.org>
To: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-efi@vger.kernel.org,
kernel-dev@igalia.com, kernel@gpiccoli.net, anton@enomsg.org,
ccross@android.com, tony.luck@intel.com, ardb@kernel.org
Subject: Re: [PATCH V2 3/3] efi: pstore: Add module parameter for setting the record size
Date: Fri, 14 Oct 2022 10:42:34 -0700 [thread overview]
Message-ID: <202210141042.E4689636@keescook> (raw)
In-Reply-To: <20221013210648.137452-4-gpiccoli@igalia.com>
On Thu, Oct 13, 2022 at 06:06:48PM -0300, Guilherme G. Piccoli wrote:
> By default, the efi-pstore backend hardcode the UEFI variable size
> as 1024 bytes. The historical reasons for that were discussed by
> Ard in threads [0][1]:
>
> "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.".
>
> "OVMF has
> OvmfPkg/OvmfPkgX64.dsc:
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> OvmfPkg/OvmfPkgX64.dsc:
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400
>
> where the first one is without secure boot and the second with secure
> boot. Interestingly, the default is
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
>
> so this is probably where this 1k number comes from."
>
> With that, and since there is not such a limit in the UEFI spec, we
> have the confidence to hereby add a module parameter to enable advanced
> users to change the UEFI record size for efi-pstore data collection,
> this way allowing a much easier reading of the collected log, which is
> not scattered anymore among many small files.
>
> Through empirical analysis we observed that extreme low values (like 8
> bytes) could eventually cause writing issues, so given that and the OVMF
> default discussed, we limited the minimum value to 1024 bytes, which also
> is still the default.
>
> [0] https://lore.kernel.org/lkml/CAMj1kXF4UyRMh2Y_KakeNBHvkHhTtavASTAxXinDO1rhPe_wYg@mail.gmail.com/
> [1] https://lore.kernel.org/lkml/CAMj1kXFy-2KddGu+dgebAdU9v2sindxVoiHLWuVhqYw+R=kqng@mail.gmail.com/
>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
With the var length change recommended by Ard, yeah, looks good to me.
:)
Thanks!
-Kees
--
Kees Cook
prev parent reply other threads:[~2022-10-14 17:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 21:06 [PATCH V2 0/3] Some pstore improvements V2 Guilherme G. Piccoli
2022-10-13 21:06 ` [PATCH V2 1/3] pstore: Alert on backend write error Guilherme G. Piccoli
2022-10-14 14:46 ` Ard Biesheuvel
2022-10-14 17:41 ` (subset) " Kees Cook
2022-10-13 21:06 ` [PATCH V2 2/3] efi: pstore: Follow convention for the efi-pstore backend name Guilherme G. Piccoli
2022-10-13 21:06 ` [PATCH V2 3/3] efi: pstore: Add module parameter for setting the record size Guilherme G. Piccoli
2022-10-14 14:46 ` Ard Biesheuvel
2022-10-14 14:57 ` Guilherme G. Piccoli
2022-10-14 15:00 ` Ard Biesheuvel
2022-10-14 15:19 ` Guilherme G. Piccoli
2022-10-14 17:42 ` Kees Cook [this message]
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=202210141042.E4689636@keescook \
--to=keescook@chromium.org \
--cc=anton@enomsg.org \
--cc=ardb@kernel.org \
--cc=ccross@android.com \
--cc=gpiccoli@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=kernel@gpiccoli.net \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@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).