aboutsummaryrefslogtreecommitdiff
path: root/repos/extra/librewolf/musl-sandbox-sched.patch
blob: 87b6e660444018711574c7a05f4fe924041a7a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -1759,16 +1759,24 @@
         return Allow();
       case __NR_sched_get_priority_min:
       case __NR_sched_get_priority_max:
         return Allow();
       case __NR_sched_getparam:
-      case __NR_sched_getscheduler:
-      case __NR_sched_setscheduler: {
+#if defined(LIBC_GLIBC)
+      case __NR_sched_setscheduler:
+#endif
+      case __NR_sched_getscheduler: {
         Arg<pid_t> pid(0);
         return If(pid == 0, Allow()).Else(Trap(SchedTrap, nullptr));
       }
 
+#if !defined(LIBC_GLIBC)
+      // For pthread_create(3) on musl; bug 1657849.
+      case __NR_sched_setscheduler:
+        return Allow();
+#endif
+
       // For clock(3) on older glibcs; bug 1304220.
       case __NR_times:
         return Allow();
 
       // Bug 1372428
@@ -1950,17 +1958,25 @@
       case __NR_sched_getaffinity:
       case __NR_sched_setaffinity:
       case __NR_sched_getparam:
       case __NR_sched_setparam:
       case __NR_sched_getscheduler:
+#if defined(LIBC_GLIBC)
       case __NR_sched_setscheduler:
+#endif
       case __NR_sched_getattr:
       case __NR_sched_setattr: {
         Arg<pid_t> pid(0);
         return If(pid == 0, Allow()).Else(Trap(SchedTrap, nullptr));
       }
 
+#if !defined(LIBC_GLIBC)
+      // For pthread_create(3) on musl; bug 1657849.
+      case __NR_sched_setscheduler:
+        return Allow();
+#endif
+
         // The priority bounds are also used, sometimes (bug 1838675):
       case __NR_sched_get_priority_min:
       case __NR_sched_get_priority_max:
         return Allow();