                  http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block
                              for more information.
                             [139.178.88.99 listed in list.dnswl.org]
  1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
                             mail domains are different
  0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
                             valid
 -0.1 DKIM_VALID             Message has at least one valid DKIM or DK signature
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
                             author's domain
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
SpamTally: Final spam score: 4

From: Keith Busch <kbusch@kernel.org>

The uring_cmd needs to ensure __pad1 is clear, which is a reserved field
for opcode. If a prior submission for a different opcode at that same
entry did use that field, the command would fail the kernel's checks if
the caller didn't explicity clear it. Provide an init helper for this
opcode.

Also, the nvme uring_cmd tests had a couple places setting the sqe addr
and length, which are unused fields, so they shouldn't have been doing
that, though it had been harmless to do so since the kernel isn't
checking these fields.

Provide a helper function specific to the uring_cmd preparation.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 src/include/liburing.h      | 19 +++++++++++++++----
 test/io_uring_passthrough.c | 18 ++++++------------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index c80bffd3..757c3057 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1517,6 +1517,19 @@ IOURINGINLINE void io_uring_prep_socket_direct_all=
oc(struct io_uring_sqe *sqe,
 	__io_uring_set_target_fixed_file(sqe, IORING_FILE_INDEX_ALLOC - 1);
 }
=20
+IOURINGINLINE void io_uring_prep_uring_cmd(struct io_uring_sqe *sqe,
+					   __u32 cmd_op,
+					   int fd)
+	LIBURING_NOEXCEPT
+{
+	sqe->opcode =3D IORING_OP_URING_CMD;
+	sqe->fd =3D fd;
+	sqe->cmd_op =3D cmd_op;
+	sqe->__pad1 =3D 0;
+	sqe->addr =3D 0ul;
+	sqe->len =3D 0;
+}
+
 /*
  * Prepare commands for sockets
  */
@@ -1529,11 +1542,10 @@ IOURINGINLINE void io_uring_prep_cmd_sock(struct =
io_uring_sqe *sqe,
 					  int optlen)
 	LIBURING_NOEXCEPT
 {
-	io_uring_prep_rw(IORING_OP_URING_CMD, sqe, fd, NULL, 0, 0);
+	io_uring_prep_uring_cmd(sqe, cmd_op, fd);
 	sqe->optval =3D (unsigned long) (uintptr_t) optval;
 	sqe->optname =3D optname;
 	sqe->optlen =3D optlen;
-	sqe->cmd_op =3D cmd_op;
 	sqe->level =3D level;
 }
=20
@@ -1607,8 +1619,7 @@ IOURINGINLINE void io_uring_prep_cmd_discard(struct=
 io_uring_sqe *sqe,
 					     uint64_t offset, uint64_t nbytes)
 	LIBURING_NOEXCEPT
 {
-	io_uring_prep_rw(IORING_OP_URING_CMD, sqe, fd, 0, 0, 0);
-	sqe->cmd_op =3D BLOCK_URING_CMD_DISCARD;
+	io_uring_prep_uring_cmd(sqe, BLOCK_URING_CMD_DISCARD, fd);
 	sqe->addr =3D offset;
 	sqe->addr3 =3D nbytes;
 }
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index beaa81ad..0442b3a3 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -141,18 +141,16 @@ static int __test_io(const char *file, struct io_ur=
ing *ring, int tc, int read,
=20
 		if (sqthread)
 			use_fd =3D 0;
+		if (nonvec)
+			io_uring_prep_uring_cmd(sqe, NVME_URING_CMD_IO, use_fd);
+		else
+			io_uring_prep_uring_cmd(sqe, NVME_URING_CMD_IO_VEC, use_fd);
 		if (fixed && (i & 1))
 			do_fixed =3D 0;
 		if (do_fixed)
 			sqe->buf_index =3D 0;
 		if (async)
 			sqe->flags |=3D IOSQE_ASYNC;
-		if (nonvec)
-			sqe->cmd_op =3D NVME_URING_CMD_IO;
-		else
-			sqe->cmd_op =3D NVME_URING_CMD_IO_VEC;
-		sqe->fd =3D use_fd;
-		sqe->opcode =3D IORING_OP_URING_CMD;
 		if (do_fixed)
 			sqe->uring_cmd_flags |=3D IORING_URING_CMD_FIXED;
 		sqe->user_data =3D ((uint64_t)offset << 32) | i;
@@ -328,9 +326,7 @@ static int test_invalid_passthru_submit(const char *f=
ile)
 	}
