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.
This commit is contained in:
Duncaen 2019-02-21 14:53:29 +01:00
parent a3a23d6199
commit 31c3470dc0
2 changed files with 45 additions and 0 deletions

View file

@ -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();
}

View file

@ -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);