Skip to contentSkip to conversation

FAILED: patch "[PATCH] io_uring/kbuf: don't truncate end buffer for bundles" failed to apply to 6.18-stable tree

PATCH [email protected] 2 participants 3 messages Jun 15

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 70f4886bcbb929e88038c8807f1daf7fc587ae7c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026061524-overtone-renovate-0e4d@gregkh' --subject-prefix 'PATCH 6.18.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 70f4886bcbb929e88038c8807f1daf7fc587ae7c Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Sun, 7 Jun 2026 16:05:47 -0600
Subject: [PATCH] io_uring/kbuf: don't truncate end buffer for bundles

If buffers have been peeked for a bundle receive, the kernel will truncate the end buffer, if the available length is shorter than the buffer itself. This is unnecessary, as applications iterating bundle receives must always use the minimum size of the buffer length and the remaining number of bytes in the bundle. The examples in liburing do that as well, eg examples/proxy.c.

If the kernel does truncate this buffer AND the current transfer fails, then the buffer will be left with a smaller size than what is otherwise available.

Just remove the buffer truncation, as it's not necessary in the first place.

io_uring/kbuf.c +0 -1
index 63061aa1cab9..926254b6898f 100644
@@ -305,7 +305,6 @@ static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
 				arg->partial_map = 1;
 				if (iov != arg->iovs)
 					break;
-				WRITE_ONCE(buf->len, len);
 			}
 		}
 
maintainer
#1 lore raw
Quoted 5 lines · On 6/15/26 8:18 AM, [email protected] wrote:

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Here's one for 6.18-stable.

Signature · 1 line
Jens Axboe

From b01e74c189cc3e17fbb98f28f69245b259144429 Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Sun, 7 Jun 2026 16:05:47 -0600
Subject: [PATCH 2/2] io_uring/kbuf: don't truncate end buffer for bundles

Commit 70f4886bcbb929e88038c8807f1daf7fc587ae7c upstream.

If buffers have been peeked for a bundle receive, the kernel will truncate the end buffer, if the available length is shorter than the buffer itself. This is unnecessary, as applications iterating bundle receives must always use the minimum size of the buffer length and the remaining number of bytes in the bundle. The examples in liburing do that as well, eg examples/proxy.c.

If the kernel does truncate this buffer AND the current transfer fails, then the buffer will be left with a smaller size than what is otherwise available.

Just remove the buffer truncation, as it's not necessary in the first place.

---
 io_uring/kbuf.c | 1 -
 1 file changed, 1 deletion(-)
io_uring/kbuf.c +0 -1
index 32d3b8d26bf0..c260d5f34cf3 100644
@@ -305,7 +305,6 @@ static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
 				arg->partial_map = 1;
 				if (iov != arg->iovs)
 					break;
-				buf->len = len;
 			}
 		}
 
Signature · 1 line
2.53.0
author maintainer
#2 lore raw
Quoted 8 lines · Jens Axboe
Quoted 5 lines · On 6/15/26 8:18 AM, [email protected] wrote:

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Here's one for 6.18-stable.

Both now queued up, thanks!

greg k-h