block: grant IOPRIO_CLASS_RT to CAP_SYS_NICE
authorKhazhismel Kumykov <khazhy@google.com>
Mon, 24 Aug 2020 22:10:34 +0000 (15:10 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Sep 2020 01:38:33 +0000 (19:38 -0600)
CAP_SYS_ADMIN is too broad, and ionice fits into CAP_SYS_NICE's grouping.

Retain CAP_SYS_ADMIN permission for backwards compatibility.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/ioprio.c
include/uapi/linux/capability.h

index 04ebd37966f181eee55282e67bc96c696de2fdc2..364d2294ba90415f896dd62ad3f049f78d7fb84b 100644 (file)
@@ -69,7 +69,7 @@ int ioprio_check_cap(int ioprio)
 
        switch (class) {
                case IOPRIO_CLASS_RT:
-                       if (!capable(CAP_SYS_ADMIN))
+                       if (!capable(CAP_SYS_NICE) && !capable(CAP_SYS_ADMIN))
                                return -EPERM;
                        fallthrough;
                        /* rt has prio field too */
index 395dd0df8d08dedccdcd4c7359f16cfc148d1ab4..c6ca330341471d3f54da948d1484c2919eec1f76 100644 (file)
@@ -288,6 +288,8 @@ struct vfs_ns_cap_data {
    processes and setting the scheduling algorithm used by another
    process. */
 /* Allow setting cpu affinity on other processes */
+/* Allow setting realtime ioprio class */
+/* Allow setting ioprio class on other processes */
 
 #define CAP_SYS_NICE         23