void-packages/srcpkgs/qt6-webengine/patches/0301-chromium-musl-sandbox....

87 lines
3.2 KiB
Diff

--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
@@ -134,6 +134,7 @@ namespace sandbox {
ResultExpr RestrictCloneToThreadsAndEPERMFork() {
const Arg<unsigned long> flags(0);
+#ifdef __GLIBC__
// TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2.
const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND | CLONE_THREAD |
@@ -160,6 +161,16 @@ ResultExpr RestrictCloneToThreadsAndEPER
return If(IsAndroid() ? android_test : glibc_test, Allow())
.ElseIf(is_fork_or_clone_vfork, Error(EPERM))
.Else(CrashSIGSYSClone());
+#else
+ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_THREAD | CLONE_SYSVSEM;
+ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
+ CLONE_DETACHED;
+ const BoolExpr thread_clone_ok = (flags&~safe)==required;
+ return If(thread_clone_ok, Allow())
+ .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM))
+ .Else(CrashSIGSYSClone());
+#endif
}
#ifndef PR_PAC_RESET_KEYS
--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
@@ -424,6 +424,9 @@ bool SyscallSets::IsAllowedProcessStartO
#if defined(__i386__)
case __NR_waitpid:
#endif
+#if !defined(__GLIBC__)
+ case __NR_set_tid_address:
+#endif
return true;
case __NR_clone: // Should be parameter-restricted.
case __NR_setns: // Privileged.
@@ -436,7 +439,9 @@ bool SyscallSets::IsAllowedProcessStartO
#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
case __NR_set_thread_area:
#endif
+#if defined(__GLIBC__)
case __NR_set_tid_address:
+#endif
case __NR_unshare:
#if !defined(__mips__) && !defined(__aarch64__)
case __NR_vfork:
@@ -550,6 +555,9 @@ bool SyscallSets::IsAllowedAddressSpaceA
case __NR_mlock:
case __NR_munlock:
case __NR_munmap:
+#ifndef __GLIBC__
+ case __NR_mremap:
+#endif
return true;
case __NR_madvise:
case __NR_mincore:
@@ -567,7 +575,9 @@ bool SyscallSets::IsAllowedAddressSpaceA
case __NR_modify_ldt:
#endif
case __NR_mprotect:
+#ifdef __GLIBC__
case __NR_mremap:
+#endif
case __NR_msync:
case __NR_munlockall:
case __NR_readahead:
--- qt6-webengine-6.4.2.orig/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+++ qt6-webengine-6.4.2/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc
@@ -99,9 +99,14 @@ ResultExpr RendererProcessPolicy::Evalua
case __NR_uname:
case __NR_sched_getparam:
case __NR_sched_getscheduler:
+#ifndef __GLIBC__
+ case __NR_sched_setscheduler:
+#endif
return Allow();
case __NR_sched_getaffinity:
+#ifdef __GLIBC__
case __NR_sched_setscheduler:
+#endif
return RestrictSchedTarget(GetPolicyPid(), sysno);
case __NR_prlimit64:
// See crbug.com/662450 and setrlimit comment above.