Hi,

busybox's chpst first switches user/group and then tries to call nice().
Once the root priviledges are dropped, process priority can only be lowered. So 
negative nice values don't work anymore.
Upstream version of chpst correctly calls nice() before switching user.

-- 

--- busybox-1.26.2/runit/chpst.c~       2017-03-02 22:09:36.000000000 +0100
+++ busybox-1.26.2/runit/chpst.c        2017-03-02 22:15:50.222049716 +0100
@@ -462,6 +462,12 @@
                xchroot(root);
        }
 
+       if (opt & OPT_n) {
+               errno = 0;
+               if (nice(xatoi(nicestr)) == -1)
+                       bb_perror_msg_and_die("nice");
+       }
+
        if (opt & OPT_u) {
                int rv = strchr(set_user, ':') ? setgroups(1, &ugid.gid) : 
initgroups(set_user, ugid.gid);
                if (rv == -1)
@@ -470,12 +476,6 @@
                xsetuid(ugid.uid);
        }
 
-       if (opt & OPT_n) {
-               errno = 0;
-               if (nice(xatoi(nicestr)) == -1)
-                       bb_perror_msg_and_die("nice");
-       }
-
        if (opt & OPT_0)
                close(STDIN_FILENO);
        if (opt & OPT_1)

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to