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>
Currently, `./configure` supports
`--with-rustc-demangle=${path_to_crate_root}` as the only mechanism to
enable rustc-demangle support. This CL adds support for cases where
keeping or synthesizing a full `cargo` build tree is hacky in comparison
to simply installing `rustc_demangle.h` in e.g., /usr/include, and
putting `librustc_demangle.a` in e.g., `/usr/lib64`.
Bug: b:235999011
Change-Id: Id5fe2a24c4b6e33c4df0e10c86ba99c7cf890ab2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3733672
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Leverage the existing default logic & argument parsing that turn the
values yes/no into true/false to simplify the code so we don't create
duplicate variables. This kills a lot of boilerplate.
Change-Id: Ib7c8e00f7b23e67ed05f3b35e523c235aed41129
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3734169
Reviewed-by: George Burgess <gbiv@chromium.org>
Previous updates to these were partially done. Rerun with the
right versions of autoconf-2.69 & automake-1.16.5.
Change-Id: Ifd6c8405b0b50c5d3cf4ea536a7db5762d62644e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3734167
Reviewed-by: George Burgess <gbiv@chromium.org>
The rust-demangle-capi crate hasn't been updated since 2016 and
out-of-date. Instead, Breakpad needs to use C API offered by the
rustc-demangle to demangle Rust symbols.
*** TESTING ***
1) Set up rustc-demangle
> git clone https://github.com/rust-lang/rustc-demangle.git
> cd rustc-demangle
> cargo build -p rustc-demangle-capi --release
2) Breakpad
> ./configure --with-rustc-demangle=<path to rustc-demangle>
> make check src/common/dward_cu_to_module
Change-Id: Ib68b62ef329f1397bc379a1d04c632781e4b2069
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3273324
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This change updates Makefile.am to include the dwarf2reader lineinfo
unittest to the suite of tests run when make check is invoked. All the
manual changes are limited to the Makefile.am file. The remaining files
contain changes generated by automake.
Change-Id: Ib078391b44235ce430a224713512637ce8e90a36
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2587266
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
getcontext is also not available on musl libc, so generalize
breakpad_getcontext so it can be used as a fallback for non-Android
platforms as well.
On x86_64 and i386, ucontext_t uses an Android-specific offset for
storage of FP registers, since its sigset_t differs in size. So,
make the definition of MCONTEXT_FPREGS_MEM and UCONTEXT_FPREGS_MEM_OFFSET
conditional on whether we are building for Android.
On glibc and musl, signal.h and asm/sigcontext.h can't be included
together, so in breakpad_context_unittest.cc, only compare the libc
and kernel _fpstate when on Android.
Bug: google-breakpad:631
Change-Id: If81d73c4101bae946e9a3655b8d1c40a34ab6c38
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2102135
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Upstream googletest is dropping autotools support and the cmake
installer does not provide gtest-config.
BUG=chromium:940320
TEST=FEATURES=test emerge-lakitu google-breakpad
Change-Id: Icd51ffc48b39c24eebc27cc023e74a77e592de3e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1660893
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This enables the DWARF reader to properly parse DW_AT_ranges attributes
in compilation units and functions. Code covered by a function is now
represented by a vector of ranges instead of a single contiguous range
and DW_AT_ranges entries are used to populate it. All the code and tests
that assumed functions to be contiguous entities has been updated to
reflect the change. DW_AT_ranges attributes found in compilation units
are parsed but no data is generated for them as it is not currently needed.
BUG=754
Change-Id: I310391b525aaba0dd329f1e3187486f2e0c6d442
Reviewed-on: https://chromium-review.googlesource.com/1124721
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
A recent configuration change made it necessary to run our tests on
Travis as root.
This change also increases the timeout of ParallelChildCrashesDontHang
to make it pass in Travis virtualized containers.
Bug: google-breakpad:753
Change-Id: I6ca8ff4513c6ea3e0646f22457f28b5c4fca6654
Reviewed-on: https://chromium-review.googlesource.com/890564
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Change a9fca58 made use of the O_CLOEXEC flag, which is not supported on
older Linux kernels. This change makes the use contingent on kernel
support.
Testing: I manually compiled breakpad on CentOS 5.8 running kernel
2.6.18-308.8.2.el5.centos.plusxen.
Bug: 730
Change-Id: I21dff928cfba3c156a56708913f65a0c7b5396a6
Reviewed-on: https://chromium-review.googlesource.com/498528
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This patch ensures that two crashes taken within the same second have
different minidump names. The random characters used in the minidump
filename are now read from /dev/urandom where possible or generated via
arc4random(). If neither is available we fall back to regular rand() but
mixing the address of an object to the current time when generating the
random seed to make it slightly less predictable.
BUG=681
Change-Id: I2e97454859ed386e199b2628d6b7e87e16481b75
Reviewed-on: https://chromium-review.googlesource.com/445784
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This helps catch issues when rolling in Chromium.
Change-Id: I2e3f33df4a69b501d8c04799ee0ac03a4bed9ac9
Reviewed-on: https://chromium-review.googlesource.com/459477
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This lets us use the flags with clang, and to add more flags easily.
Change-Id: I51bb53ffd5ab6da769cdfb422a2c88442f1ff9ad
Reviewed-on: https://chromium-review.googlesource.com/441864
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Rather than manually include m4 files in configure.ac, let aclocal
do its thing and manage aclocal.m4 automatically for us.
Change-Id: I50689ec78a85651949aab104e7f4de46b14bca5a
Reviewed-on: https://chromium-review.googlesource.com/438544
Reviewed-by: Mark Mentovai <mark@chromium.org>
The Rust compiler uses GCC C++ name mangling, but it has another layer of
encoding so abi::cxa_demangle doesn't produce great results. This patch
changes dump_syms to dump unmangled names by default so that consumers can
demangle them after-the-fact.
It also adds a tiny bit of support for linking against a Rust library I wrote
that can demangle Rust symbols nicely:
https://github.com/luser/rust-demangle-capi
BUG=
Change-Id: I63a425035ebb7ac516f067fed2aa782849ea9604
Reviewed-on: https://chromium-review.googlesource.com/402308
Reviewed-by: Mark Mentovai <mark@chromium.org>
The dump_syms_mac tool only works for the system it is being built for
(it doesn't support running on ELFs for a diff target), and it builds
only for x86 currently.
If you look at the mac header:
src/third_party/mac_headers/mach/machine/vm_types.h
it will #error for non x86/arm systems, and the arm header is not in
our source tree.
Tweak the build so it's only compiled when targetting x86 systems.
BUG=chromium:579384
TEST=`make check` pass
R=ted.mielczarek@gmail.com
Review URL: https://codereview.chromium.org/1645673002 .
Some systems provide prebuilt copies of gmock/gtest (such as Chromium
OS). Add a configure flag so they can take advantage of that. This
allows for a smaller checkout as they don't need to include the full
testing/ tree.
BUG=chromium:579384
TEST=`make check` passes w/--enable-system-test-libs
TEST=`make check` passes w/--disable-system-test-libs
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1638653002 .
If you try to process a file using a 32bit build that is larger than
2GiB in size, the linux kernel will reject things:
$ strace -eopen dump_syms ./chrome ./ > chrome.sym
...
open(".//chrome.debug", O_RDONLY) = -1 EOVERFLOW (Value too large for defined data type)
So let's use the existing autoconf macro to check for and enable support
as need be.
We have to shift the existing m32 logic up to before we start doing
feature test macros though otherwise a simple configure won't work:
$ ./configure --enable-m32
This is because it first tests LFS and such w/out the -m32 flags.
BUG=chromium:266064
TEST=`./configure --enable-m32 && make && make check` passes
R=benchan@chromium.org
Review URL: https://breakpad.appspot.com/619002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1250 4c0a9323-5329-0410-9bdc-e9ce6186880e
This patch fixes the build for Android on MIPS when
using the latest official Android NDK (r9):
- Update src/common/android/include/elf.h to add a missing
definition for SHT_MIPS_DWARF.
- Add src/common/android/include/sgidefs.h required by LSS
when compiling for MIPS.
- Update android/run-checks.sh to work properly with
the --abi=mips option. All tests were passed succesfully
with an emulator system image running Android 4.2.
- Update other Android-specific files.
R=Petar.Jovanovic@imgtec.com, mark@chromium.org
Review URL: https://breakpad.appspot.com/633002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1216 4c0a9323-5329-0410-9bdc-e9ce6186880e
This adds a minimalistic implementation of getcontext()
for Android/ARM and Android/x86. The provided code is
in assembly and only implements the bare minimum required
by Breakpad to get the current processor state.
Note that:
- The FPU state is not saved to the ucontext_t on ARM.
(that's actually the main difference with a normal
getcontext() implementation).
This is normal. On Linux/ARM, such state must be
obtained with PTRACE_GETVFPREGS instead. This will
be implemented in a future patch.
- On x86, only the 'regular' FPU state is saved, to
mimic the GLibc/i386 implementation. The state of
SSE/SSE2/etc registers is not part of the upstream
getcontext() implementation.
Review URL: https://breakpad.appspot.com/444002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1024 4c0a9323-5329-0410-9bdc-e9ce6186880e
This patch remove many Android-specific #ifdefs from the Breakpad
source code. This is achieved by providing "fixed-up" platform
headers (e.g. <signal.h> or <sys/user,h>), in the new directory
src/common/android/include/, which masks differences between
the NDK and GLibc headers.
The old "android_link.h" and "android_ucontext.h" are moved
and renamed.
This also requires putting this directory as the first
include path during Android-hosted builds, hence the
modification of Makefile.am and configure.ac
Review URL: https://breakpad.appspot.com/434002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1017 4c0a9323-5329-0410-9bdc-e9ce6186880e
is no reason not to keep it locally. Implemented a basic disassembler which can be used
to scan bytecode for interesting conditions. This should be pretty easy to add to for
things other than exploitability if there is a desire. This also adds several tests to
the windows exploitability ranking code to take advantage of the disassembler for x86
code.
BUG=None
TEST=DisassemblerX86Test.*
Review URL: http://breakpad.appspot.com/203001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@705 4c0a9323-5329-0410-9bdc-e9ce6186880e
This patch refreshes the build system files to those generated by:
- Libtool 2.2.6
- Automake 1.11
- Autoconf 2.64
a=jimblandy, r=nealsid
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@470 4c0a9323-5329-0410-9bdc-e9ce6186880e