[systemd-devel] Real-time permission affected by root login on other tty

Lars Christensen larsch at belunktum.dk
Sat Mar 7 11:04:22 PST 2015


With systemd 218 and 219, I have a strange issue that processes running as
root cannot acquire realtime priority (SCHED_RR, priority 22). Further, if
(and only if) root is logged in (via tty or ssh), users processes can also
not acquire realtime priority. If root is NOT logged in, user processes CAN
acquire real time priority(!).

With systemd 216 there is no issue. I'm on Arch Linux.

To reproduce:

Method 1:

1. Login on tty1 as as root
2. Execute program that attempts to acquire realtime priority.

Method 2:

1. Login on tty1 as root
2. Log in on tty2 as other user
3. Execute program that attempts to acquire realtime priority on tty2

If step 1 is skipped in method 2, or logged in before root, the program
runs normally (as non-root user) (assuming appropriate rlimit via
/etc/security/limits.conf).

strace output:

sched_setscheduler(183, SCHED_RR, { 22 }) = -1 EPERM (Operation not
permitted)

ulimit -r (as root): 0 (but should be able to do realtime as root anyway)
ulimit -r (as user): 65 (via /etc/security/limits.conf, audio group)

Downgrading only systemd, systemd-sysvcompat, libsystemd to 216 fixes the
issue. With 218 and 219 I get the EPERM above.

Source code for test program:

https://gist.github.com/larsch/58d1be84b24c98a4493f

Bug or PEBKAC?
-- 
Lars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150307/1ef996cb/attachment.html>


More information about the systemd-devel mailing list