On 17/11/26 21:07, Eric Blake wrote:
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.

OTOH nobody disagreed with latest policy sent by Paolo
(https://lore.kernel.org/qemu-devel/[email protected]/)
and Paolo said he'd get it merge during a community call
(Tuesday, 5 or 6 weeks ago?) so personally I consider it accepted
and being processed, only delayed. I hope this isn't a problem.

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).


Reply via email to