summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-11-05 22:32:29 (GMT)
committerXiaoyi Zhang <zhangxy@google.com>2019-11-08 20:47:12 (GMT)
commit681454dae48f109abf68c424c9d2e6db9a092238 (patch)
tree4aef93ab8e0544cae7893a710afd2aa052ddb519 /googletest
parente08a4602778b3cbea36dbd53724db0f18840e274 (diff)
downloadgoogletest-681454dae48f109abf68c424c9d2e6db9a092238.zip
googletest-681454dae48f109abf68c424c9d2e6db9a092238.tar.gz
googletest-681454dae48f109abf68c424c9d2e6db9a092238.tar.bz2
Googletest export
Clone+exec death test allocates a single page of stack to run chdir + exec on. This is not enough when gtest is built with ASan and run on particular hardware. With ASan on x86_64, ExecDeathTestChildMain has frame size of 1728 bytes. Call to chdir() in ExecDeathTestChildMain ends up in _dl_runtime_resolve_xsavec, which attempts to save register state on the stack; according to cpuid(0xd) XSAVE register save area size is 2568 on my machine. This results in something like this in all death tests: Result: died but not with expected error. ... [ DEATH ] AddressSanitizer:DEADLYSIGNAL [ DEATH ] ================================================================= [ DEATH ] ==178637==ERROR: AddressSanitizer: stack-overflow on address ... PiperOrigin-RevId: 278709790
Diffstat (limited to 'googletest')
-rw-r--r--googletest/src/gtest-death-test.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index da09a1c..5d1031b 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -1364,7 +1364,7 @@ static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
if (!use_fork) {
static const bool stack_grows_down = StackGrowsDown();
- const auto stack_size = static_cast<size_t>(getpagesize());
+ const auto stack_size = static_cast<size_t>(getpagesize() * 2);
// MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);