mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-20 02:23:47 +00:00
linux: roll lss and use sys_sigtimedwait/sys_sigprocmask
Bug: crashpad:265 Change-Id: I4b8f566e2a211cca96eef8a2c1098408a38bcf23 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1914840 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
2291bfa32e
commit
74490f00a4
2
DEPS
2
DEPS
@ -30,7 +30,7 @@ deps = {
|
|||||||
'8bee09f4a57807136593ddc906b0b213c21f9014',
|
'8bee09f4a57807136593ddc906b0b213c21f9014',
|
||||||
'crashpad/third_party/lss/lss':
|
'crashpad/third_party/lss/lss':
|
||||||
Var('chromium_git') + '/linux-syscall-support.git@' +
|
Var('chromium_git') + '/linux-syscall-support.git@' +
|
||||||
'8048ece6c16c91acfe0d36d1d3cc0890ab6e945c',
|
'726d71ec08d15493b94eff456bc31faecf0a5902',
|
||||||
'crashpad/third_party/mini_chromium/mini_chromium':
|
'crashpad/third_party/mini_chromium/mini_chromium':
|
||||||
Var('chromium_git') + '/chromium/mini_chromium@' +
|
Var('chromium_git') + '/chromium/mini_chromium@' +
|
||||||
'cdab1e6263ec7f3f61763efc1dac863f8dc07c80',
|
'cdab1e6263ec7f3f61763efc1dac863f8dc07c80',
|
||||||
|
@ -367,16 +367,7 @@ TEST_P(ExceptionHandlerServerTest, RequestCrashDumpError) {
|
|||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(ExceptionHandlerServerTestSuite,
|
INSTANTIATE_TEST_SUITE_P(ExceptionHandlerServerTestSuite,
|
||||||
ExceptionHandlerServerTest,
|
ExceptionHandlerServerTest,
|
||||||
#if defined(OS_ANDROID) && __ANDROID_API__ < 23
|
|
||||||
// TODO(jperaza): Using a multi-client socket is not
|
|
||||||
// supported on Android until an lss sigtimedwait()
|
|
||||||
// wrapper is available to use in
|
|
||||||
// ExceptionHandlerClient::SignalCrashDump().
|
|
||||||
// https://crbug.com/crashpad/265
|
|
||||||
testing::Values(false)
|
|
||||||
#else
|
|
||||||
testing::Bool()
|
testing::Bool()
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
#include "third_party/lss/lss.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/linux/ptrace_broker.h"
|
#include "util/linux/ptrace_broker.h"
|
||||||
#include "util/linux/socket.h"
|
#include "util/linux/socket.h"
|
||||||
@ -39,20 +40,21 @@ namespace {
|
|||||||
|
|
||||||
class ScopedSigprocmaskRestore {
|
class ScopedSigprocmaskRestore {
|
||||||
public:
|
public:
|
||||||
explicit ScopedSigprocmaskRestore(const sigset_t& set_to_block)
|
explicit ScopedSigprocmaskRestore(const kernel_sigset_t& set_to_block)
|
||||||
: orig_mask_(), mask_is_set_(false) {
|
: orig_mask_(), mask_is_set_(false) {
|
||||||
mask_is_set_ = sigprocmask(SIG_BLOCK, &set_to_block, &orig_mask_) == 0;
|
mask_is_set_ = sys_sigprocmask(SIG_BLOCK, &set_to_block, &orig_mask_) == 0;
|
||||||
DPLOG_IF(ERROR, !mask_is_set_) << "sigprocmask";
|
DPLOG_IF(ERROR, !mask_is_set_) << "sigprocmask";
|
||||||
}
|
}
|
||||||
|
|
||||||
~ScopedSigprocmaskRestore() {
|
~ScopedSigprocmaskRestore() {
|
||||||
if (mask_is_set_ && sigprocmask(SIG_SETMASK, &orig_mask_, nullptr) != 0) {
|
if (mask_is_set_ &&
|
||||||
|
sys_sigprocmask(SIG_SETMASK, &orig_mask_, nullptr) != 0) {
|
||||||
DPLOG(ERROR) << "sigprocmask";
|
DPLOG(ERROR) << "sigprocmask";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sigset_t orig_mask_;
|
kernel_sigset_t orig_mask_;
|
||||||
bool mask_is_set_;
|
bool mask_is_set_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ScopedSigprocmaskRestore);
|
DISALLOW_COPY_AND_ASSIGN(ScopedSigprocmaskRestore);
|
||||||
@ -119,11 +121,9 @@ void ExceptionHandlerClient::SetCanSetPtracer(bool can_set_ptracer) {
|
|||||||
int ExceptionHandlerClient::SignalCrashDump(
|
int ExceptionHandlerClient::SignalCrashDump(
|
||||||
const ExceptionHandlerProtocol::ClientInformation& info,
|
const ExceptionHandlerProtocol::ClientInformation& info,
|
||||||
VMAddress stack_pointer) {
|
VMAddress stack_pointer) {
|
||||||
// TODO(jperaza): Use lss for system calls when sys_sigtimedwait() exists.
|
kernel_sigset_t dump_done_sigset;
|
||||||
// https://crbug.com/crashpad/265
|
sys_sigemptyset(&dump_done_sigset);
|
||||||
sigset_t dump_done_sigset;
|
sys_sigaddset(&dump_done_sigset, ExceptionHandlerProtocol::kDumpDoneSignal);
|
||||||
sigemptyset(&dump_done_sigset);
|
|
||||||
sigaddset(&dump_done_sigset, ExceptionHandlerProtocol::kDumpDoneSignal);
|
|
||||||
ScopedSigprocmaskRestore scoped_block(dump_done_sigset);
|
ScopedSigprocmaskRestore scoped_block(dump_done_sigset);
|
||||||
|
|
||||||
int status = SendCrashDumpRequest(info, stack_pointer);
|
int status = SendCrashDumpRequest(info, stack_pointer);
|
||||||
@ -131,19 +131,14 @@ int ExceptionHandlerClient::SignalCrashDump(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_ANDROID) && __ANDROID_API__ < 23
|
|
||||||
// sigtimedwait() wrappers aren't available on Android until API 23 but this
|
|
||||||
// can use the lss wrapper when it's available.
|
|
||||||
NOTREACHED();
|
|
||||||
#else
|
|
||||||
siginfo_t siginfo = {};
|
siginfo_t siginfo = {};
|
||||||
timespec timeout;
|
timespec timeout;
|
||||||
timeout.tv_sec = 5;
|
timeout.tv_sec = 5;
|
||||||
timeout.tv_nsec = 0;
|
timeout.tv_nsec = 0;
|
||||||
if (HANDLE_EINTR(sigtimedwait(&dump_done_sigset, &siginfo, &timeout)) < 0) {
|
if (HANDLE_EINTR(sys_sigtimedwait(&dump_done_sigset, &siginfo, &timeout)) <
|
||||||
|
0) {
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user