From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, 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: Tue, 17 Nov 2026 14:07:43 -0600 [thread overview]
Message-ID: <avyskW5PTOANZonw@redhat.com> (raw)
In-Reply-To: <20261117180601.GA391996@shajnocz.csb>
On Tue, Nov 17, 2026 at 01:06:01PM -0500, Stefan Hajnoczi wrote:
> 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
>
> QEMU's current AI policy forbids AI-generated code.
This tag is based on the ongoing discussion about AGENTS.md and
code-provenance.rst:
https://lists.gnu.org/archive/html/qemu-devel/2026-09/msg09158.html
https://lists.gnu.org/archive/html/qemu-devel/2026-10/msg00110.html
(and elsewhere)
At present, as of commit 1915e810d, use of AI-assisted unit tests is
still not approved for upstream. And it appears that I started
writing this patch before that AGENTS.md change landed, because with
that patch in place, my LLM should have tried harder to dissuade me
from posting.
I agree that my starting point of Feifan's reproduction script, which
already documented AI assistance, already puts this patch on shaky
ground, no matter how much or little else I further did with an LLM
while polishing it into a more complete test (while I can attest to
understanding every line of this patch and am not blindly trusting AI
output, I genuinely cannot state that the patch is free from AI
influence, despite the differences between here and the original
reproduction script on gitlab). Therefore, I agree that this patch
cannot be applied until that discussion results in an upstream patch.
I don't know of any other easy way to prove that the CVE is fixed;
nbdkit does not support out-of-order structured read replies, and
intentionally writing a known-non-compliant NBD server is grunt
work. In the past, when fixing NBD protocol corner cases in QEMU, I
have resorted to including reproduction instructions that could not be
easily automated into unit tests to instead occur as part of the
commit message in the form of a quoted patch that could be applied to
QEMU - certainly not as automatable, but still strengthens the power
of the git log (see commit 6e280648, for an example), and something I
am capable of doing without LLM assistance. For the sake of getting
the CVE fix into the 11.2 release, I could repeat that framework:
amend patch 3/4 to call out more detailed instructions on how to patch
QEMU into behaving as a triggering known-broken server, do a pull
request on just 1-3, and omit patch 4/4 entirely (saving it for a
future day when our LLM policy is relaxed).
>
> > Signed-off-by: Eric Blake <eblake@redhat.com>
> > ---
> > .../tests/nbd-structured-read-gaps | 215 ++++++++++++++++++
> > .../tests/nbd-structured-read-gaps.out | 5 +
> > 2 files changed, 220 insertions(+)
> > create mode 100755 tests/qemu-iotests/tests/nbd-structured-read-gaps
> > create mode 100644 tests/qemu-iotests/tests/nbd-structured-read-gaps.out
> >
> > diff --git a/tests/qemu-iotests/tests/nbd-structured-read-gaps b/tests/qemu-iotests/tests/nbd-structured-read-gaps
> > new file mode 100755
> > index 00000000000..9f8b3b8b20b
> > --- /dev/null
> > +++ b/tests/qemu-iotests/tests/nbd-structured-read-gaps
> > @@ -0,0 +1,215 @@
> > +#!/usr/bin/env python3
> > +# group: rw quick
>
> Does this run in CI without the "auto" group?
Huh. It looks like I based my template on a copy-and-paste of
tests/qemu-nbd-snapshots (lacks "auto") rather than tests/nbd-commands
or tests/nbd-robustness (include "auto"). I agree that "auto" makes
sense here; the test completes in less than half a second. Not sure
if that means qemu-nbd-snapshots should be updated as a separate
patch.
But that doesn't matter for 11.2, since this patch needs to be
excluded until LLM policy changes, and my proposed workaround does not
affect the qemu-iotests directory at this time.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
next prev parent reply other threads:[~2026-11-17 20:08 UTC|newest]
Thread overview: 12+ 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 [this message]
2026-11-17 20:51 ` Philippe Mathieu-Daudé
2026-11-17 22:03 ` Stefan Hajnoczi
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=avyskW5PTOANZonw@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=stefanha@redhat.com \
--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.