diff --git a/abi_used_symbols b/abi_used_symbols --- a/abi_used_symbols +++ b/abi_used_symbols @@ -382,12 +382,14 @@ libc.so.6:gai_strerror libc.so.6:getaddrinfo libc.so.6:getenv +libc.so.6:geteuid libc.so.6:gethostname libc.so.6:getopt_long libc.so.6:getpid libc.so.6:getpwuid libc.so.6:getpwuid_r libc.so.6:getrandom +libc.so.6:getrlimit64 libc.so.6:getsockname libc.so.6:getsockopt libc.so.6:gettid diff --git a/abi_used_symbols32 b/abi_used_symbols32 --- a/abi_used_symbols32 +++ b/abi_used_symbols32 @@ -344,11 +344,13 @@ libc.so.6:ftruncate64 libc.so.6:fwrite libc.so.6:getenv +libc.so.6:geteuid libc.so.6:gethostname libc.so.6:getpid libc.so.6:getpwuid libc.so.6:getpwuid_r libc.so.6:getrandom +libc.so.6:getrlimit64 libc.so.6:getsockopt libc.so.6:gettid libc.so.6:gettimeofday diff --git a/files/fix-rtkit.patch b/files/fix-rtkit.patch new file mode 100644 --- /dev/null +++ b/files/fix-rtkit.patch @@ -0,0 +1,94 @@ +--- a/src/modules/module-rt.c ++++ b/src/modules/module-rt.c +@@ -58,8 +58,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + + #include "config.h" + +@@ -515,6 +517,53 @@ static const struct pw_impl_module_event + }; + + /** ++ * Check if the current user has permissions to lower the nice levels enough. ++ */ ++static bool check_nice_level_privileges(int nice_level) ++{ ++ struct rlimit rlim; ++ int lowest_nice_allowed; ++ ++ /* On a POSIX system, the nice value of a thread can be lowered 1. by ++ * the root user, 2. by a user with the CAP_SYS_NICE permission or ++ * 3. by any user if the target value is within the range allowed by ++ * RLIMIT_NICE. ++ */ ++ ++ /* 1. Check for root user */ ++ if (geteuid() == 0) { ++ return true; ++ } ++ ++ /* 2. Skip checking the CAP_SYS_NICE permission because it would ++ * require libcap.so. ++ * 3. Check whether the target value is within the range allowed by ++ * RLIMIT_NICE. ++ * ++ * NZERO should be defined in per POSIX, and should be at ++ * least 20. (NZERO-1) is the highest possible niceness value ++ * (i.e. lowest priority). ++ * Most platforms use NZERO=20. ++ * ++ * RLIMIT_NICE tells us how much we can reduce niceness (increase ++ * priority) if we start at NZERO. For example, if NZERO is 20 and the ++ * rlimit is 30, we can lower niceness anywhere within the [-10, 19] ++ * range (20 - 30 = -10). ++ * ++ * So, we are allowed to reduce niceness to a minimum of ++ * NZERO - rlimit: ++ */ ++ if (getrlimit(RLIMIT_NICE, &rlim) != 0) { ++ return false; ++ } ++ lowest_nice_allowed = NZERO - (int)rlim.rlim_cur; ++ /* And lowering niceness to |nice_level| is allowed if it is greater ++ * than or equal to the limit: ++ */ ++ return nice_level >= lowest_nice_allowed; ++} ++ ++/** + * Check if the current user has permissions to use realtime scheduling at the + * specified priority. + */ +@@ -553,6 +602,17 @@ static bool check_realtime_privileges(rl + } + } + ++/** ++ * Check if the current user has sufficient permissions. ++ */ ++static bool check_privileges(int nice_level, rlim_t priority) ++{ ++ if (!check_nice_level_privileges(nice_level)) { ++ return false; ++ } ++ return check_realtime_privileges(priority); ++} ++ + static int sched_set_nice(int nice_level) + { + if (setpriority(PRIO_PROCESS, _gettid(), nice_level) == 0) +@@ -878,7 +938,7 @@ static int should_use_rtkit(struct impl + + /* If the user has permissions to use regular realtime scheduling, then + * we'll use that instead of RTKit */ +- if (check_realtime_privileges(impl->rt_prio)) { ++ if (check_privileges(impl->nice_level, impl->rt_prio)) { + *use_rtkit = false; + } else { + if (!(*use_rtkit)) { diff --git a/package.yml b/package.yml --- a/package.yml +++ b/package.yml @@ -1,6 +1,6 @@ name : pipewire version : 0.3.53 -release : 49 +release : 50 source : - git|https://gitlab.freedesktop.org/pipewire/pipewire.git : 76350cebefe9bdabe24e9d043b83737547c225d8 homepage : https://pipewire.org/ @@ -51,6 +51,7 @@ - /usr/share/ld.so.conf.d/pipewire-jack.conf - /usr/share/pipewire/jack.conf setup : | + %patch -p1 < $pkgfiles/fix-rtkit.patch sed -i 's:alsa.conf.d:conf.d:' ./pipewire-alsa/conf/meson.build COMMON_OPTIONS="-Dsystemd=enabled \ -Decho-cancel-webrtc=enabled \ diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -3,8 +3,8 @@ pipewire https://pipewire.org/ - Thomas Staudinger - Staudi.Kaos@gmail.com + Reilly Brogan + solus@reillybrogan.com MIT LGPL-2.1-or-later @@ -252,7 +252,7 @@ emul32 - pipewire + pipewire /usr/lib32/alsa-lib/libasound_module_ctl_pipewire.so @@ -317,8 +317,8 @@ programming.devel - pipewire-devel - pipewire-32bit + pipewire-devel + pipewire-32bit /usr/lib32/libpipewire-0.3.so @@ -343,7 +343,7 @@ programming.devel - pipewire + pipewire /usr/include/pipewire-0.3/pipewire/array.h @@ -500,7 +500,7 @@ multimedia.audio - pipewire + pipewire /usr/bin/pw-jack @@ -519,12 +519,12 @@ - - 2022-07-05 + + 2022-07-06 0.3.53 Packaging update - Thomas Staudinger - Staudi.Kaos@gmail.com + Reilly Brogan + solus@reillybrogan.com \ No newline at end of file