linux: fix split stack test

Previously, page_addr sometimes ended up being in the current stack
frame, causing a segfault when write protecting it. Reach another
page up the stack and add an extra stack page for wiggle room.

The test consistently fails on linux-chromeos bots:
https://ci.chromium.org/p/chromium/builders/try/linux-chromeos-rel/373920

Change-Id: I5e2aa8c54555ef559251a14b0310a24131c9f17a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1857500
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Joshua Peraza 2019-10-11 15:13:37 -07:00 committed by Commit Bot
parent c009b85449
commit d8f85829b0

View File

@ -427,7 +427,7 @@ class ChildWithSplitStackTest : public Multiprocess {
}
void MultiprocessChild() override {
const LinuxVMSize stack_size = page_size_ * 3;
const LinuxVMSize stack_size = page_size_ * 4;
GrowStack(stack_size, reinterpret_cast<LinuxVMAddress>(&stack_size));
}
@ -440,7 +440,7 @@ class ChildWithSplitStackTest : public Multiprocess {
} else {
// Write-protect a page on our stack to split up the mapping
LinuxVMAddress page_addr =
stack_address - (stack_address % page_size_) + page_size_;
stack_address - (stack_address % page_size_) + 2 * page_size_;
ASSERT_EQ(
mprotect(reinterpret_cast<void*>(page_addr), page_size_, PROT_READ),
0)