diff options
| author | ErrorNoInternet <errornointernet@envs.net> | 2026-04-15 18:20:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-15 23:20:20 +0100 |
| commit | e6c5040f417001fc3cf20e21f971f926626a0f6f (patch) | |
| tree | ac5b969d716e5b1611c0c01c7cc7ed5e9ce85ed9 /src/init/initHelpers.cpp | |
| parent | 88f3e7e9d519ae704cab78548c6f6bf02a0b0841 (diff) | |
init: drop CAP_SYS_NICE from ambient set after gaining SCHED_RR (#14082)
Diffstat (limited to 'src/init/initHelpers.cpp')
| -rw-r--r-- | src/init/initHelpers.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/init/initHelpers.cpp b/src/init/initHelpers.cpp index f3911c04..5d4d0b25 100644 --- a/src/init/initHelpers.cpp +++ b/src/init/initHelpers.cpp @@ -1,3 +1,6 @@ +#include <linux/capability.h> +#include <sys/prctl.h> + #include "initHelpers.hpp" bool NInit::isSudo() { @@ -21,6 +24,10 @@ void NInit::gainRealTime() { return; } + // NixOS-specific fix to prevent all children from inheriting + // CAP_SYS_NICE due to how the security wrapper works. + prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, CAP_SYS_NICE, 0, 0); + pthread_atfork(nullptr, nullptr, []() { const struct sched_param param = {.sched_priority = 0}; if (pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m)) |
