aports/main/strace/linux-headers-7.0.patch
2026-04-21 09:21:18 +00:00

275 lines
10 KiB
Diff

From 619b1e60da171d573481d2fbfea7645c8a80d1ae Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Tue, 10 Mar 2026 08:00:00 +0000
Subject: [PATCH] bundled: update linux/io_uring.h to v7.0-rc3
* bundled/linux/include/uapi/linux/io_uring.h: Update to
headers_install'ed Linux kernel v7.0-rc3.
* src/io_uring.c (print_io_uring_zcrx_ifq_reg): Follow the rename
of __resv2 field of struct io_uring_zcrx_ifq_reg to rx_buf_len.
* tests/io_uring_register.c (test_IORING_REGISTER_ZCRX_IFQ): Update
expected output.
---
bundled/linux/include/uapi/linux/io_uring.h | 35 +++++++++++++++++++--
src/io_uring.c | 7 ++---
tests/io_uring_register.c | 8 ++---
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/bundled/linux/include/uapi/linux/io_uring.h b/bundled/linux/include/uapi/linux/io_uring.h
index b5b23c0d52..1ff16141c8 100644
--- a/bundled/linux/include/uapi/linux/io_uring.h
+++ b/bundled/linux/include/uapi/linux/io_uring.h
@@ -188,7 +188,8 @@ enum io_uring_sqe_flags_bit {
/*
* If COOP_TASKRUN is set, get notified if task work is available for
* running and a kernel transition would be needed to run it. This sets
- * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
+ * IORING_SQ_TASKRUN in the sq ring flags. Not valid without COOP_TASKRUN
+ * or DEFER_TASKRUN.
*/
#define IORING_SETUP_TASKRUN_FLAG (1U << 9)
#define IORING_SETUP_SQE128 (1U << 10) /* SQEs are 128 byte */
@@ -237,6 +238,18 @@ enum io_uring_sqe_flags_bit {
*/
#define IORING_SETUP_SQE_MIXED (1U << 19)
+/*
+ * When set, io_uring ignores SQ head and tail and fetches SQEs to submit
+ * starting from index 0 instead from the index stored in the head pointer.
+ * IOW, the user should place all SQE at the beginning of the SQ memory
+ * before issuing a submission syscall.
+ *
+ * It requires IORING_SETUP_NO_SQARRAY and is incompatible with
+ * IORING_SETUP_SQPOLL. The user must also never change the SQ head and tail
+ * values and keep it set to 0. Any other value is undefined behaviour.
+ */
+#define IORING_SETUP_SQ_REWIND (1U << 20)
+
enum io_uring_op {
IORING_OP_NOP,
IORING_OP_READV,
@@ -700,6 +713,9 @@ enum io_uring_register_op {
/* auxiliary zcrx configuration, see enum zcrx_ctrl_op */
IORING_REGISTER_ZCRX_CTRL = 36,
+ /* register bpf filtering programs */
+ IORING_REGISTER_BPF_FILTER = 37,
+
/* this goes last */
IORING_REGISTER_LAST,
@@ -805,6 +821,13 @@ struct io_uring_restriction {
__u32 resv2[3];
};
+struct io_uring_task_restriction {
+ __u16 flags;
+ __u16 nr_res;
+ __u32 resv[3];
+ __DECLARE_FLEX_ARRAY(struct io_uring_restriction, restrictions);
+};
+
struct io_uring_clock_register {
__u32 clockid;
__u32 __resv[3];
@@ -1068,6 +1091,14 @@ enum zcrx_reg_flags {
ZCRX_REG_IMPORT = 1,
};
+enum zcrx_features {
+ /*
+ * The user can ask for the desired rx page size by passing the
+ * value in struct io_uring_zcrx_ifq_reg::rx_buf_len.
+ */
+ ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0,
+};
+
/*
* Argument for IORING_REGISTER_ZCRX_IFQ
*/
@@ -1082,7 +1113,7 @@ struct io_uring_zcrx_ifq_reg {
struct io_uring_zcrx_offsets offsets;
__u32 zcrx_id;
- __u32 __resv2;
+ __u32 rx_buf_len;
__u64 __resv[3];
};
diff --git a/src/io_uring.c b/src/io_uring.c
index a479c9570a..04de316513 100644
--- a/src/io_uring.c
+++ b/src/io_uring.c
@@ -1254,11 +1254,8 @@ print_io_uring_zcrx_ifq_reg(struct tcb *tcp, const kernel_ulong_t addr)
print_io_uring_zcrx_offsets(tcp, &arg.offsets);
tprint_struct_next();
PRINT_FIELD_U(arg, zcrx_id);
-
- if (arg.__resv2) {
- tprint_struct_next();
- PRINT_FIELD_X(arg, __resv2);
- }
+ tprint_struct_next();
+ PRINT_FIELD_U(arg, rx_buf_len);
if (!IS_ARRAY_ZERO(arg.__resv)) {
tprint_struct_next();
diff --git a/tests/io_uring_register.c b/tests/io_uring_register.c
index cfaa93d208..9952f0370e 100644
--- a/tests/io_uring_register.c
+++ b/tests/io_uring_register.c
@@ -2058,7 +2058,7 @@ test_IORING_REGISTER_ZCRX_IFQ(int fd_null)
", flags=" XLAT_FMT
", area_ptr=%#llx, region_ptr=%#llx"
", offsets={head=%u, tail=%u, rqes=%u}"
- ", zcrx_id=%u}, 1) = %s\n",
+ ", zcrx_id=%u, rx_buf_len=0}, 1) = %s\n",
fd_null, path_null,
XLAT_SEL(zcrx_ifq_ops.val, zcrx_ifq_ops.str),
zcrx_ifq->if_idx, zcrx_ifq->if_rxq, zcrx_ifq->rq_entries,
@@ -2073,9 +2073,9 @@ test_IORING_REGISTER_ZCRX_IFQ(int fd_null)
memset(zcrx_ifq, 0, sizeof(*zcrx_ifq));
zcrx_ifq->if_idx = 0xaaaa;
zcrx_ifq->offsets.__resv2 = 0xbbbb;
- zcrx_ifq->__resv2 = 0xcccc;
zcrx_ifq->offsets.__resv[0] = 0xddddddddddddddddULL;
zcrx_ifq->offsets.__resv[1] = 0xeeeeeeeeeeeeeeeeULL;
+ zcrx_ifq->rx_buf_len = 0xcccc;
zcrx_ifq->__resv[0] = 0x1111111111111111ULL;
zcrx_ifq->__resv[1] = 0x2222222222222222ULL;
zcrx_ifq->__resv[2] = 0x3333333333333333ULL;
@@ -2086,7 +2086,7 @@ test_IORING_REGISTER_ZCRX_IFQ(int fd_null)
", area_ptr=NULL, region_ptr=NULL"
", offsets={head=0, tail=0, rqes=0, __resv2=%#x"
", __resv=[%#llx, %#llx]}"
- ", zcrx_id=0, __resv2=%#x"
+ ", zcrx_id=0, rx_buf_len=%u"
", __resv=[%#llx, %#llx, %#llx]}, 1) = %s\n",
fd_null, path_null,
XLAT_SEL(zcrx_ifq_ops.val, zcrx_ifq_ops.str),
@@ -2094,7 +2094,7 @@ test_IORING_REGISTER_ZCRX_IFQ(int fd_null)
zcrx_ifq->offsets.__resv2,
(unsigned long long) zcrx_ifq->offsets.__resv[0],
(unsigned long long) zcrx_ifq->offsets.__resv[1],
- zcrx_ifq->__resv2,
+ zcrx_ifq->rx_buf_len,
(unsigned long long) zcrx_ifq->__resv[0],
(unsigned long long) zcrx_ifq->__resv[1],
(unsigned long long) zcrx_ifq->__resv[2],
From 81fb4e6cd8b22acc51b8f7226a60a75825087d7b Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Wed, 11 Mar 2026 08:00:00 +0000
Subject: [PATCH] bundled: update linux/io_uring/query.h to v7.0-rc3
* bundled/linux/include/uapi/linux/io_uring/query.h: Update to
headers_install'ed Linux kernel v7.0-rc3.
* src/io_uring.c (print_io_uring_query_zcrx): Follow the rename
of "__resv1" field of struct io_uring_query_zcrx to "features".
* tests/io_uring_register.c (test_IORING_REGISTER_QUERY): Update
expected output.
---
.../linux/include/uapi/linux/io_uring/query.h | 6 +++++-
src/io_uring.c | 7 ++-----
tests/io_uring_register.c | 16 ++++++++--------
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/bundled/linux/include/uapi/linux/io_uring/query.h b/bundled/linux/include/uapi/linux/io_uring/query.h
index 2456e6c5e..95500759c 100644
--- a/bundled/linux/include/uapi/linux/io_uring/query.h
+++ b/bundled/linux/include/uapi/linux/io_uring/query.h
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
/*
* Header file for the io_uring query interface.
+ *
+ * Copyright (C) 2026 Pavel Begunkov <asml.silence@gmail.com>
+ * Copyright (C) Meta Platforms, Inc.
*/
#ifndef LINUX_IO_URING_QUERY_H
#define LINUX_IO_URING_QUERY_H
@@ -50,7 +53,8 @@ struct io_uring_query_zcrx {
__u64 area_flags;
/* The number of supported ZCRX_CTRL_* opcodes */
__u32 nr_ctrl_opcodes;
- __u32 __resv1;
+ /* Bitmask of ZCRX_FEATURE_* indicating which features are available */
+ __u32 features;
/* The refill ring header size */
__u32 rq_hdr_size;
/* The alignment for the header */
diff --git a/src/io_uring.c b/src/io_uring.c
index 04de31651..d6eb63ffe 100644
--- a/src/io_uring.c
+++ b/src/io_uring.c
@@ -1538,15 +1538,12 @@ print_io_uring_query_zcrx(struct tcb *tcp, const kernel_ulong_t addr)
tprint_struct_next();
PRINT_FIELD_U(zcrx, nr_ctrl_opcodes);
tprint_struct_next();
+ PRINT_FIELD_X(zcrx, features);
+ tprint_struct_next();
PRINT_FIELD_U(zcrx, rq_hdr_size);
tprint_struct_next();
PRINT_FIELD_U(zcrx, rq_hdr_alignment);
- if (zcrx.__resv1) {
- tprint_struct_next();
- PRINT_FIELD_X(zcrx, __resv1);
- }
-
if (zcrx.__resv2) {
tprint_struct_next();
PRINT_FIELD_X(zcrx, __resv2);
diff --git a/tests/io_uring_register.c b/tests/io_uring_register.c
index 9952f0370..158c714a0 100644
--- a/tests/io_uring_register.c
+++ b/tests/io_uring_register.c
@@ -2373,8 +2373,8 @@ test_IORING_REGISTER_QUERY(int fd_null)
printf("io_uring_register(%u<%s>, " XLAT_FMT
", {query_data=%p, query_op=" XLAT_FMT ", size=%u, result=0"
", query_data={register_flags=" XLAT_FMT ", area_flags=" XLAT_FMT
- ", nr_ctrl_opcodes=%u, rq_hdr_size=%u, rq_hdr_alignment=%u}"
- ", next_entry=NULL}, 0) = %s\n",
+ ", nr_ctrl_opcodes=%u, features=0, rq_hdr_size=%u"
+ ", rq_hdr_alignment=%u}, next_entry=NULL}, 0) = %s\n",
fd_null, path_null,
XLAT_SEL(query_ops.val, query_ops.str),
zcrx_data,
@@ -2490,8 +2490,8 @@ test_IORING_REGISTER_QUERY(int fd_null)
", sqe_flags=0, nr_query_opcodes=0}, next_entry="
"{query_data=%p, query_op=" XLAT_FMT ", size=%u, result=0"
", query_data={register_flags=0, area_flags=0"
- ", nr_ctrl_opcodes=%u, rq_hdr_size=0, rq_hdr_alignment=0}"
- ", next_entry=NULL}}, 0) = %s\n",
+ ", nr_ctrl_opcodes=%u, features=0, rq_hdr_size=0"
+ ", rq_hdr_alignment=0}, next_entry=NULL}}, 0) = %s\n",
fd_null, path_null,
XLAT_SEL(query_ops.val, query_ops.str),
opcode_data2,
@@ -2570,22 +2570,22 @@ test_IORING_REGISTER_QUERY(int fd_null)
hdr->result = 0;
memset(zcrx_data, 0, sizeof(*zcrx_data));
- zcrx_data->__resv1 = 0xdeadbeef;
+ zcrx_data->features = 0xdeadbeef;
zcrx_data->__resv2 = 0xcafebabe12345678ULL;
sys_io_uring_register(fd_null, query_ops.val, hdr, 0);
printf("io_uring_register(%u<%s>, " XLAT_FMT
", {query_data=%p, query_op=" XLAT_FMT ", size=%u, result=0"
", query_data={register_flags=0, area_flags=0"
- ", nr_ctrl_opcodes=0, rq_hdr_size=0"
- ", rq_hdr_alignment=0, __resv1=%#x, __resv2=%#llx}"
+ ", nr_ctrl_opcodes=0, features=%#x, rq_hdr_size=0"
+ ", rq_hdr_alignment=0, __resv2=%#llx}"
", next_entry=NULL}, 0) = %s\n",
fd_null, path_null,
XLAT_SEL(query_ops.val, query_ops.str),
zcrx_data,
XLAT_ARGS(IO_URING_QUERY_ZCRX),
(unsigned int) sizeof(*zcrx_data),
- zcrx_data->__resv1,
+ zcrx_data->features,
(unsigned long long) zcrx_data->__resv2,
errstr);