From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, peter.maydell@linaro.org
Subject: [PATCH v2 1/2] hw/uefi: add sanity check
Date: Thu, 2 Jul 2026 11:23:46 +0200 [thread overview]
Message-ID: <20260702092349.4183512-2-kraxel@redhat.com> (raw)
In-Reply-To: <20260702092349.4183512-1-kraxel@redhat.com>
Verify the passed buffer has the minimal required length before
reading the size field + verifying the total length.
Fixes: CVE-2026-58581
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3614
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/uefi/var-service-policy.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/uefi/var-service-policy.c b/hw/uefi/var-service-policy.c
index 58da4adbebaf..989bf87ddb86 100644
--- a/hw/uefi/var-service-policy.c
+++ b/hw/uefi/var-service-policy.c
@@ -276,6 +276,9 @@ static uint32_t uefi_vars_mm_check_policy_register(uefi_vars_state *uv,
uefi_var_policy *pol;
uint64_t length;
+ if (mhdr->length < sizeof(*mchk) + sizeof(*pe)) {
+ return uefi_vars_mm_policy_error(mhdr, mchk, EFI_BAD_BUFFER_SIZE);
+ }
if (uadd64_overflow(sizeof(*mchk), pe->size, &length)) {
return uefi_vars_mm_policy_error(mhdr, mchk, EFI_BAD_BUFFER_SIZE);
}
--
2.55.0
next prev parent reply other threads:[~2026-07-02 9:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 9:23 [PATCH v2 0/2] hw/uefi: security fixes Gerd Hoffmann
2026-07-02 9:23 ` Gerd Hoffmann [this message]
2026-07-02 9:23 ` [PATCH v2 2/2] hw/uefi: disable debug function Gerd Hoffmann
2026-07-02 12:56 ` Philippe Mathieu-Daudé
2026-07-06 10:49 ` Gerd Hoffmann
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=20260702092349.4183512-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.