[SRU][Mantic][PATCH 1/2] io_uring: enable io_mem_alloc/free to be used in other parts
Yuxuan Luo
yuxuan.luo at canonical.com
Tue Jan 30 02:35:18 UTC 2024
From: Jens Axboe <axboe at kernel.dk>
In preparation for using these helpers, make them non-static and add
them to our internal header.
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(cherry picked from commit edecf1689768452ba1a64b7aaf3a47a817da651a)
CVE-2024-0582
Signed-off-by: Yuxuan Luo <yuxuan.luo at canonical.com>
---
io_uring/io_uring.c | 4 ++--
io_uring/io_uring.h | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 43d192dcc934d..1b0a27fe41eef 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2659,7 +2659,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
return READ_ONCE(rings->cq.head) == READ_ONCE(rings->cq.tail) ? ret : 0;
}
-static void io_mem_free(void *ptr)
+void io_mem_free(void *ptr)
{
if (!ptr)
return;
@@ -2771,7 +2771,7 @@ static void io_rings_free(struct io_ring_ctx *ctx)
}
}
-static void *io_mem_alloc(size_t size)
+void *io_mem_alloc(size_t size)
{
gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO | __GFP_NOWARN | __GFP_COMP;
void *ret;
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 0bc145614a6e6..d2bad1df347da 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -86,6 +86,9 @@ bool __io_alloc_req_refill(struct io_ring_ctx *ctx);
bool io_match_task_safe(struct io_kiocb *head, struct task_struct *task,
bool cancel_all);
+void *io_mem_alloc(size_t size);
+void io_mem_free(void *ptr);
+
#if defined(CONFIG_PROVE_LOCKING)
static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
{
--
2.34.1
More information about the kernel-team
mailing list