block: grant IOPRIO_CLASS_RT to CAP_SYS_NICE
Subsystems (3)
PATCH 1/1 block: grant IOPRIO_CLASS_RT to CAP_SYS_NICE
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 <[email protected]>
--- block/ioprio.c | 2 +- include/uapi/linux/capability.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
block/ioprio.c +1 -1
@@ -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_ADMIN ) || !capable (CAP_SYS_NICE ))return -EPERM ;/* fall through */ /* rt has prio field too */
include/uapi/linux/capability.h +2 -0
@@ -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
Signature · 1 line
2.28.0.297.g1956fa8f8d-goog
Quoted 16 lines · Khazhismel Kumykov
CAP_SYS_ADMINis too broad, and ionice fits into CAP_SYS_NICE's grouping.Retain
CAP_SYS_ADMINpermission for backwards compatibility.Signed-off-by Khazhismel Kumykov <[email protected]>--- block/ioprio.c | 2 +- include/uapi/linux/capability.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)block/ioprio.c +0
-0
block/ioprio.c int ioprio_check_cap(int ioprio) · line 72
Quoted 5 lines
block/ioprio.c +1
-1@@ -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_ADMIN ) || !capable (CAP_SYS_NICE ))
yikes, sorry for the spam
Quoted 19 lines
block/ioprio.c +0
-0return -EPERM ;/* fall through */ /* rt has prio field too */ include/uapi/linux/capability.h +2
-1@@ -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 --2.28.0.297.g1956fa8f8d-goog