=20
 	sqe =3D io_uring_get_sqe(&ring);
-	io_uring_prep_read(sqe, fd, vecs[0].iov_base, vecs[0].iov_len, 0);
-	sqe->cmd_op =3D NVME_URING_CMD_IO;
-	sqe->opcode =3D IORING_OP_URING_CMD;
+	io_uring_prep_uring_cmd(sqe, NVME_URING_CMD_IO, fd);
 	sqe->user_data =3D 1;
 	cmd =3D (struct nvme_uring_cmd *)sqe->cmd;
 	memset(cmd, 0, sizeof(struct nvme_uring_cmd));
@@ -401,10 +397,8 @@ static int test_io_uring_submit_enters(const char *f=
ile)
 		__u32 nlb;
=20
 		sqe =3D io_uring_get_sqe(&ring);
-		io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset);
+		io_uring_prep_uring_cmd(sqe, NVME_URING_CMD_IO, fd);
 		sqe->user_data =3D i;
-		sqe->opcode =3D IORING_OP_URING_CMD;
-		sqe->cmd_op =3D NVME_URING_CMD_IO;
 		cmd =3D (struct nvme_uring_cmd *)sqe->cmd;
 		memset(cmd, 0, sizeof(struct nvme_uring_cmd));
=20
--=20
2.47.3



From - Wed Oct 22 17:32:45 2025
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: <io-uring+bounces-10129-hi=josie.lol@vger.kernel.org>
Delivered-To: hi@josie.lol
Received: from witcher.mxrouting.net
	by witcher.mxrouting.net with LMTP
	id WPI+CAMV+WjaSCMAYBR5ng
	(envelope-from <io-uring+bounces-10129-hi=josie.lol@vger.kernel.org>)
	for <hi@josie.lol>; Wed, 22 Oct 2025 17:31:47 +0000
Return-path: <io-uring+bounces-10129-hi=josie.lol@vger.kernel.org>
Envelope-to: hi@josie.lol
Delivery-date: Wed, 22 Oct 2025 17:31:47 +0000
Received: from sv.mirrors.kernel.org ([139.178.88.99])
	by witcher.mxrouting.net with esmtps  (TLS1.3) tls TLS_AES_256_GCM_SHA384
	(Exim 4.98)
	(envelope-from <io-uring+bounces-10129-hi=josie.lol@vger.kernel.org>)
	id 1vBcgc-00000009sAY-2Kho
	for hi@josie.lol;
	Wed, 22 Oct 2025 17:31:46 +0000
Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by sv.mirrors.kernel.org (Postfix) with ESMTPS id 34FEF3B5AF4
	for <hi@josie.lol>; Wed, 22 Oct 2025 17:21:35 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B3CD285CB8;
	Wed, 22 Oct 2025 17:21:26 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="DfYsOrII"
X-Original-To: io-uring@vger.kernel.org
Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E86A2737F2
	for <io-uring@vger.kernel.org>; Wed, 22 Oct 2025 17:21:24 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.153.30
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1761153686; cv=none; b=DEpio7yUosJK26dW0BIGB39SJH9bCuwTMtBeWN7OXXh4NYPk5MeWW8Tn8bWpqSRW9U8kwGT78SjdDNePBXOC3pEgFyPWHmxmXNzA87Ogu5fSszgkQcEW8k1TWLYQiqAPEv8a5AtvQesGdtKA1CLzcbG45xTaLyqOxCD9A6R4ZtY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1761153686; c=relaxed/simple;
	bh=szIyqSsFsC4GHo02p1vmI1XKqf6tTRf6MR0CX8bAq60=;
	h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=uLZ7b/thOyGkclm0d0iHnzSW4vIYOyunonlooHPrxoJDDYs9pt1rVyNLwzg4gU3mjdMmyO+QWz0HJnO52wdGkmWeIz9mvzKE2NOacaWuEiJAlhCeD8EJr6X4A2DT84rQL+HlUDlacNcyvoZocrZmVtbPOB84MmgXpHbZ90JaszM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=DfYsOrII; arc=none smtp.client-ip=67.231.153.30
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com
Received: from pps.filterd (m0109332.ppops.net [127.0.0.1])
	by mx0a-00082601.pphosted.com (8.18.1.1