All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH] block/vhdx-log: Improve sanity checks to avoid OOB accesses with bad images
Date: Thu, 12 Nov 2026 13:52:43 +0100	[thread overview]
Message-ID: <avW2m_OERQZOdVXp@redhat.com> (raw)
In-Reply-To: <20261111150659.253918-1-thuth@redhat.com>

Am 11.11.2026 um 16:06 hat Thomas Huth geschrieben:
> The multiplication "hdr->descriptor_count * sizeof(VHDXLogDescriptor)" in
> vhdx_log_hdr_is_valid() can overflow on 32-bit systems, so this function
> could mark bad images as valid when the truncated result is smaller than
> hdr->entry_length. Switch to a division on the right hand side instead to
> avoid the overflow problems.
> 
> The second problem is in vhdx_log_read_desc(): desc_sectors is a 32-bit
> value, thus the multiplication "desc_sectors * VHDX_LOG_SECTOR_SIZE" is
> also done with 32 bit arithmetics, and the result is used as "size_t"
> parameter for qemu_try_blockalign(), i.e. the parameter here is also
> only 32 bits on 32-bit systems. Let's add a sanity check here to avoid
> the overflow problem that could lead to trouble later.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3860
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied to the block branch.

Kevin



      reply	other threads:[~2026-11-12 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 15:06 [PATCH] block/vhdx-log: Improve sanity checks to avoid OOB accesses with bad images Thomas Huth
2026-11-12 12:52 ` Kevin Wolf [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=avW2m_OERQZOdVXp@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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 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.