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 <[email protected]>
> > 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 <[email protected]>
> > ---
> >  .../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


Reply via email to