All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	berrange@redhat.com,  qemu-block@nongnu.org,
	Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH v2 3/3] iotests: Add new nbd-robustness test
Date: Mon, 9 Nov 2026 10:06:50 -0600	[thread overview]
Message-ID: <avHvXwdCN7GksOwN@redhat.com> (raw)
In-Reply-To: <20261109153622.GA429574@shajnocz.csb>

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 <eblake@redhat.com>
> > ---
> >  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



      reply	other threads:[~2026-11-09 16:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 22:54 [PATCH for-11.2 v2 0/3] Avoid low-severity NBD denial-of-service attack Eric Blake
2026-11-07 22:54 ` [PATCH v2 1/3] docs: Mention security considerations for NBD Eric Blake
2026-11-09 15:58   ` Stefan Hajnoczi
2026-11-09 20:48     ` Eric Blake
2026-11-10  8:48       ` Daniel P. Berrangé
2026-11-07 22:54 ` [PATCH v2 2/3] nbd/server: Reject rather than assert on non-compliant BLOCK_STATUS Eric Blake
2026-11-09 13:57   ` Eric Blake
2026-11-09 15:45   ` Stefan Hajnoczi
2026-11-09 15:51   ` Stefan Hajnoczi
2026-11-07 22:54 ` [PATCH v2 3/3] iotests: Add new nbd-robustness test Eric Blake
2026-11-09 15:36   ` Stefan Hajnoczi
2026-11-09 16:06     ` 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=avHvXwdCN7GksOwN@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --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.