diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-04-08 19:51:01 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-04-08 19:51:01 +0300 |
commit | 3ec482d15cb986bf08b923f9193eeddb3b9ca69f (patch) | |
tree | 4f3f31a7670b0f9e0c6aebf008aef8bd5430394e /fs | |
parent | 704236672edacf353c362bab70c3d3eda7bb4a51 (diff) | |
download | linux-3ec482d15cb986bf08b923f9193eeddb3b9ca69f.tar.xz |
io_uring: restrict IORING_SETUP_SQPOLL to root
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 07d6ef195d05..89aa8412b5f5 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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; |