mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-28 15:50:26 +08:00
linux: fix alt-stack tests with asan
Disable the stack-overrun test since ASAN will detect the stack corruption and kill the process. Also allocate extra alt-stack space when ASAN is enabled. Change-Id: Id8711d2aaa31c90c78b7feceec2877c18dc9be00 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2303591 Commit-Queue: Joshua Peraza <jperaza@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
9f66d569fb
commit
070b18d326
@ -37,6 +37,7 @@
|
||||
#include "util/linux/scoped_pr_set_dumpable.h"
|
||||
#include "util/linux/scoped_pr_set_ptracer.h"
|
||||
#include "util/linux/socket.h"
|
||||
#include "util/misc/address_sanitizer.h"
|
||||
#include "util/misc/from_pointer_cast.h"
|
||||
#include "util/posix/double_fork_and_exec.h"
|
||||
#include "util/posix/scoped_mmap.h"
|
||||
@ -433,7 +434,11 @@ bool CrashpadClient::InitializeSignalStackForThread() {
|
||||
DCHECK_EQ(stack.ss_flags & SS_ONSTACK, 0);
|
||||
|
||||
const size_t page_size = getpagesize();
|
||||
#if defined(ADDRESS_SANITIZER)
|
||||
const size_t kStackSize = 2 * ((SIGSTKSZ + page_size - 1) & ~(page_size - 1));
|
||||
#else
|
||||
const size_t kStackSize = (SIGSTKSZ + page_size - 1) & ~(page_size - 1);
|
||||
#endif // ADDRESS_SANITIZER
|
||||
if (stack.ss_flags & SS_DISABLE || stack.ss_size < kStackSize) {
|
||||
const size_t kGuardPageSize = page_size;
|
||||
const size_t kStackAllocSize = kStackSize + 2 * kGuardPageSize;
|
||||
@ -441,7 +446,12 @@ bool CrashpadClient::InitializeSignalStackForThread() {
|
||||
static void (*stack_destructor)(void*) = [](void* stack_mem) {
|
||||
const size_t page_size = getpagesize();
|
||||
const size_t kGuardPageSize = page_size;
|
||||
#if defined(ADDRESS_SANITIZER)
|
||||
const size_t kStackSize =
|
||||
2 * ((SIGSTKSZ + page_size - 1) & ~(page_size - 1));
|
||||
#else
|
||||
const size_t kStackSize = (SIGSTKSZ + page_size - 1) & ~(page_size - 1);
|
||||
#endif // ADDRESS_SANITIZER
|
||||
const size_t kStackAllocSize = kStackSize + 2 * kGuardPageSize;
|
||||
|
||||
stack_t stack;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "util/linux/exception_handler_client.h"
|
||||
#include "util/linux/exception_information.h"
|
||||
#include "util/linux/socket.h"
|
||||
#include "util/misc/address_sanitizer.h"
|
||||
#include "util/misc/address_types.h"
|
||||
#include "util/misc/from_pointer_cast.h"
|
||||
#include "util/posix/scoped_mmap.h"
|
||||
@ -425,6 +426,11 @@ TEST_P(StartHandlerForSelfTest, StartHandlerInChild) {
|
||||
// TODO(jperaza): test first chance handlers with real crashes.
|
||||
return;
|
||||
}
|
||||
#if defined(ADDRESS_SANITIZER)
|
||||
if (Options().crash_type == CrashType::kInfiniteRecursion) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
#endif // defined(ADDRESS_SANITIZER)
|
||||
StartHandlerForSelfInChildTest test(Options());
|
||||
test.Run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user