From 31c3470dc02cf86c66217cfa072464bd103b0eca Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 21 Feb 2019 14:53:29 +0100 Subject: [PATCH] chromium: import patches from alpine The deadlock patch is most likely not limited to musl but its a race condition and it seems like with the current way how it works its only triggered with musl and with namespaces enabled. The other patch just makes pthreads in v8 use CLOCK_MONOTONIC like it does for glibc. --- .../patches/musl-v8-fix-deadlock.patch | 21 ++++++++++++++++ ...-v8-monotonic-pthread-cont_timedwait.patch | 24 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 srcpkgs/chromium/patches/musl-v8-fix-deadlock.patch create mode 100644 srcpkgs/chromium/patches/musl-v8-monotonic-pthread-cont_timedwait.patch diff --git a/srcpkgs/chromium/patches/musl-v8-fix-deadlock.patch b/srcpkgs/chromium/patches/musl-v8-fix-deadlock.patch new file mode 100644 index 0000000000..dff0d88d2c --- /dev/null +++ b/srcpkgs/chromium/patches/musl-v8-fix-deadlock.patch @@ -0,0 +1,21 @@ +Release the mutex before mess with the stack guard + +Upstream report: https://bugs.chromium.org/p/v8/issues/detail?id=8881 + +diff --git a/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc b/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc +index 09226e1..29a1871 100644 +--- ./v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc ++++ ./v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc +@@ -132,8 +132,10 @@ void OptimizingCompileDispatcher::CompileNext(OptimizedCompilationJob* job) { + // The function may have already been optimized by OSR. Simply continue. + // Use a mutex to make sure that functions marked for install + // are always also queued. +- base::MutexGuard access_output_queue_(&output_queue_mutex_); +- output_queue_.push(job); ++ { ++ base::MutexGuard access_output_queue_(&output_queue_mutex_); ++ output_queue_.push(job); ++ } + isolate_->stack_guard()->RequestInstallCode(); + } + diff --git a/srcpkgs/chromium/patches/musl-v8-monotonic-pthread-cont_timedwait.patch b/srcpkgs/chromium/patches/musl-v8-monotonic-pthread-cont_timedwait.patch new file mode 100644 index 0000000000..33a8ea32c9 --- /dev/null +++ b/srcpkgs/chromium/patches/musl-v8-monotonic-pthread-cont_timedwait.patch @@ -0,0 +1,24 @@ +Use monotonic clock for pthread_cond_timedwait with musl too. + +diff --git a/v8/src/base/platform/condition-variable.cc b/v8/src/base/platform/condition-variable.cc +index 5ea7083..c13027e 100644 +--- ./v8/src/base/platform/condition-variable.cc ++++ ./v8/src/base/platform/condition-variable.cc +@@ -16,7 +16,7 @@ namespace base { + + ConditionVariable::ConditionVariable() { + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + pthread_condattr_t attr; +@@ -92,7 +92,7 @@ bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) { + &native_handle_, &mutex->native_handle(), &ts); + #else + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + result = clock_gettime(CLOCK_MONOTONIC, &ts);