Skip to content

Commit d7cce96

Browse files
isilenceaxboe
authored andcommitted
io_uring: limit registration w/ SINGLE_ISSUER
IORING_SETUP_SINGLE_ISSUER restricts what tasks can submit requests. Extend it to registration as well, so non-owning task can't do registrations. It's not necessary at the moment but might be useful in the future. Cc: <[email protected]> # 6.0 Fixes: 97bbdc0 ("io_uring: add IORING_SETUP_SINGLE_ISSUER") Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/f52a6a9c8a8990d4a831f73c0571e7406aac2bba.1664237592.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 4add705 commit d7cce96

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

io_uring/io_uring.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,6 +3890,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
38903890
if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs)))
38913891
return -ENXIO;
38923892

3893+
if (ctx->submitter_task && ctx->submitter_task != current)
3894+
return -EEXIST;
3895+
38933896
if (ctx->restricted) {
38943897
if (opcode >= IORING_REGISTER_LAST)
38953898
return -EINVAL;

0 commit comments

Comments
 (0)