Skip to contentSkip to conversation

fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe

PATCH In review Liu Yong 3 participants 4 messages Aug 13, 2020 – Aug 14, 2020

Subsystems (3)
lore
Share & tools
lore

Liu Yong

author
#0 lore raw

PATCH 1/1 fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe

the commit <a4d61e66ee4a> ("<io_uring: prevent re-read of sqe->opcode>") caused another vulnerability. After io_get_req(), the sqe_submit struct in req is not initialized, but the following code defaults that req->submit.opcode is available.

---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
index be3d595a607f..c1aaee061dae 100644
@@ -2559,6 +2559,7 @@ static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
 		goto err;
 	}
 
+	memcpy(&req->submit, s, sizeof(*s));
 	ret = io_req_set_file(ctx, s, state, req);
 	if (unlikely(ret)) {
 err_req:
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Liu Yong

the commit <a4d61e66ee4a> ("<io_uring: prevent re-read of sqe->opcode>") caused another vulnerability. After io_get_req(), the sqe_submit struct in req is not initialized, but the following code defaults that req->submit.opcode is available.

Thanks, I'll add this for 5.4-stable, it doesn't affect any kernels newer than that.

Signature · 1 line
Jens Axboe
maintainer
#2 lore raw

PATCH 1/1 fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe

In reply to Liu Yong

Hi,

Can you queue this up for 5.4 as well? Thanks!

-------- Forwarded Message --------
Subject: [PATCH] fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe
Date: Wed, 12 Aug 2020 23:56:44 -0700
From: Liu Yong <[email protected]>
To: Jens Axboe <[email protected]>
CC: [email protected], [email protected], [email protected]

the commit <a4d61e66ee4a> ("<io_uring: prevent re-read of sqe->opcode>") caused another vulnerability. After io_get_req(), the sqe_submit struct in req is not initialized, but the following code defaults that req->submit.opcode is available.

---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
index be3d595a607f..c1aaee061dae 100644
@@ -2559,6 +2559,7 @@ static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
 		goto err;
 	}
 
+	memcpy(&req->submit, s, sizeof(*s));
 	ret = io_req_set_file(ctx, s, state, req);
 	if (unlikely(ret)) {
 err_req:
Signature · 1 line
2.17.1
maintainer Applied
#3 lore raw
Quoted 3 lines · Jens Axboe

Hi,

Can you queue this up for 5.4 as well? Thanks!

Queued up, thanks!

Signature · 2 lines
Thanks,
Sasha