Skip to contentSkip to conversation

io_uring: fix recvmsg setup with compat buf-select

PATCH Applied Pavel Begunkov 2 participants 5 messages Nov 29, 2020 – Dec 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix recvmsg setup with compat buf-select

__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.

---
 fs/io_uring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/io_uring.c +2 -1
index 1023f7b44cea..a2a7c65a77aa 100644
@@ -4499,7 +4499,8 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
 			return -EFAULT;
 		if (clen < 0)
 			return -EINVAL;
-		sr->len = iomsg->iov[0].iov_len;
+		sr->len = clen;
+		iomsg->iov[0].iov_len = clen;
 		iomsg->iov = NULL;
 	} else {
 		ret = __import_iovec(READ, (struct iovec __user *)uiov, len,
Signature · 1 line
2.24.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Pavel Begunkov

__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.

Applied, thanks.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 7 lines · Jens Axboe
Quoted 4 lines · Pavel Begunkov

__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.

Applied, thanks.

Jens, apologies but where did it go? Can't find at git.kernel.dk

Signature · 1 line
Pavel Begunkov
maintainer
#3 lore raw
Quoted 10 lines · Pavel Begunkov
Quoted 7 lines · Jens Axboe
Quoted 4 lines · Pavel Begunkov

__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.

Applied, thanks.

Jens, apologies but where did it go? Can't find at git.kernel.dk

Looks like I forgot to push it out, but it did get applied to io_uring-5.10. My git box is having an issue right now, so can't even push it out... Will do so tomorrow morning.

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Pavel Begunkov
Quoted 6 lines · Jens Axboe
Quoted 4 lines · Pavel Begunkov

__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks.

Jens, apologies but where did it go? Can't find at git.kernel.dk

Looks like I forgot to push it out, but it did get applied to io_uring-5.10. My git box is having an issue right now, so can't even push it out... Will do so tomorrow morning.

That's ok, just trying to keep track. Sorry for bothering

Signature · 1 line
Pavel Begunkov