Commit 44c7be1e authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by Commit Bot

Reland "GWP-ASan: Add Linux crash handler support"

This is a reland of 70034734, the original
change was reverted because crashpad code is not MSan-safe (crbug.com/932205).
Instead, land the Linux-specific code but don't enable it yet until crashpad
is made MSan safe.

Original change's description:
> GWP-ASan: Add Linux crash handler support
>
> Linux crashpad support is now sufficiently enabled to allow running the
> GWP-ASan crash handler unit tests under Linux. (The client tests are
> still blocked on allocator shim updates.)
>
> Change-Id: I409cebaa9cdaed5da546266d0af470d2b25a09ab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610605
> Auto-Submit: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
> Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
> Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#659296}

TBR=vitalybuka@chromium.org

Change-Id: Ic8d8b48728382f747b7635e4df0eec3ca8e34680
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625916
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: default avatarVitaly Buka <vitalybuka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662395}
parent d96c7302
......@@ -8,6 +8,7 @@ static_library("crash_handler") {
sources = [
"crash_analyzer.cc",
"crash_analyzer.h",
"crash_analyzer_linux.cc",
"crash_analyzer_mac.cc",
"crash_analyzer_win.cc",
"crash_handler.cc",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/gwp_asan/crash_handler/crash_analyzer.h"
#include <signal.h>
#include "third_party/crashpad/crashpad/snapshot/exception_snapshot.h"
namespace gwp_asan {
namespace internal {
crashpad::VMAddress CrashAnalyzer::GetAccessAddress(
const crashpad::ExceptionSnapshot& exception) {
if (exception.Exception() != SIGSEGV && exception.Exception() != SIGBUS)
return 0;
return exception.ExceptionAddress();
}
} // namespace internal
} // namespace gwp_asan
......@@ -271,13 +271,15 @@ class CrashHandlerTest : public base::MultiProcessTest,
EXPECT_TRUE(proto_.has_allocation());
EXPECT_TRUE(proto_.allocation().has_thread_id());
EXPECT_NE(proto_.allocation().thread_id(), base::kInvalidThreadId);
EXPECT_NE(proto_.allocation().thread_id(),
static_cast<uint64_t>(base::kInvalidThreadId));
EXPECT_GT(proto_.allocation().stack_trace_size(), 0);
EXPECT_EQ(proto_.has_deallocation(), has_deallocation);
if (has_deallocation) {
EXPECT_TRUE(proto_.deallocation().has_thread_id());
EXPECT_NE(proto_.deallocation().thread_id(), base::kInvalidThreadId);
EXPECT_NE(proto_.deallocation().thread_id(),
static_cast<uint64_t>(base::kInvalidThreadId));
EXPECT_EQ(proto_.allocation().thread_id(),
proto_.deallocation().thread_id());
EXPECT_GT(proto_.deallocation().stack_trace_size(), 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment