All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, bea1e@proton.me,
	 Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH 4/4] nbd: Add iotest exposing previous CVE fix
Date: Thu, 19 Nov 2026 13:21:18 -0600	[thread overview]
Message-ID: <av9Kv9TtV-J1FYz_@redhat.com> (raw)
In-Reply-To: <20261113223742.2546619-10-eblake@redhat.com>

On Fri, Nov 13, 2026 at 04:34:52PM -0600, Eric Blake wrote:
> Feifan Qian posted a sample script generated with the help of AI that
> created a known-broken NBD server that intentionally replies to a
> structured read with only a subset of bytes, to expose the leak of
> heap data from qemu as an NBD client into an emulated IDE drive. Take
> the idea of that test, but simplify it into a qemu-io test (much
> lighter-weight NBD client, and easier access to see what bytes the NBD
> client code is passing on) that more closely resembles paradigms in my
> recent nbd-robustness iotest.  Also, expand the test to cover multiple
> scenarios: in addition to the original test demonstrating a prefix of
> 20 bytes with unwritten tail, I expanded it to cover out-of-order
> replies, a hole-only reply, and a completely empty reply.
> 
> Reported-by: Feifan Qian <bea1e@proton.me>
> Based-on: https://gitlab.com/qemu-project/qemu/-/work_items/3815
> AI-used-for: tests
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---

> +
> +    def test_incomplete_and_out_of_order_reads(self):
> +        # Force heap perturbation so uninitialized bytes show up (if not
> +        # already set in caller, this favors values of 0x5A in unused heap)
> +        os.environ.setdefault("MALLOC_PERTURB_", "165")
> +        nbd_uri = f"nbd+unix:///?socket={self.sock_path}"
> +        out = iotests.qemu_io(

It turns out MALLOC_PERTURB_ does not help or hurt in this case;
that's because qemu-io's read command is hardcoded to (re-)wipe memory
buffers to 0xab before it calls blk_pread(). So setting
MALLOC_PERTURB_=165 with the hopes of seeing 0x5a on fresh buffers and
0xa5 after free didn't change anything (the wipe to 0xab happens
unconditionally in qemu-io), I'll drop it from this patch.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



      parent reply	other threads:[~2026-11-19 19:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 22:34 [PATCH for-11.2 0/4] Another NBD CVE fix: incomplete read Eric Blake
2026-11-13 22:34 ` [PATCH 1/4] nbd: Refactor structured payload interpretation Eric Blake
2026-11-17 18:06   ` Stefan Hajnoczi
2026-11-13 22:34 ` [PATCH 2/4] nbd: Pass back offset/length for all structured read replies Eric Blake
2026-11-17 18:06   ` Stefan Hajnoczi
2026-11-13 22:34 ` [PATCH 3/4] nbd/client: Don't leak uninitialized memory on malicious server Eric Blake
2026-11-17 18:06   ` Stefan Hajnoczi
2026-11-13 22:34 ` [PATCH 4/4] nbd: Add iotest exposing previous CVE fix Eric Blake
2026-11-17 18:06   ` Stefan Hajnoczi
2026-11-17 20:07     ` Eric Blake
2026-11-17 20:51       ` Philippe Mathieu-Daudé
2026-11-17 22:03         ` Stefan Hajnoczi
2026-11-18 13:58           ` Eric Blake
2026-11-18 22:06             ` Eric Blake
2026-11-19 19:21   ` Eric Blake [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=av9Kv9TtV-J1FYz_@redhat.com \
    --to=eblake@redhat.com \
    --cc=bea1e@proton.me \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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.