From: Ard Biesheuvel <ardb@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: Gregory Price <gourry@gourry.net>,
Usama Arif <usamaarif642@gmail.com>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH 3/3] efi/memattr: Include EFI memmap size in corruption warnings
Date: Tue, 7 Jan 2025 12:24:03 +0100 [thread overview]
Message-ID: <CAMj1kXFn7CeT6R2w_XKAJoj5WUYObOWKeUO2istY8sULQTwomQ@mail.gmail.com> (raw)
In-Reply-To: <20250106-efi_fw_bug-v1-3-01a8eb40bfeb@debian.org>
On Mon, 6 Jan 2025 at 20:03, Breno Leitao <leitao@debian.org> wrote:
>
> Add EFI memory map size to warning messages when a corrupted Memory
> Attributes Table is detected, making it easier to diagnose firmware issues.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> drivers/firmware/efi/memattr.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c
> index 5f83cdea88b05cb325e9f90c14a0048131e53cfa..2c276bcc0df48352bec6cd96b69edf67a16f6069 100644
> --- a/drivers/firmware/efi/memattr.c
> +++ b/drivers/firmware/efi/memattr.c
> @@ -22,7 +22,7 @@ unsigned long __ro_after_init efi_mem_attr_table = EFI_INVALID_TABLE_ADDR;
> void __init efi_memattr_init(void)
> {
> efi_memory_attributes_table_t *tbl;
> - unsigned long size;
> + unsigned long size, efi_map_size;
>
> if (efi_mem_attr_table == EFI_INVALID_TABLE_ADDR)
> return;
> @@ -49,9 +49,10 @@ void __init efi_memattr_init(void)
> * just be ignored altogether.
> */
> size = tbl->num_entries * tbl->desc_size;
> - if (size > 3 * efi.memmap.nr_map * efi.memmap.desc_size) {
> - pr_warn(FW_BUG "Corrupted EFI Memory Attributes Table detected! (version == %u, desc_size == %u, num_entries == %u)\n",
> - tbl->version, tbl->desc_size, tbl->num_entries);
> + efi_map_size = efi.memmap.nr_map * efi.memmap.desc_size;
> + if (size > 3 * efi_map_size) {
> + pr_warn(FW_BUG "Corrupted EFI Memory Attributes Table detected! (version == %u, desc_size == %u, num_entries == %u, efi_map_size == %lu)\n",
> + tbl->version, tbl->desc_size, tbl->num_entries, efi_map_size);
> goto unmap;
> }
>
>
Hello Breno,
I don't mind the patch per se, but I don't think it is terribly useful either.
Could you explain how this helps?
next prev parent reply other threads:[~2025-01-07 11:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 19:02 [PATCH 0/3] efi/memattr: Improve the efi_memattr_init function Breno Leitao
2025-01-06 19:02 ` [PATCH 1/3] efi/memattr: Convert efi_memattr_init() return type to void Breno Leitao
2025-01-06 19:24 ` Ard Biesheuvel
2025-01-06 19:02 ` [PATCH 2/3] efi/memattr: Add FW_BUG prefix to firmware error messages Breno Leitao
2025-01-06 19:25 ` Ard Biesheuvel
2025-01-06 19:02 ` [PATCH 3/3] efi/memattr: Include EFI memmap size in corruption warnings Breno Leitao
2025-01-07 11:24 ` Ard Biesheuvel [this message]
2025-01-07 12:05 ` Breno Leitao
2025-01-09 14:48 ` Ard Biesheuvel
2025-01-09 15:09 ` Usama Arif
2025-01-09 17:45 ` Breno Leitao
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=CAMj1kXFn7CeT6R2w_XKAJoj5WUYObOWKeUO2istY8sULQTwomQ@mail.gmail.com \
--to=ardb@kernel.org \
--cc=gourry@gourry.net \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=usamaarif642@gmail.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
all inboxes | Powered by JetHome®