Emit STACK CFI records even in the presence of clang's "-gz" linker
option. Needed for ChromeOS ARM boards' chrome binary.
BUG=b:263148951,google-breakpad:874
Fixed: google-breakpad:874
Change-Id: I2fe697a56d3421609128d4e291ab1adc73314864
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4117692
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This was previously setting the right upload servers too late to
use them when uploading previously dumped symbols (the
`--upload-from` use case)
Bug: 1400770
Change-Id: If5bb749707b9f0a181585619f30ec9cb011db5ed
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4111102
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Adds a new option, `-api-key`. If passed, `symupload` is invoked with
the `sym-upload-v2` protocol, the key is passed through, and the V2 API
upload servers are used.
Bug: 1400770
Change-Id: I81255dccc54038a57900058a050603b89e37d716
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4103749
Reviewed-by: Robert Sesek <rsesek@chromium.org>
- Fix a test build failure introduced by cc7abac08b.
- Use strcmp from <string> instead of std::strcmp from <cstring>.
Bug: google-breakpad:867
Change-Id: I8dcbc7d5ac8ea799b4d5287ddbbf5d6626992123
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4095054
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Chromium moved to GN a long time ago, and CrOS has never used this.
Let's remove one of the build systems to make it easier on people.
Especially since the GYP tool is completely unmaintained now.
Change-Id: I0371ca1427811f307dc30f88ed6d1bf61d7fab89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4054941
Reviewed-by: Mark Mentovai <mark@chromium.org>
As the conditionals and targets was becoming quite hard to
grasp with lots of conditionals applied unnecessarily to target
properties, there were issues with targets being defined without
any sources.
This commit fixes that while restructuring the Makefile so that
all targets are declared (conditionally if needed) upfront and
then all the target properties are defined (source, flags, deps, etc.)
Change-Id: I666d153c476fbf1aafabb89cee7af4eee5795ab6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3928024
Reviewed-by: Mike Frysinger <vapier@chromium.org>
- We were appending a CRLF to uploaded files, which is okay for Breakpad
symbols but breaks binaries (PE/PDB).
- Removed the CRLF after files in the request body to fix issue. Tested with
Breakpad, PE, and PDB uploads.
Change-Id: I95ee7c51bf981cdb2e55cc720a7813cf7afa21ce
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4038506
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Zequan Wu <zequanwu@google.com>
The way this was originally written blows up on large enough targets
(like...Chromium :/). This change adds a set for amortized constant
time lookup of whether a FUNC already exists at a given address.
Bug: google-breakpad:751
Change-Id: I10a322da70f769c106e1e5f5b2dc3dc3f79444fd
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4031580
Reviewed-by: Mark Mentovai <mark@chromium.org>
This is similar to the Windows change at
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/773418/
When a `Module` is created with `enable_multiple_field_` = true,
all FUNCs and PUBLICs that share the same address will be collapsed
into a single entry, and that entry will be marked with `m` for
multiple in the final output.
`enable_multiple_field_` is temporary just in case people are
depending on the current behavior.
Support for `dump_syms` executables will be added in a follow-up.
Bug: google-breakpad:751
Change-Id: I631a148ed00138924c7bcb5ad6db8b9a6610dd03
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3905122
Reviewed-by: Mark Mentovai <mark@chromium.org>
Using `sizeof(raw_context)` generates the following warning (which is
an error in ChromeOS):
```
'memset' call operates on objects of type 'MDRawContextX86' while the size
is based on a different type 'MDRawContextX86 *'
```
This commit follows the implied advice of this warning and adjusts the
expression.
Bug: b:238678030, b:243982778
Test: Locally
Change-Id: I26111c6ff7a1223223e6096a75ad52c48d941e89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3960915
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Breakpad has started to use C++17 features, and needs to be compiled
using C++17.
Bug: b:238678030, b:243982778
Test: Locally, CQ
Change-Id: Ia339f0815d2efd2a49fa9b788044b5b0163f95fa
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3954471
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
The demangled name has recently joined two angle brackets, where there
was previously a space. This commit makes it possible for both options
to pass, since they're both valid source.
Bug: b:238678030
Test: Tested locally
Fixed: b:243982778
Change-Id: Ic4464709fb8cc5c730a9d14a8627294b24ae70c3
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3949474
Reviewed-by: Lei Zhang <thestig@chromium.org>
This uses DisassemblerObjdump to add a processing step in
MinidumpProcessor to compute the true faulting address from register
state and disassembly of the fault instruction when the fault address
is suspicious (-1).
Bug: 901847
Change-Id: Ia1f77d542c4055c82ce2504db8c84a9e52001866
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3932957
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This extracts the existing objdump-based disassembler engine used in
ExploitabilityLinux into a seperate reusable class, and adds support
for most common address operand formats.
This is a precursor to using DisassemblerObjdump to handle address
resolution for non-canonical address dereferences on amd64.
Bug: 901847
Change-Id: I1a06a86fc2e7c76b4d0e79eca5f8a6c501379f47
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3720740
Reviewed-by: Ivan Penkov <ivanpe@google.com>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Guard the Linux specific tests by checking for __linux__, as it does
not only not work on Windows but not on macOS either.
Change-Id: I0e710a6da8e6686f11bc8ea23e07ac19f3b4beb2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3928026
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This change rewrites the tests to have `Module` as a prefix and
rearranges them a little. This is prep for adding this file to
breakpad_unittests Chromium-side.
Bug: google-breakpad:751
Change-Id: I8a77f60a0080d06af13dd30d9cf7627dce045d90
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3915004
Reviewed-by: Mark Mentovai <mark@chromium.org>
Instead of (arbitrarily) wait 1s for the child process to terminate, the
parent now polls the child process every 100ms to check if it's
terminated, and it does so for a much longer total time of 10s.
This implementation ensures correct check for slower architectures, and
fast success for faster ones.
Change-Id: I2ff38458bf747de5b74268a4e22fd6164450419b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3876346
Reviewed-by: Mike Frysinger <vapier@chromium.org>
sed -i '' -E -e 's/Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*(\r)?$/Copyright \2 Google LLC\4/' -e '/^((\/\/|#| \*) )?All rights reserved\.?\r?$/d' -e 's/name of Google Inc\. nor the/name of Google LLC nor the/' -e 's/POSSIBILITY OF SUCH DAMAGE$/POSSIBILITY OF SUCH DAMAGE./' $(git grep -El 'Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*$')
Plus manual fixes for src/processor/disassembler_x86.{cc,h}.
Plus some conversions from CRLF to LF line endings in .cc and .h files.
Bug: chromium:1098010
Change-Id: I8030e804eecd9f5a1ec9d66ae166efd8418c2a67
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3878302
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Instead of listing everywhere the set of architectures that do not
require/support explicit float state in their crash context, a new
GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE preprocessor macro has
been defined.
Adding novel architectures will only require to manage the
macro definition in a single place.
Change-Id: I2732982f2cdfc9fcd2f71d6e5e122617faff9e82
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3876345
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This CL fixes the following error detected on a WebRTC bot:
FAILED: obj/third_party/breakpad/utilities/ConfigFile.o
/opt/s/w/ir/cache/goma/client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/breakpad/utilities/ConfigFile.o.d -DCR_XCODE_VERSION=1400 -DCR_CLANG_REVISION=\"llvmorg-16-init-907-g8b740747-1\" -D_LIBCPP_ABI_NAMESPACE=Cr -D_LIBCPP_ABI_VERSION=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -DCR_LIBCXX_REVISION=9f503bebdb9a89f5ee82b82142109b26d688f40c -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/breakpad/breakpad/src -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector -femit-dwarf-unwind=no-compact-unwind -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch x86_64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fno-omit-frame-pointer -g2 -gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot sdk/xcode_links/MacOSX13.0.sdk -mmacos-version-min=10.13 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Werror -Wall -Wno-unused-variable -Wno-c++11-narrowing -Wno-unused-but-set-variable -Wno-misleading-indentation -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -std=c++17 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -c ../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm -o obj/third_party/breakpad/utilities/ConfigFile.o
../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm:108:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
sprintf(processUptimeString, "%llu",
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/sys/cdefs.h:214:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm:114:3: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
sprintf(processCrashtimeString, "%zd", tv.tv_sec);
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/sys/cdefs.h:214:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
Bug: webrtc:14342
Change-Id: I923ab3f9155eb36aa2edf9b1d38c123e3e6ad029
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3829529
Reviewed-by: Mark Mentovai <mark@chromium.org>
- If symbol table section is malformed, skip them.
- SkipDIE and ProcessDIE return nullptr when processing goes wrong due to malformed debug info, stop processing in this case.
Bug: 1349354
Change-Id: Ia1d3e3591bbd2dad8b9eb351c1882cfc03bfad4b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3821448
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
- Resets `selected_object_file_` when a new file is read. This was a dangling pointer previously.
- When `-a` is provided, ensures that both parts of a split module use
the given architecture.
Bug: None
Change-Id: I581d41b0eee4ec2b0d598fb80b9065e7ebde0e0d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3788222
Reviewed-by: Mark Mentovai <mark@chromium.org>
DW_CFA_AARCH64_negate_ra_state uses the same encoding as
DW_CFA_GNU_window_save. It is meant to indicate that x30/LR
has been signed, but breakpad does not require this information.
Bug: b/239086293
Change-Id: I5a17bd5e0673a3ff80a8c6e347013d66054314e8
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3781136
Reviewed-by: Mark Mentovai <mark@chromium.org>
Previously these all resulted in EXCEPTION_STACK_BUFFER_OVERRUN
but this hides various specific fast fail crash types, which
are now provided based on the exception's subcode.
Tests: added to minidump_process_unittest.cc
Bug: 865632
Change-Id: Ic6693de247da55cf6d132d108c6e20c635f366b1
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3771437
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Explicitly call out where overflows are expected, and add appropriate
checking for them.
BUG=b:235999011
TEST=Unittests on CrOS and Linux
Change-Id: I999a6996183c2f4afc16a1c0188dee3bd64d7f09
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3759630
Reviewed-by: Mike Frysinger <vapier@chromium.org>
On ARM, this write fails to build:
comparison of integers of different signs: 'ssize_t' (aka 'int') and
'const unsigned int' [-Werror,-Wsign-compare]
Since we check that it's <= 15 above, we can simply cast it without
issue.
Bug: b:235999011
Change-Id: Id75fc0df74e88b347df615df06567e96c6b59a1d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3758800
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This test's constructor fails to fully initialize this raw context. As a
result, we have at least one use of uninitialized memory in CFI.At4004.
This causes said test to fail under ASAN.
Bug: b:235999011
Change-Id: I3279da8ac3414eb8c90f3949a1db47a03e750a94
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3756749
Reviewed-by: Mike Frysinger <vapier@chromium.org>