On Mon, Nov 09, 2026 at 08:36:22AM -0700, Stefan Hajnoczi wrote: > On Sat, Nov 07, 2026 at 04:54:38PM -0600, Eric Blake wrote: > > Convert the proof of concept test by Sunday Jiang into an iotest. I > > tried to get libnbd to trigger the situation, but forcing a block > > status command when no status has been initiated is not something that > > libnbd is willing to do. So this results in a hard-coded sequence of > > bytes sent over a raw socket. Swapping the order with the previous > > patch shows the assertion failure that was previously reachable. > > > > Based-on: https://gitlab.com/qemu-project/qemu/-/work_items/4091 > > Signed-off-by: Eric Blake <[email protected]> > > --- > > tests/qemu-iotests/tests/nbd-robustness | 137 ++++++++++++++++++++ > > tests/qemu-iotests/tests/nbd-robustness.out | 5 + > > 2 files changed, 142 insertions(+) > > create mode 100755 tests/qemu-iotests/tests/nbd-robustness > > create mode 100644 tests/qemu-iotests/tests/nbd-robustness.out > > > > diff --git a/tests/qemu-iotests/tests/nbd-robustness > > b/tests/qemu-iotests/tests/nbd-robustness > > new file mode 100755 > > index 00000000000..602b7060854 > > --- /dev/null > > +++ b/tests/qemu-iotests/tests/nbd-robustness > > @@ -0,0 +1,137 @@ > > +#!/usr/bin/env python3 > > +# group: rw auto quick > > +# > > +# Test cases for NBD robustness against malicious clients > > +# > > +# Copyright (C) 2026 Red Hat, Inc. > > +# > > +# SPDX-License-Identifier: GPL-2.0-or-later > > + > > +import os > > +from contextlib import contextmanager > > + > > +import iotests > > +from iotests import qemu_img_create, qemu_io > > + > > +import socket > > +import struct > > + > > + > > +disk = os.path.join(iotests.test_dir, 'disk') > > +size = '4M' > > +nbd_sock = os.path.join(iotests.sock_dir, 'nbd_sock') > > +nbd_uri = 'nbd+unix:///{}?socket=' + nbd_sock > > +nbd: ModuleType > > nbd is never used and ModuleType is in the types stdlib package, which > is not included here. This looks like it can be removed.
Indeed, it was leftover copy-paste from nbd-commands when I was first trying to use libnbd to drive the reproducer, before figuring out that libnbd can't trigger it. Will fix. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org
