[Bug 276962] mac_priority(4) doesn't affect sched_setscheduler(2)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 11 Feb 2024 00:40:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276962

            Bug ID: 276962
           Summary: mac_priority(4) doesn't affect sched_setscheduler(2)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: jbeich@FreeBSD.org
                CC: dev@submerge.ch
 Attachment #248339 text/plain
         mime type:

Created attachment 248339
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=248339&action=edit
test_sched.c (example)

Setting real-time priority (via POSIX API) as regular user doesn't seem to work
for non-threaded programs.

$ kldload mac_priority
$ pw group mod realtime -m ${USER:-$(id -u)}
$ cc -o test_sched test_sched.c; ./test_sched
test_sched: FAILED: cannot set real-time scheduling priority to 0: Operation
not permitted
$ cc -DTHREADS -pthread -o test_sched test_sched.c; ./test_sched
test_sched: SUCCESS: set real-time scheduling priority to 0

-- 
You are receiving this mail because:
You are the assignee for the bug.