aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-04-08 12:51:01 -0400
committerJens Axboe <axboe@kernel.dk>2019-04-08 12:51:01 -0400
commit3ec482d15cb986bf08b923f9193eeddb3b9ca69f (patch)
tree4f3f31a7670b0f9e0c6aebf008aef8bd5430394e
parent704236672edacf353c362bab70c3d3eda7bb4a51 (diff)
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>
-rw-r--r--fs/io_uring.c4
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,
2245 goto err; 2245 goto err;
2246 2246
2247 if (ctx->flags & IORING_SETUP_SQPOLL) { 2247 if (ctx->flags & IORING_SETUP_SQPOLL) {
2248 ret = -EPERM;
2249 if (!capable(CAP_SYS_ADMIN))
2250 goto err;
2251
2248 if (p->flags & IORING_SETUP_SQ_AFF) { 2252 if (p->flags & IORING_SETUP_SQ_AFF) {
2249 int cpu; 2253 int cpu;
2250 2254