Recently, Breakpad symbol files have exceeded the various 32-bit limits in these utils and we started seeing integer overflows.
This is also fixing a build issue in src/common/mac/dump_syms.cc.
Change-Id: Ibd913816c3b2b1171ac9991718c8911ac31eda86
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5299472
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
- Mark `RawImagePatch` weak
- Fix reversed condition in disk image unmounting
- Ensure source files are closed when copying
- Use 0-based indexing when determining installer OS version
Bug: None
Change-Id: I015f2b0d9c88a5ec128822d55c974e22723a1a6e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5291963
Reviewed-by: Mark Mentovai <mark@chromium.org>
Updated code to use Google's modern C++ style.
* Use std::unique_ptr to allocate DwarfCUToModule::WarningReporter.
* Fixed reference alignment in NullWarningReporter.
Change-Id: I230dac445a07b4023a64284b907010f31eadcdf4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5265662
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Fix a type definition, so it doesn't collide if the similar
type is already defined in the sysroot headers.
Test: Build for Android/Linux.
Bug: Internal 322205293
Change-Id: I3453de725083b01f2e69a61a7fc948f9f8ca5eca
Signed-off-by: Volodymyr Riazantsev <riazantsevv@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5251488
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
For ARM32 binaries running on ARM64 Linux (kernel) reading of FP
registers fails. It's guarded for Android as well as softap platforms,
but other ARM platforms can suffer from this issue.
The ARMEABI linux_ptrace_dumper_unittest fails on system that runs
under ARM64 kernel.
In order to mitigate the issue, we adding a VFP registers read.
The Breakpad does not support include of VFP registers into a minidump
file, so that read is noop for the backend, but just a fix for broken
systems.
Bug: internal 322205293
Test: Run linux_ptrace_dumper_unittest on following [userland:kernel]
combinations:
armeabi-hardfp:armeabi
armeabi-softfp:armeabi
armeabi-hardfp:aarch64
aarch64:aarch64
Signed-off-by: Volodymyr Riazantsev <riazantsevv@google.com>
Change-Id: I0709ae9a7ff913340ebc89de703ab2cb9c823b14
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5247149
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This uninitialized-memory use breaks the Mac ubsan build as dump_syms
runs during the build step.
Bug: chromium:1324701
Change-Id: Id4e0a7d38893b2ceb49e58d1f5c99a056d84a921
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5243705
Reviewed-by: Lei Zhang <thestig@chromium.org>
The version of Makefile.in that landed in https://crrev.com/c/4722191
had a Makefile.in that was generated from a previous version of
Makefile.am where the libzstd dependency wasn't optional. That's causing
some problems (see: https://crrev.com/c/5193965) and is a simple
mistake.
I generated this CL by simply running `automake`, so it simply makes the
checked in generated Makefile.in based on the checked in source
Makefile.am
Change-Id: Iabb4a99bfac3f5ef6067a140bd373c9fb894878a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5200626
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This change introduces two new flags: `--ipsw` and `--installer` which are mutually exclusive with `--system-root` and each other. Each takes a file path as an argument, which is expected to be an IPSW for `--ipsw` and an Apple installer for `--installer`.
Calling `upload_system_symbols` with these arguments will cause it to find any dyld shared caches present inside the given IPSW or installer, extract them via `dsc_extractor` in `--breakpad-tools`, then behave as if it had been called with the resulting libraries as `--system-root`.
Bug: chromium:1400770
Change-Id: I7f98e0c6ab069a2e960f12773d800d8a5a37221f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5089008
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Minidumps can contain extended contexts with xstate data for amd64 and
x86.
Support for amd64 contexts was added in
fe35cd43f2.
With this change, breakpad can now read x86 minidumps that contain
extended xstate data. Similar to the previously mentioned commit, this
change does not yet add processing for this extra data, but will allow
the minidumps to be read.
Change-Id: Ie96e91168def774092e05908535a70fc5e2427e9
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5154022
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Otherwise, even with core.autocrlf=false, Windows will checkout these minidump output files with CRLF line-ending. It is necessary for these
files to be checked out using LF line-ending for the unit tests to pass.
Change-Id: I7cacf4b5fa56e007c8aa81202e0cef7ad42ae93a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5160534
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Windows doesn't have posix regex support. This will disable these tests so long as Google's ABSL library is not also found.
Change-Id: Ie6f96d5ea74b80b6128c2f1ec3ed54fcfaa17f47
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5160533
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
In RangeMap::StoreRangeInternal, when size <= 0 and !high_ok then the
high variable is passed to HexString uninitialized.
Change-Id: I7e597cadaf248b607c646534a5d800c17ccdeda9
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5155712
Reviewed-by: Robert Sesek <rsesek@chromium.org>
When building a stack trace using StackwalkerAddressList, if there are
inlined frames then the stack trace will skip over the following
frames, leading to missing frames in the symbolized stacktraces.
Bug: 314930064
Change-Id: I5c7a1b2e7c2f728e27b2082e77ebe953808f38bc
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5087692
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Inline frames are always of the base-class type (StackFrame). Treating them as derived-class and accessing members is causing buffer overflows.
Change-Id: Ib41b74256e6162e7d2b14ca3905dfaf5591b9c86
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4847317
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Functions such as FindElfSection and FindElfSegments that inspect
the ELF header expect a pointer to the first byte of the file.
IsValidElf() checks for the ELF magic number at offset 0.
Thus, we must map ELF object files from offset 0.
Change-Id: Icebfb46229a04019f57a7ec07844257b98ceb278
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4674337
Reviewed-by: Mike Frysinger <vapier@chromium.org>
The _tmp buffer used in STRNCATF is too small for several callers,
which might lead to truncated output in some situations.
For example, GCC 11 warns:
src/third_party/libdisasm/x86_format.c:899:40: warning: ‘%s’ directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
899 | STRNCATF( buf, "%s:", str, len );
| ^~~~~ ~~~
src/third_party/libdisasm/x86_format.c:34:38: note: in definition of macro ‘STRNCATF’
34 | snprintf( _tmp, sizeof _tmp, fmt, data ); \
| ^~~
src/third_party/libdisasm/x86_format.c:899:41: note: format string is defined here
899 | STRNCATF( buf, "%s:", str, len );
| ^~
In file included from /usr/include/stdio.h:894,
from src/third_party/libdisasm/x86_format.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 65 bytes into a destination of size 32
71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Change-Id: Ia876e288bf9629f2c72db3faf2287c7940924ea0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4668735
Reviewed-by: Mike Frysinger <vapier@chromium.org>
The debug info in the dwp file needs to refer to the .debug_line and
.debug_line_str sections in the main binary.
This fixes dump_syms not generating LINE records for dwp in split dwarf.
Bug: chromium:1448979
Change-Id: I71923f12cea72caae081c1406e2cbca55e95859e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4576346
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
The hex formatting in MinidumpCrashpadInfo::Print() was missing
the leading 0, so byte values < 128 were not possible to decode.
Change-Id: Ib355bcdaf86e91d644045df645fb4fa75332aa4b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4571100
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
- RISCV32 will only include support for 32 bit floating point registers
- RISCV64 will only include support for 64 bit floating point registers
- RISCV 32/64 context will include a "version" field to account for
future extensions
Fixed: 1447862
Tested: `make check` on x86 host
Tested: `minidump_stackwalk` for RISCV64 minidump on x86 host
Change-Id: I605d5b2c35e627a5dc986aaf818a9c9898f6ae0b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4553281
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
It fixes following two problems:
1. When we have skeleton compilation unit (DW_TAG_skeleton_unit) in a
binary file refers to the complete unit in a split dwarf file
(.dwo/.dwp file), we should use the split dwarf file's path in warning
reporting. Right now, it uses the original file (binary file) path in
warning report, which is incorrect.
For example, if we have chrome.debug which is the binary with skeleton
debug info and chrome.dwp which is the complete debug info and the debug
info in chrome.dwp has some incorrect reference, it will warn on
chrome.debug rather than chrome.dwp
2. When split dwarf is enabled, the global inline_origin_map will likely
encounter key collision because the offsets as keys are now relative to
each CU's offset which is relative to .debug_info section. Also
offsets from different files might collide.
This change makes a inline_origin_map for each debug file and use
offsets only relative to .debug_info section as keys.
Bug: b/280290608
Change-Id: If70e2e1bfcbeeeef2d425c918796d351a0e9ab3b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4544694
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
macOS caps filenames at 255 characters. When upload_system_symbols runs
`dump_syms`, the resulting filename is based on a mangled version of
the file's full path. In some circumstances (for example, the dumped
file itself lives in a temp directory), this name can exceed the max.
This change replaces the current mangling by mapping each path component but the last to its first initial, greatly shortening
the resulting filename.
Bug: 1400770
Change-Id: I68203a98eda2912893c5d8f7c676faee17e39e91
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4519231
Reviewed-by: Robert Sesek <rsesek@chromium.org>
- Replace DISALLOW_COPY_AND_ASSIGN with =delete.
- Replace some NULLs with nullptrs;
- Use the override keyword when appropriate.
- Use =default when appropriate.
Change-Id: I99e1d7f349dd4c32aa5d05e2ebdce7a86e47f551
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4527718
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This adds a new flag `enable_objdump_for_exploitability_` to the
MinidumpProcessor, which allows enabling objdump separately for crash
address fixups and for exploitability analysis, as the performance cost
of the exploitability analysis is significantly higher.
Change-Id: I667ffdce7cc0a970793f91413c3d2e3af93f4247
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4507067
Reviewed-by: Ivan Penkov <ivanpe@google.com>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Change 4505156 changed the RISCV register names, this change adjusts
the unittest to match the new names.
Bug: 1432426
Change-Id: I0887d8fc11eec63ab6953ea1a136873591e49286
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4507066
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
dump_syms was using x0...x31 notation, while the rest of Breakpad was
using the ABI names. This mismatch was causing stackwalking to not fully
succeed.
Fixed: 1432426
Change-Id: I0713e76e65ff6dad492b51bc3607e94e25dc2c3a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4505156
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
MDRawCrashpadAnnotationList::objects is a flexible array of
MDRawCrashpadAnnotation and not MDLocationDescriptor. Breakpad does not
currently use the MDRawCrashpadAnnotationList type, but its definition
should be updated to reflect the correct type to avoid confusion.
Change-Id: I58b5b0e4f7f95bc003b103e2750e3759c3e31292
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4503630
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
MDRawModuleCrashpadInfoList::modules is a flexible array of
MDRawModuleCrashpadInfoLink and not MDLocationDescriptor. Breakpad does
not currently use the MDRawModuleCrashpadInfoList type, but its
definition should be updated to reflect the correct type to avoid
confusion.
Change-Id: If97f490db8d41529b59a225a275a37116746c2b7
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4504150
Reviewed-by: Joshua Peraza <jperaza@chromium.org>