Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta: update 2023-11-24 #91

Merged
merged 31 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ac0c27a
Deregister vectored exception handler on client destruction
quidity Sep 28, 2023
7f6d9e9
Add support for matching with key allowlist
Sep 29, 2023
485cfaf
Update chromium_mini dependency
Sep 29, 2023
b90db3e
ios: Fix Chromium bundle id for xcuitest.
Oct 4, 2023
a1b467a
Pull latest toolchain
thomasgales Oct 6, 2023
0fc1b6a
Mac: update ProcessReaderMac and tests for macOS 14
speednoisemovement Oct 6, 2023
f145b54
Stop registering Windows VEH in ASAN builds.
richmckeever Oct 12, 2023
2f6cffa
Mac: don't consider module order in process reader tests
speednoisemovement Oct 13, 2023
63ec948
Windows: don't compile HandleHeapCorruption on ASAN
speednoisemovement Oct 13, 2023
7c89d50
[ios] Remove ios_use_shared_bundle_id_for_test_apps gn variable
sdefresne Oct 16, 2023
aef7504
Use format macros for int64_t instead of hardcoding the format.
pkasting Oct 16, 2023
ce4e3d6
Roll crashpad/third_party/mini_chromium/mini_chromium/ 276f2ac53..42f…
pkasting Oct 17, 2023
c63c073
Do IWYU for check_op.h
leizleiz Oct 18, 2023
b6d3cdc
Roll crashpad/third_party/mini_chromium/mini_chromium/ 42f1fddfe..bc8…
pkasting Oct 18, 2023
376e8c0
Eliminate call to StringPrintf() with non-constexpr format string.
pkasting Oct 18, 2023
e17518a
Add an option to start a Windows client with global hooks disabled.
richmckeever Oct 26, 2023
59fc31c
Update mini_chromium & use its new support for wide streaming in file…
ericastor Oct 26, 2023
188ad79
Roll crashpad/third_party/mini_chromium/mini_chromium/ 707c87bd2..98b…
Oct 27, 2023
4a93d7f
Revert "Add an option to start a Windows client with global hooks dis…
Oct 27, 2023
41f6ad5
Fix crashpad tests under UBSan
davidben Oct 28, 2023
c5e2b03
Fix UB when saving an StringAnnotation
davidben Oct 28, 2023
c39206f
Provide a way to iterate over a const AnnotationList
andre-kempe-arm Oct 27, 2023
3ba2403
ios: Fix leak in iOS NSException preprocessor.
Oct 30, 2023
1675ce7
Add missing base/check.h includes
leizleiz Nov 6, 2023
5739185
Roll crashpad/third_party/mini_chromium/mini_chromium/ e508a6010..450…
pkasting Nov 7, 2023
5613499
Replace base::WStringPiece with std::string_view
leizleiz Nov 7, 2023
202f5cb
Merge branch 'main' of https://chromium.googlesource.com/crashpad/cra…
supervacuus Nov 23, 2023
de6d596
Update zlib + mini_chromium in line with DEPS
supervacuus Nov 23, 2023
c6f8325
Update mini_chromium CMake to reflect upstream
supervacuus Nov 23, 2023
277df3f
Remove obsolete zlib sources
supervacuus Nov 27, 2023
fec839d
include new check header in client-side stacktrace writer
supervacuus Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ deps = {
'9719c1e1e676814c456b55f5f070eabad6709d31',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'10f39a97650a0fe0b305415c15434443c0690a20',
'9e21183c1ea369398d6f6ddd302c8db580bd19c4',
'crashpad/third_party/libfuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
'fda403cf93ecb8792cb1d061564d89a6553ca020',
'crashpad/third_party/zlib/zlib':
Var('chromium_git') + '/chromium/src/third_party/zlib@' +
'13dc246a58e4b72104d35f9b1809af95221ebda7',
'fef58692c1d7bec94c4ed3d030a45a1832a9615d',

# CIPD packages.
'buildtools/linux64': {
Expand Down Expand Up @@ -89,8 +89,8 @@ deps = {
'crashpad/third_party/linux/clang/linux-amd64': {
'packages': [
{
'package': 'fuchsia/clang/linux-amd64',
'version': 'goma',
'package': 'fuchsia/third_party/clang/linux-amd64',
'version': 'Tpc85d1ZwSlZ6UKl2d96GRUBGNA5JKholOKe24sRDr0C',
},
],
'condition': 'checkout_linux and pull_linux_clang',
Expand All @@ -99,8 +99,8 @@ deps = {
'crashpad/third_party/fuchsia/clang/mac-amd64': {
'packages': [
{
'package': 'fuchsia/clang/mac-amd64',
'version': 'goma',
'package': 'fuchsia/third_party/clang/mac-amd64',
'version': 'MAOjNhwTu5JU3P_0C9dITiyCTtQ1n7lRJnMfB9hhvOkC',
},
],
'condition': 'checkout_fuchsia and host_os == "mac"',
Expand All @@ -109,8 +109,8 @@ deps = {
'crashpad/third_party/fuchsia/clang/linux-amd64': {
'packages': [
{
'package': 'fuchsia/clang/linux-amd64',
'version': 'goma',
'package': 'fuchsia/third_party/clang/linux-amd64',
'version': 'Tpc85d1ZwSlZ6UKl2d96GRUBGNA5JKholOKe24sRDr0C',
},
],
'condition': 'checkout_fuchsia and host_os == "linux"',
Expand Down
2 changes: 1 addition & 1 deletion build/ios/Unittest-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>${IOS_BUNDLE_ID_PREFIX}.googletest.${GTEST_BUNDLE_ID_SUFFIX:rfc1034identifier}</string>
<string>${IOS_BUNDLE_ID_PREFIX}.${GTEST_BUNDLE_ID_SUFFIX:rfc1034identifier}</string>
<key>UIApplicationDelegate</key>
<string>CrashpadUnitTestDelegate</string>
</dict>
Expand Down
14 changes: 12 additions & 2 deletions client/annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ class Annotation {

std::atomic<Annotation*>& link_node() { return link_node_; }

Annotation* GetLinkNode(std::memory_order order = std::memory_order_seq_cst) {
return link_node_.load(order);
}
const Annotation* GetLinkNode(
std::memory_order order = std::memory_order_seq_cst) const {
return link_node_.load(order);
}

private:
//! \brief Linked list next-node pointer. Accessed only by \sa AnnotationList.
//!
Expand Down Expand Up @@ -323,9 +331,11 @@ class StringAnnotation : public Annotation {
void Set(base::StringPiece string) {
Annotation::ValueSizeType size =
std::min(MaxSize, base::saturated_cast<ValueSizeType>(string.size()));
memcpy(value_, string.data(), size);
string = string.substr(0, size);
std::copy(string.begin(), string.end(), value_);
// Check for no embedded `NUL` characters.
DCHECK(!memchr(value_, '\0', size)) << "embedded NUL";
DCHECK(string.find('\0', /*pos=*/0) == base::StringPiece::npos)
<< "embedded NUL";
SetSize(size);
}

Expand Down
34 changes: 32 additions & 2 deletions client/annotation_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Annotation* AnnotationList::Iterator::operator*() const {

AnnotationList::Iterator& AnnotationList::Iterator::operator++() {
CHECK_NE(curr_, tail_);
curr_ = curr_->link_node();
curr_ = curr_->GetLinkNode();
return *this;
}

Expand All @@ -86,12 +86,42 @@ bool AnnotationList::Iterator::operator==(
return curr_ == other.curr_;
}

AnnotationList::ConstIterator::ConstIterator(const Annotation* head,
const Annotation* tail)
: curr_(head), tail_(tail) {}

AnnotationList::ConstIterator::~ConstIterator() = default;

const Annotation* AnnotationList::ConstIterator::operator*() const {
CHECK_NE(curr_, tail_);
return curr_;
}

AnnotationList::ConstIterator& AnnotationList::ConstIterator::operator++() {
CHECK_NE(curr_, tail_);
curr_ = curr_->GetLinkNode();
return *this;
}

bool AnnotationList::ConstIterator::operator==(
const AnnotationList::ConstIterator& other) const {
return curr_ == other.curr_;
}

AnnotationList::Iterator AnnotationList::begin() {
return Iterator(head_.link_node(), tail_pointer_);
return Iterator(head_.GetLinkNode(), tail_pointer_);
}

AnnotationList::ConstIterator AnnotationList::cbegin() const {
return ConstIterator(head_.GetLinkNode(), tail_pointer_);
}

AnnotationList::Iterator AnnotationList::end() {
return Iterator(&tail_, tail_pointer_);
}

AnnotationList::ConstIterator AnnotationList::cend() const {
return ConstIterator(&tail_, tail_pointer_);
}

} // namespace crashpad
26 changes: 26 additions & 0 deletions client/annotation_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,37 @@ class AnnotationList {
// Copy and assign are required.
};

//! \brief An InputIterator for iterating a const AnnotationList.
class ConstIterator {
public:
~ConstIterator();

const Annotation* operator*() const;
ConstIterator& operator++();
bool operator==(const ConstIterator& other) const;
bool operator!=(const ConstIterator& other) const {
return !(*this == other);
}

private:
friend class AnnotationList;
ConstIterator(const Annotation* head, const Annotation* tail);

const Annotation* curr_;
const Annotation* const tail_;

// Copy and assign are required.
};

//! \brief Returns an iterator to the first element of the annotation list.
Iterator begin();
ConstIterator begin() const { return cbegin(); }
ConstIterator cbegin() const;

//! \brief Returns an iterator past the last element of the annotation list.
Iterator end();
ConstIterator end() const { return cend(); }
ConstIterator cend() const;

protected:
#if BUILDFLAG(IS_IOS)
Expand Down
94 changes: 94 additions & 0 deletions client/annotation_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,100 @@ TEST_F(AnnotationList, DuplicateKeys) {
EXPECT_EQ(1u, annotations.size());
}

TEST_F(AnnotationList, IteratorSingleAnnotation) {
ASSERT_EQ(annotations_.begin(), annotations_.end());
ASSERT_EQ(annotations_.cbegin(), annotations_.cend());

one_.Set("1");

auto iterator = annotations_.begin();
auto const_iterator = annotations_.cbegin();

ASSERT_NE(iterator, annotations_.end());
ASSERT_NE(const_iterator, annotations_.cend());

EXPECT_EQ(*iterator, &one_);
EXPECT_EQ(*const_iterator, &one_);

++iterator;
++const_iterator;

EXPECT_EQ(iterator, annotations_.end());
EXPECT_EQ(const_iterator, annotations_.cend());
}

TEST_F(AnnotationList, IteratorMultipleAnnotationsInserted) {
ASSERT_EQ(annotations_.begin(), annotations_.end());
ASSERT_EQ(annotations_.cbegin(), annotations_.cend());

one_.Set("1");
two_.Set("2");

// New annotations are inserted to the beginning of the list. Hence, |two_|
// must be the first annotation, followed by |one_|.
{
auto iterator = annotations_.begin();
auto const_iterator = annotations_.cbegin();

ASSERT_NE(iterator, annotations_.end());
ASSERT_NE(const_iterator, annotations_.cend());

EXPECT_EQ(*iterator, &two_);
EXPECT_EQ(*const_iterator, &two_);

++iterator;
++const_iterator;

ASSERT_NE(iterator, annotations_.end());
ASSERT_NE(const_iterator, annotations_.cend());

EXPECT_EQ(*iterator, &one_);
EXPECT_EQ(*const_iterator, &one_);

++iterator;
++const_iterator;

EXPECT_EQ(iterator, annotations_.end());
EXPECT_EQ(const_iterator, annotations_.cend());
}
}

TEST_F(AnnotationList, IteratorMultipleAnnotationsInsertedAndRemoved) {
ASSERT_EQ(annotations_.begin(), annotations_.end());
ASSERT_EQ(annotations_.cbegin(), annotations_.cend());

one_.Set("1");
two_.Set("2");
one_.Clear();
two_.Clear();

// Even after clearing, Annotations are still inserted in the list and
// reachable via the iterators.
auto iterator = annotations_.begin();
auto const_iterator = annotations_.cbegin();

ASSERT_NE(iterator, annotations_.end());
ASSERT_NE(const_iterator, annotations_.cend());

EXPECT_EQ(*iterator, &two_);
EXPECT_EQ(*const_iterator, &two_);

++iterator;
++const_iterator;

ASSERT_NE(iterator, annotations_.end());
ASSERT_NE(const_iterator, annotations_.cend());

EXPECT_EQ(*iterator, &one_);
EXPECT_EQ(*const_iterator, &one_);

++iterator;
++const_iterator;

EXPECT_EQ(iterator, annotations_.end());
EXPECT_EQ(const_iterator, annotations_.cend());
}

class RaceThread : public Thread {
public:
explicit RaceThread(test::AnnotationList* test) : Thread(), test_(test) {}
Expand Down
1 change: 1 addition & 0 deletions client/crash_report_database_generic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <tuple>
#include <utility>

#include "base/check_op.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "client/settings.h"
Expand Down
8 changes: 4 additions & 4 deletions client/crash_report_database_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/scoped_generic.h"
#include "base/strings/strcat.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "client/settings.h"
#include "util/file/directory_reader.h"
Expand Down Expand Up @@ -116,9 +116,9 @@ bool CreateOrEnsureDirectoryExists(const base::FilePath& path) {
// have changed, and new_name determines whether the returned xattr name will be
// the old name or its new equivalent.
std::string XattrNameInternal(const base::StringPiece& name, bool new_name) {
return base::StringPrintf(new_name ? "org.chromium.crashpad.database.%s"
: "com.googlecode.crashpad.%s",
name.data());
return base::StrCat({new_name ? "org.chromium.crashpad.database."
: "com.googlecode.crashpad.",
name});
}

} // namespace
Expand Down
14 changes: 6 additions & 8 deletions client/crash_report_database_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <tuple>
#include <utility>

#include "base/check_op.h"
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "base/strings/utf_string_conversions.h"
Expand Down Expand Up @@ -545,8 +546,7 @@ void Metadata::Write() {
for (const auto& report : reports_) {
const base::FilePath& path = report.file_path;
if (path.DirName() != report_dir_) {
LOG(ERROR) << path.value().c_str() << " expected to start with "
<< base::WideToUTF8(report_dir_.value());
LOG(ERROR) << path << " expected to start with " << report_dir_;
return;
}
records.push_back(MetadataFileReportRecord(report, &string_table));
Expand Down Expand Up @@ -590,12 +590,11 @@ OperationStatus Metadata::VerifyReport(const ReportDisk& report_disk,
bool EnsureDirectory(const base::FilePath& path) {
DWORD fileattr = GetFileAttributes(path.value().c_str());
if (fileattr == INVALID_FILE_ATTRIBUTES) {
PLOG(ERROR) << "GetFileAttributes " << base::WideToUTF8(path.value());
PLOG(ERROR) << "GetFileAttributes " << path;
return false;
}
if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
LOG(ERROR) << "GetFileAttributes " << base::WideToUTF8(path.value())
<< ": not a directory";
LOG(ERROR) << "GetFileAttributes " << path << ": not a directory";
return false;
}
return true;
Expand Down Expand Up @@ -877,7 +876,7 @@ OperationStatus CrashReportDatabaseWin::DeleteReport(const UUID& uuid) {
return os;

if (!DeleteFile(report_path.value().c_str())) {
PLOG(ERROR) << "DeleteFile " << base::WideToUTF8(report_path.value());
PLOG(ERROR) << "DeleteFile " << report_path;
return kFileSystemError;
}

Expand Down Expand Up @@ -1021,8 +1020,7 @@ void CrashReportDatabaseWin::CleanOrphanedAttachments() {
if (IsDirectory(path, false)) {
UUID uuid;
if (!uuid.InitializeFromString(filename.value())) {
LOG(ERROR) << "unexpected attachment dir name "
<< filename.value().c_str();
LOG(ERROR) << "unexpected attachment dir name " << filename;
continue;
}

Expand Down
6 changes: 6 additions & 0 deletions client/crashpad_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,17 @@ class CrashpadClient {
#endif

private:
#if BUILDFLAG(IS_WIN)
//! \brief Registers process handlers for the client.
void RegisterHandlers();
#endif

#if BUILDFLAG(IS_APPLE)
base::apple::ScopedMachSendRight exception_port_;
#elif BUILDFLAG(IS_WIN)
std::wstring ipc_pipe_;
ScopedKernelHANDLE handler_start_thread_;
ScopedVectoredExceptionRegistration vectored_handler_;
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
std::set<int> unhandled_signals_;
#endif // BUILDFLAG(IS_APPLE)
Expand Down
1 change: 1 addition & 0 deletions client/crashpad_client_fuchsia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <lib/zx/process.h>
#include <zircon/processargs.h>

#include "base/check_op.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/logging.h"
#include "client/client_argv_handling.h"
Expand Down
1 change: 1 addition & 0 deletions client/crashpad_client_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <atomic>

#include "base/check_op.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
Expand Down
Loading
Loading