diff options
author | Rene Ladan <rene@FreeBSD.org> | 2020-07-23 16:31:18 +0000 |
---|---|---|
committer | Rene Ladan <rene@FreeBSD.org> | 2020-07-23 16:31:18 +0000 |
commit | 651302b592fe54c5197641402df87ff216c27903 (patch) | |
tree | 784a10fc6050d3be8786fd6f4f954d7802bd9204 /www/iridium/files/patch-base_profiler_stack__copier__signal.cc | |
parent | Add compiler:c++14-lang to USES to atttempt to fix on GCC-based systems: (diff) |
www/iridium: update to 2020.04.81
PR: 245959
Submitted by: Matthias Wolf
MFH: 2020Q3
Security: any Chromium vulnerability between 73 and 81
Diffstat (limited to 'www/iridium/files/patch-base_profiler_stack__copier__signal.cc')
-rw-r--r-- | www/iridium/files/patch-base_profiler_stack__copier__signal.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/www/iridium/files/patch-base_profiler_stack__copier__signal.cc b/www/iridium/files/patch-base_profiler_stack__copier__signal.cc new file mode 100644 index 000000000000..b9e757471f17 --- /dev/null +++ b/www/iridium/files/patch-base_profiler_stack__copier__signal.cc @@ -0,0 +1,63 @@ +--- base/profiler/stack_copier_signal.cc.orig 2020-04-10 00:33:01 UTC ++++ base/profiler/stack_copier_signal.cc +@@ -4,7 +4,14 @@ + + #include "base/profiler/stack_copier_signal.h" + ++#if defined(OS_LINUX) + #include <linux/futex.h> ++#include <syscall.h> ++#elif defined(OS_FREEBSD) ++#include <sys/types.h> ++#include <sys/thr.h> ++#include <sys/umtx.h> ++#endif + #include <signal.h> + #include <sys/ucontext.h> + #include <syscall.h> +@@ -35,8 +42,13 @@ class AsyncSafeWaitableEvent { + // for a pthread mutex. So, also check the condition. + while (true) { + int res = ++#if defined(OS_LINUX) + syscall(SYS_futex, futex_int_ptr(), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, + 0, nullptr, nullptr, 0); ++#elif defined(OS_FREEBSD) ++ _umtx_op(futex_int_ptr(), UMTX_OP_WAIT_UINT_PRIVATE, 0, nullptr, ++ nullptr); ++#endif + if (futex_.load(std::memory_order_acquire) != 0) + return true; + if (res != 0) +@@ -46,8 +58,12 @@ class AsyncSafeWaitableEvent { + + void Signal() { + futex_.store(1, std::memory_order_release); ++#if defined(OS_LINUX) + syscall(SYS_futex, futex_int_ptr(), FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1, + nullptr, nullptr, 0); ++#elif defined(OS_FREEBSD) ++ _umtx_op(futex_int_ptr(), UMTX_OP_WAKE_PRIVATE, 1, nullptr, nullptr); ++#endif + } + + private: +@@ -214,11 +230,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b + if (!scoped_sigaction.succeeded()) + return false; + ++#if defined(OS_LINUX) + if (syscall(SYS_tgkill, getpid(), thread_delegate_->GetThreadId(), + SIGURG) != 0) { + NOTREACHED(); + return false; + } ++#elif defined(OS_FREEBSD) ++ if (thr_kill2(getpid(), thread_delegate_->GetThreadId(), SIGURG) != 0) { ++ NOTREACHED(); ++ return false; ++ } ++#endif + bool finished_waiting = wait_event.Wait(); + TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cpu_profiler.debug"), + "StackCopierSignal copy stack"); |