diff options
author | cullinan <cullinan@amazon.com> | 2015-08-18 14:04:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 21:05:27 +0000 |
commit | 3d4f5582811575182af4cf7ccc20889c36cfd68e (patch) | |
tree | 4c81753cc05bd3762d0aa3b1ba1e2c12269c6b14 | |
parent | 24fb96b8b08ba3d59383a372f45773f81aa3c5fa (diff) | |
download | chromium_src-3d4f5582811575182af4cf7ccc20889c36cfd68e.zip chromium_src-3d4f5582811575182af4cf7ccc20889c36cfd68e.tar.gz chromium_src-3d4f5582811575182af4cf7ccc20889c36cfd68e.tar.bz2 |
Reland: Fix ProcessUtilTest.GetTerminationStatusCrash on Android L+
Originally landed in http://crrev.com/1241333002
Reverted in http://crrev.com/1247023002 for breaking the MIPS Android builder,
which was fixed in LSS, which was rolled in http://crrev.com/1286073002
Original commit message:
> Fix ProcessUtilTest.GetTerminationStatusCrash on Android L+
>
> On Android L+, signal and sigaction symbols are provided by libsigchain
> that override the system's versions. There is a bug in these functions
> where they essentially ignore requests to install SIG_DFL. This causes
> ProcessUtilTest.GetTerminationStatusCrash to fail (as
> CrashingChildProcess goes into infinite loop instead of crashing).
>
> Workaround this issue by explicitly performing a syscall to
> __NR_rt_sigaction to install SIG_DFL on Android, as breakpad does
> (see https://breakpad.appspot.com/1804002/).
>
> BUG=512255
> TEST=ProcessUtilTest.GetTerminationStatusCrash
>
> Committed: https://crrev.com/31510fe3e2d3b1f3123f391db52372b2506c46ca
> Cr-Commit-Position: refs/heads/master@{#339584}
BUG=512255
TEST=ProcessUtilTest.GetTerminationStatusCrash
Review URL: https://codereview.chromium.org/1285083002
Cr-Commit-Position: refs/heads/master@{#344026}
-rw-r--r-- | base/DEPS | 1 | ||||
-rw-r--r-- | base/process/process_util_unittest.cc | 17 |
2 files changed, 17 insertions, 1 deletions
@@ -4,6 +4,7 @@ include_rules = [ "+third_party/apple_apsl", "+third_party/libevent", "+third_party/dmg_fp", + "+third_party/lss", "+third_party/mach_override", "+third_party/modp_b64", "+third_party/tcmalloc", diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc index cf83aa7..08144f2 100644 --- a/base/process/process_util_unittest.cc +++ b/base/process/process_util_unittest.cc @@ -59,6 +59,9 @@ #include <malloc/malloc.h> #include "base/mac/mac_util.h" #endif +#if defined(OS_ANDROID) +#include "third_party/lss/linux_syscall_support.h" +#endif using base::FilePath; @@ -226,7 +229,19 @@ const char kSignalFileCrash[] = "CrashingChildProcess.die"; MULTIPROCESS_TEST_MAIN(CrashingChildProcess) { WaitToDie(ProcessUtilTest::GetSignalFilePath(kSignalFileCrash).c_str()); -#if defined(OS_POSIX) +#if defined(OS_ANDROID) + // Android L+ expose signal and sigaction symbols that override the system + // ones. There is a bug in these functions where a request to set the handler + // to SIG_DFL is ignored. In that case, an infinite loop is entered as the + // signal is repeatedly sent to the crash dump signal handler. + // To work around this, directly call the system's sigaction. + struct kernel_sigaction sa; + memset(&sa, 0, sizeof(sa)); + sys_sigemptyset(&sa.sa_mask); + sa.sa_handler_ = SIG_DFL; + sa.sa_flags = SA_RESTART; + sys_rt_sigaction(SIGSEGV, &sa, NULL, sizeof(kernel_sigset_t)); +#elif defined(OS_POSIX) // Have to disable to signal handler for segv so we can get a crash // instead of an abnormal termination through the crash dump handler. ::signal(SIGSEGV, SIG_DFL); |