Re: [syzbot] [io-uring?] KMSAN: uninit-value in io_req_task_work_add_remote
From: Edward Adam Davis
Date: Wed Jul 24 2024 - 07:13:31 EST
when alloc buffer for req, init mem to 0
#syz test: upstream 2c9b3512402e
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 8e6faa942a6f..a650db25c383 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -933,7 +933,7 @@ static void io_preinit_req(struct io_kiocb *req, struct io_ring_ctx *ctx)
__cold bool __io_alloc_req_refill(struct io_ring_ctx *ctx)
__must_hold(&ctx->uring_lock)
{
- gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+ gfp_t gfp = GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO;
void *reqs[IO_REQ_ALLOC_BATCH];
int ret;