Skip to content

Commit

Permalink
io_uring: restrict IORING_SETUP_SQPOLL to root
Browse files Browse the repository at this point in the history
This options spawns a kernel side thread that will poll for submissions
(and completions, if IORING_SETUP_IOPOLL is set). As this allows a user
to potentially use more cycles outside of the normal hierarchy,
restrict the use of this feature to root.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Apr 8, 2019
1 parent 7042366 commit 3ec482d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,10 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
goto err;

if (ctx->flags & IORING_SETUP_SQPOLL) {
ret = -EPERM;
if (!capable(CAP_SYS_ADMIN))
goto err;

if (p->flags & IORING_SETUP_SQ_AFF) {
int cpu;

Expand Down

0 comments on commit 3ec482d

Please sign in to comment.