qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Jeuk Kim" <jeuk20.kim@samsung.com>,
	qemu-block@nongnu.org,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>, "Peter Xu" <peterx@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"John Snow" <jsnow@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>
Subject: [PULL v3 5/5] aio-posix: zero out io_uring sqe user_data
Date: Wed, 30 Aug 2023 07:49:42 -0400	[thread overview]
Message-ID: <20230830114942.449060-6-stefanha@redhat.com> (raw)
In-Reply-To: <20230830114942.449060-1-stefanha@redhat.com>

liburing does not clear sqe->user_data. We must do it ourselves to avoid
undefined behavior in process_cqe() when user_data is used.

Note that fdmon-io_uring is currently disabled, so this is a latent bug
that does not affect users. Let's merge this fix now to make it easier
to enable fdmon-io_uring in the future (and I'm working on that).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230426212639.82310-1-stefanha@redhat.com>
---
 util/fdmon-io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c
index 17ec18b7bd..16054c5ede 100644
--- a/util/fdmon-io_uring.c
+++ b/util/fdmon-io_uring.c
@@ -184,6 +184,7 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node)
 #else
     io_uring_prep_poll_remove(sqe, node);
 #endif
+    io_uring_sqe_set_data(sqe, NULL);
 }
 
 /* Add a timeout that self-cancels when another cqe becomes ready */
@@ -197,6 +198,7 @@ static void add_timeout_sqe(AioContext *ctx, int64_t ns)
 
     sqe = get_sqe(ctx);
     io_uring_prep_timeout(sqe, &ts, 1, 0);
+    io_uring_sqe_set_data(sqe, NULL);
 }
 
 /* Add sqes from ctx->submit_list for submission */
-- 
2.41.0



  parent reply	other threads:[~2023-08-30 11:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 11:49 [PULL v3 0/5] Block patches Stefan Hajnoczi
2023-08-30 11:49 ` [PULL v3 1/5] block-migration: Ensure we don't crash during migration cleanup Stefan Hajnoczi
2023-08-30 16:50   ` Michael Tokarev
2023-08-30 17:43     ` Fabiano Rosas
2023-08-30 11:49 ` [PULL v3 2/5] block: add subcluster_size field to BlockDriverInfo Stefan Hajnoczi
2023-08-30 11:49 ` [PULL v3 3/5] block/io: align requests to subcluster_size Stefan Hajnoczi
2023-08-30 11:49 ` [PULL v3 4/5] tests/qemu-iotests/197: add testcase for CoR with subclusters Stefan Hajnoczi
2023-08-30 11:49 ` Stefan Hajnoczi [this message]
2023-08-30 16:23 ` [PULL v3 0/5] Block patches 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=20230830114942.449060-6-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=berrange@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=jeuk20.kim@samsung.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).