aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux
Commit message (Collapse)AuthorAgeFilesLines
* Add process type to MicroDumpExtraInfoPrimiano Tucci2016-07-192-1/+16
| | | | | | | BUG=616774 R=primiano@chromium.org, torne@chromium.org Review URL: https://codereview.chromium.org/2087413002 .
* Recover memory mappings before writing dump on ChromeOSTing-Yuan (Leo) Huang2016-07-181-0/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Linux, breakpad relies on /proc/[pid]/maps to associate symbols from addresses. ChromeOS' hugepage implementation replaces some segments with anonymous private pages, which is a restriction of current implementation in Linux kernel at the time of writing. Thus, breakpad can no longer symbolize addresses from those text segments replaced by hugepages. This patch tries to recover the mappings. Because hugepages are always inserted in between some .text sections, it tries to infer the names and offsets of the segments, by looking at segments immediately precede and succeed them. For example, a text segment before hugepage optimization 02001000-03002000 r-xp /opt/google/chrome/chrome can be broken into 02001000-02200000 r-xp /opt/google/chrome/chrome 02200000-03000000 r-xp 03000000-03002000 r-xp /opt/google/chrome/chrome BUG=crbug.com/628040 R=mark@chromium.org Review URL: https://codereview.chromium.org/2161713002 . Patch from Ting-Yuan (Leo) Huang <laszio@chromium.org>.
* Server-side workaround to handle overlapping modules.Ivan Penkov2016-06-201-0/+2
| | | | | | | | | | | | | | This change is resolving an issue that was caused by the combination of: - Android system libraries being relro packed in N+. - Breakpad dealing with relro packed libraries in a hack way. This is a fix for http://crbug/611824. I also found an use-after-free issue (bug in Minidump::SeekToStreamType). I disallowed the MinidumpStreamInfo copy and assign constructors and the compiler detected another similar issue in Minidump::Print. Then I disabled the copy and assign constructors for most classes in minidump.h (just in case). There are a couple of classes where I couldn't disallow them (since assign is used). This will require a small refactor so I left it out of this CL. R=mark@chromium.org Review URL: https://codereview.chromium.org/2060663002 .
* linux/android: add SIGTRAP to the list of signals handled by the clientPrimiano Tucci2016-06-081-1/+1
| | | | | | | | | | | | | __builtin_trap() causes a SIGTRAP on arm64 (at least with GCC 4.9). SIGTRAP is not handled by breakpad, causing crashes induced by __builtin_trap() to be missed. Note that on x86 and arm, instead, __builtin_trap() raises a SIGILL, which is already handled by breakapd. BUG=chromium:614865 R=vapier@chromium.org Review URL: https://codereview.chromium.org/2042853002 .
* Fixing an unused-variable warning in microdump_writer.ccIvan Penkov2016-05-241-1/+0
| | | | | | | BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=699 R=mark@chromium.org, primiano@chromium.org Review URL: https://codereview.chromium.org/2006333002 .
* Fix stack collection with size limitLars Volker2016-05-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | src/client/linux/minidump_writer/minidump_writer.cc:273 obtains the stack info by calling GetStackInfo(). That method will return the stack base address, aligned to the bottom of the memory page that 'stack_pointer' is in. After that it will cap the size of the memory area to be copied into the minidump to 'max_stack_len', starting from the base address, if the caller requested so. This will be the case when collecting reduced stacks, as introduced by this change: https://breakpad.appspot.com/487002/ In such cases the caller will request 2048 bytes of memory. However GetStackInfo() will have aligned the base address to the page boundary, by default 4096 bytes. If the stack, which grows towards the base address from the top ends before the 2048 bytes of the first block, then we will not collect any useful part of the stack. As a fix we skip chunks of 'max_stack_len' bytes starting from the base address until the stack_pointer is actually contained in the chunk, which we will add to the minidump file. BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=695 R=ivanpe@chromium.org Review URL: https://codereview.chromium.org/1959643004 . Patch from Lars Volker <lv@cloudera.com>.
* Functions only called by DumpFreeSpace need to be conditionally compiled.Tobias Sargeant2016-05-231-0/+6
| | | | | | | BUG=525938 R=mark@chromium.org Review URL: https://codereview.chromium.org/2008553002 .
* Add statistics about free space to microdump format.Primiano Tucci2016-05-231-2/+141
| | | | | | | | | | | | When a crash occurs as a result of an allocation failure, it is useful to know approximately what regions of the virtual address space remain available, so that we know whether the crash should be attributed to memory fragmentation, or some other cause. BUG=525938 R=primiano@chromium.org Review URL: https://codereview.chromium.org/1796803003 .
* breakpad: fix unittest errorsYunlian Jiang2016-05-041-4/+0
| | | | | | | | | | | This fixes the unittest error caused by https://codereview.chromium.org/1884283002/ TEST=unittest passes on falco board in ChromeOS. BUG= R=vapier@chromium.org Review URL: https://codereview.chromium.org/1952083002 .
* Revert of Extend mapping merge to include reserved but unused mappings. ↵Primiano Tucci2016-04-281-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://breakpad.appspot.com/7714003) Reason for revert: It is causing breakpad crash reports to be invalid (see the associated bug). Merging empty holes in r-x mappings was originally introduced in https://breakpad.appspot.com/7714003 to deal with the first generation of relro packing, which could introduce holes within a .so mapping: [libchrome.so] [guard region] [libchrome.so] However, the logic is broken for the case of two *different* adjacent .so mappings with a guard region in the middle: [libfoo.so] [guard region] [libchrome.so] In this case the guard region is mistakenly associated with libfoo.so, but that is not the right thing to do. In fact, the second generation of rerlo packing added the guard region to prevent mmaps from overlapping and to give room for the non-zero vaddr of relro-packed libraries, which require an anticipated load bias. As the first generation of relro packing is not used anymore, there is no reason to keep this buggy code, which causes failures in decoding crashes where an arbitrary library is mapped immediately before a rerlo packed library. Original issue's description: > Extend mapping merge to include reserved but unused mappings. > > When parsing /proc/pid/maps, current code merges adjacent entries that > refer to the same library and where the start of the second is equal to > the end of the first, for example: > > 40022000-40025000 r-xp 00000000 b3:11 827 /system/lib/liblog.so > 40025000-40026000 r--p 00002000 b3:11 827 /system/lib/liblog.so > 40026000-40027000 rw-p 00003000 b3:11 827 /system/lib/liblog.so > > When the system linker loads a library it first reserves all the address > space required, from the smallest start to the largest end address, using > an anonymous mapping, and then maps loaded segments inside that reservation. > If the loaded segments do not fully occupy the reservation this leaves > gaps, and these gaps prevent merges that should occur from occurring: > > 40417000-4044a000 r-xp 00000000 b3:11 820 /system/lib/libjpeg.so > > 4044a000-4044b000 ---p 00000000 00:00 0 > 4044b000-4044c000 r--p 00033000 b3:11 820 /system/lib/libjpeg.so > 4044c000-4044d000 rw-p 00034000 b3:11 820 /system/lib/libjpeg.so > > Where the segments that follow this gap do not contain executable code > the failure to merge does not affect breakpad operation. However, where > they do then the merge needs to occur. Packing relocations in a large > library splits the executable segment into two, resulting in: > > 73b0c000-73b21000 r-xp 00000000 b3:19 786460 > /data/.../libchrome.2160.0.so > > 73b21000-73d12000 ---p 00000000 00:00 0 > 73d12000-75a90000 r-xp 00014000 b3:19 786460 > /data/.../libchrome.2160.0.so > 75a90000-75c0d000 rw-p 01d91000 b3:19 786460 > /data/.../libchrome.2160.0.so > > Here the mapping at 73d12000-75a90000 must be merged into 73b0c000-73b21000 > so that breakpad correctly calculates the base address for text. > > This change enables the full merge by also merging anonymous maps which > result from unused reservation, identified as '---p' with offset 0, and > which follow on from an executable mapping, into that executable mapping. > > BUG=chromium:394703 BUG=chromium:499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1923383002 .
* Switch the Linux minidump writer to use MDCVInfoELF for CV data.Ted Mielczarek2016-04-057-91/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | This preserves full build ids in minidumps, which are useful for tracking down the right version of system libraries from Linux distributions. The default build id produced by GNU binutils' ld is a 160-bit SHA-1 hash of some parts of the binary, which is exactly 20 bytes: https://sourceware.org/binutils/docs-2.26/ld/Options.html#index-g_t_002d_002dbuild_002did-292 The bulk of the changes here are to change the signatures of the FileID methods to use a wasteful_vector instead of raw pointers, since build ids can be of arbitrary length. The previous change that added support for this in the processor code preserved the return value of `Minidump::debug_identifier()` as the current `GUID+age` treatment for backwards-compatibility, and exposed the full build id from `Minidump::code_identifier()`, which was previously stubbed out for Linux dumps. This change keeps the debug ID in the `dump_syms` output the same to match. R=mark@chromium.org, thestig@chromium.org BUG= Review URL: https://codereview.chromium.org/1688743002 .
* Don't merge the mappings if their exec bit are different.Primiano Tucci2016-03-081-1/+2
| | | | | | | BUG=585534 R=primiano@chromium.org Review URL: https://codereview.chromium.org/1750033002 .
* Add an optional root prefix to Linux dumpersDominik Laskowski2016-03-077-35/+58
| | | | | | | | | | | The Linux dumpers use absolute paths for shared libraries referenced by dumps, so they fail to locate them if the crash originated in a chroot. This CL enables callers to specify a root prefix, which is prepended to mapping paths before opening them. BUG=chromium:591792 TEST=make check Review URL: https://codereview.chromium.org/1761023002/
* Ensure Linux minidump writer flushes minidump header early.Ted Mielczarek2016-02-121-11/+18
| | | | | | | | | | | | | | | | If the Linux minidump writer crashes while writing a dump, the dump might contain some useful information, but the header will be empty because TypedMDRVA's destructor flushes the data, and the header var doesn't go out of scope until the end of the `Dump` method. This fixes that problem by putting the header in a shorter block scope. We've seen this problem in some Android dumps in the wild, like: https://crash-stats.mozilla.com/report/index/cef5b777-02d1-43c2-bf40-133ab2160209 R=thestig@chromium.org BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1247978 Review URL: https://codereview.chromium.org/1696573003 .
* [mips64] Support for mips n64Mike Frysinger2016-02-064-0/+24
| | | | | | | | | | Adding remaining mips n64 support including stackwalker. BUG=None TEST=manually tested on Linux/Android R=vapier@chromium.org Review URL: https://codereview.chromium.org/1418453011 .
* Fix compilation of breakpad on Linux.Sylvain Defresne2016-01-081-2/+2
| | | | | | | | | Fix some copy/paste errors from commit 41440eaa. BUG=None R=thestig@chromium.org Review URL: https://codereview.chromium.org/1564293002 .
* Use range-based for loops in linux/minidump_writer/minidump_writer.cc.Lei Zhang2016-01-071-45/+32
| | | | | | | | Also fix lint errors. R=mark@chromium.org Review URL: https://codereview.chromium.org/1562273002 .
* Avoid comparing size_t to be < 0 on AArch64.Lei Zhang2016-01-061-2/+2
| | | | | | | | | | | | cpu_features_entries is empty on AArch64 and causes tautological-compare warning when compiling with Clang. A=dskiba@google.com Original Review: https://codereview.chromium.org/1562223002/ BUG=chromium:539781 Review URL: https://codereview.chromium.org/1566893002 .
* Fix -Wunused-function warnings in ASAN builds.Lei Zhang2015-12-301-6/+2
| | | | | | | | A=thakis@chromium.org BUG=chromium:573250 Original Review: https://codereview.chromium.org/1551963002/ Review URL: https://codereview.chromium.org/1551983002 .
* Fix file descriptor leaks in linux CrashGenerationServerMike Frysinger2015-11-111-0/+3
| | | | | | R=ted.mielczarek@gmail.com Review URL: https://codereview.chromium.org/1137423004 .
* Add GPU fingerprint information to breakpad microdumps.Primiano Tucci2015-09-287-81/+164
| | | | | | | | | | | | | | | | | | Although strictly the GPU fingerprint is defined by the build fingerprint, there is not currently a straightforward mapping from build fingerprint to useful GPU / GL driver information. In order to aid debugging of WebView crashes that occur in GL drivers, and to better understand the range of drivers and versions for feature blacklisting purposes, it is useful to have GPU fingerprints in breakpad microdumps. Landing this patch on behalf of Tobias Sargeant<tobiasjs@chromium.org> BUG=chromium:536769 R=primiano@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1334473003 .
* Linux ExceptionHandler: don't allocate the CrashContext on the stackPrimiano Tucci2015-09-221-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | On Android the size of the alternate stack can be very small (8k). Even if breakpad uses sigaltstack to increase the size of the alternate stack during initialization, that call affects only the main thread. On Android, the libc's pthread initializer reset the sigaltstack to 8k. When entering a signal handler, the kernel typically pushes the context on the alternate stack. On arm64, sizeof(CrashContext) is ~5k, which leaves 3k of usable stack for breakpad. On top of that, breakpad allocates another struct CrashContext on the stack. In the case of Android arm64, then, breakpad ends up using 5k + 5k > 8k of stack, which causes a stack overflow. This got unnoticed in Android L, as the alternate stack didn't have red-zones between them, so breakpad was often happily overflowing onto the next thread's stack. This is not the case anymore [1]. This CL moves the CrashContext into a global variable. It should be safe as the ExceptionHandlers are serialized on a mutex. [1] https://android.googlesource.com/platform/bionic/+/595752f623ae88f7e4193a6e531a0805f1c6c4dc BUG=374 R=mark@chromium.org Review URL: https://codereview.chromium.org/1354923002 .
* Remove obsolete seccomp_unwinder for legacy (pre-BPF) sandboxprimiano@chromium.org2015-08-184-214/+0
| | | | | | | | | | | | | | | | | | | | | The PopSeccompStackFrame was introduced to deal with stack frames originated in the legacy seccomp sandbox. The only user of that sandbox was Google Chrome, but the legacy sandbox has been deprecated in 2013 (crrev.com/1290643003) in favor of the new bpf sandbox. Removing this dead code as it has some small bound checking bug which causes occasional crashes in WebView (which are totally unrelated to the sandbox). Note: this will require a corresponding change in the chromium GYP/GN build files to roll. BUG=665,chromium:477444 R=jln@chromium.org, mark@chromium.org, torne@chromium.org Review URL: https://codereview.chromium.org/1299593003 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1492 4c0a9323-5329-0410-9bdc-e9ce6186880e
* [microdump] Move microdump writes to the crash ring-buffer logprimiano@chromium.org2015-08-174-3/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | So far the microdump_writer dumped the log in logcat using the default system log. This is simple to achieve but has some drawbacks: 1. Creates spam in the system log, pushing back other eventual useful messages. 2. There is a high chance that the microdump gets lost if some log spam storm happens immediately after a crash and before the log is collected by the feedback client. 3. Since Android L, the logger is smartly throttling messages (to reduce logcat spam). Throttling brekpad logs defeats the all point of microdumps. This change is conceptually very simple. Replace the use of __android_log_write() with __android_log_buf_write(), which takes an extra bufID argument. The main drawback is that the __android_log_buf_write is not exported in the NDK and needs to be dynamically looked up via dlsym. This choice has been discussed and advocated by Android owners. See the internal bug b/21753476. BUG=chromium:512755 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1286063003 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1490 4c0a9323-5329-0410-9bdc-e9ce6186880e
* [microdump] Fix hw architecture indication in build fingerprint lineprimiano@chromium.org2015-08-172-15/+60
| | | | | | | | | | | | | | | | r1456 introduced the possibility to customize the OS-line of the microdump, enabling to replace, in the case of android, the generic uname() info with the Android build fingerprint. While doing that, it mistakenly removed the HW architecture indication from the format. See crbug.com/520075 for more details. BUG=chromium:520075 R=mmandlis@chromium.org, torne@chromium.org Review URL: https://codereview.chromium.org/1288313002 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1489 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix breakpad for arm on arm64cjhopman@chromium.org2015-08-051-0/+6
| | | | | | | | | | | | On arm64 devices, GETFPREGS fails with errno==EIO. Ignore those failures on Android arm builds. BUG=508324 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1268023003 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1479 4c0a9323-5329-0410-9bdc-e9ce6186880e
* add aarch64 support to minidump-2-corevapier@chromium.org2015-07-201-3/+3
| | | | | | | | | | | | | | | | | The thread info expects the struct names as they expect in asm/ptrace.h, but the header doesn't include that, it includes sys/user.h. Rename the reg structs to match that header. Rename the elf_siginfo to _elf_siginfo to avoid conflicting with the one in the sys/procfs.h. It is only used locally in one place, so we don't need to update any callers. Otherwise, drop in aarch64 support into the minidump-2-core file. BUG=chromium:334368 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1474 4c0a9323-5329-0410-9bdc-e9ce6186880e
* tests: InstructionPointerMemoryNullPointer: make it work under llvmvapier@chromium.org2015-07-201-1/+6
| | | | | | | | | | | | | When LLVM sees an attempt to dereference a NULL pointer, it will generate invalid opcodes (undefined behavior) which leads to SIGILL which breaks this unittest. Upstream's recommendation in this case is to add volatile markings to get the actual dereference to happen. This is documented in the blog post under "Dereferencing a NULL Pointer": http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1473 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Adjust breakpad module size to match adjusted start_addr.rmcilroy@chromium.org2015-06-301-4/+9
| | | | | | | | | | | | | | | | | | When changing a module's start_addr to account for Android packed relocations, also adjust its size field so that the apparent module end addr calculated by the breakpad processor does not alter. Ensures that the mapping entry from a packed library is consistent with that which an unpacked one would produce. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1211863002. Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1465 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Update breakpad for Android packed relocations.rmcilroy@chromium.org2015-06-194-2/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | Shared libraries containing Android packed relocations have a load bias that differs from the start address in /proc/$$/maps. Current breakpad assumes that the load bias and mapping start address are the same. Fixed by changing the client to detect the presence of Android packed relocations in the address space of a loaded library, and adjusting the stored mapping start address of any that are packed so that it contains the linker's load bias. For this to work properly, it is important that the non-packed library is symbolized for breakpad. Either packed or non-packed libraries may be run on the device; the client detects which has been loaded by the linker. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1189823002. Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1459 4c0a9323-5329-0410-9bdc-e9ce6186880e
* [microdump] Add build fingerprint and product info metadata.primiano@chromium.org2015-05-156-50/+163
| | | | | | | | | | | | | | | | This is to add build fingerprint and product name/version to microdumps. Conversely to what happens in the case of minidumps with MIME fields, due to the nature of minidumps, extra metadata cannot be reliably injected after the dump is completed. This CL adds the plumbing to inject two optional fields plus the corresponding tests. BUG=chromium:410294 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1125153008 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1456 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix signal propagation logic for Linux/Android exception handler.primiano@chromium.org2015-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code is relying on info->si_pid to figure out whether the exception handler was triggered by a signal coming from the kernel (that will re-trigger until the cause that triggered the signal has been cleared) or from user-space e.g., kill -SIGNAL pid, which will NOT automatically re-trigger in the next signal handler in the chain. While the intentions are good (manually re-triggering user-space signals), the current implementation mistakenly looks at the si_pid field in siginfo_t, assuming that it is coming from the kernel if si_pid == 0. This is wrong. siginfo_t, in fact, is a union and si_pid is meaningful only for userspace signals. For signals originated by the kernel, instead, si_pid overlaps with si_addr (the faulting address). As a matter of facts, the current implementation is mistakenly re-triggering the signal using tgkill for most of the kernel-space signals (unless the fault address is exactly 0x0). This is not completelly correct for the case of SIGSEGV/SIGBUS. The next handler in the chain will stil see the signal, but the |siginfo| and the |context| arguments of the handler will be meaningless (retriggering a signal with tgkill doesn't preserve them). Therefore, if the next handler in the chain expects those arguments to be set, it will fail. Concretelly, this is causing problems to WebView. In some rare circumstances, the next handler in the chain is a user-space runtime which does SIGSEGV handling to implement speculative null pointer managed exceptions (see as an example http://www.mono-project.com/docs/advanced/runtime/docs/exception-handling/) The fix herein proposed consists in using the si_code (see SI_FROMUSER macros) to determine whether a signal is coming form the kernel (and therefore just re-establish the next signal handler) or from userspace (and use the tgkill logic). Repro case: This issue is visible in Chrome for Android with this simple repro case: - Add a non-null pointer dereference in the codebase: *((volatile int*)0xbeef) = 42 Without this change: the next handler (the libc trap) prints: F/libc ( 595): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x487 where 0x487 is actually the PID of the process (which is wrong). With this change: the next handler prints: F/libc ( 595): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbeef which is the correct answer. BUG=chromium:481937 R=mark@chromium.org Review URL: https://breakpad.appspot.com/6844002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1454 4c0a9323-5329-0410-9bdc-e9ce6186880e
* [MIPS]: Use mcontext_t structure for MIPSrmcilroy@chromium.org2015-04-215-48/+97
| | | | | | | | | | | | | | This change removes user_regs_struct and user_fpregs_struct structures for mips and uses mcontext_t instead. R=fdegans@chromium.org, mark@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/3744002 Patch from Gordana Cmiljanovic <Gordana.Cmiljanovic@imgtec.com>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1452 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix call to rt_sigactioncjhopman@chromium.org2015-04-151-4/+4
| | | | | | | | | | | Despite the fact that many places imply that sigaction and rt_sigaction are essentially the same, rt_sigaction's signature is actually different-- it takes the size of the kernel's sigset_t as an extra argument. BUG=473973 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1447 4c0a9323-5329-0410-9bdc-e9ce6186880e
* MIPS64: Initial MIPS64 related change.mark@chromium.org2015-04-155-3/+21
| | | | | | | | | | | With this change Breakpad can be compiled for MIPS64, but it is not yet functional. Patch by Gordana Cmiljanovic <Gordana.Cmiljanovic@imgtec.com> Review URL: https://breakpad.appspot.com/6824002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1446 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Use __NR_rt_sigaction instead of __NR_sigactionmark@chromium.org2015-04-131-1/+1
| | | | | | | | | | | __NR_sigaction is not defined on arm64/x64/etc (or rather, it's defined in unistd-32.h instead of unistd.h). Patch by Chris Hopman <cjhopman@chromium.org> Review URL: https://breakpad.appspot.com/10724002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1443 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Workaround Android sigaction bugmark@chromium.org2015-04-101-3/+21
| | | | | | | | | | | | | | | | | On Android L+, signal and sigaction symbols are provided by libsigchain that override the system's versions. There is a bug in these functions where they essentially ignore requests to install SIG_DFL. Workaround this issue by explicitly performing a syscall to __NR_rt_sigaction to install SIG_DFL on Android. BUG=473973 Patch by Chris Hopman <cjhopman@chromium.org> Review URL: https://breakpad.appspot.com/1804002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1438 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix compilation with gcc --std=c++11ted.mielczarek@gmail.com2015-03-244-9/+9
| | | | | | | | | Patch by Jon Turney <jon.turney.1111@gmail.com> R=ted at https://breakpad.appspot.com/7824002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1435 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix compatibility with Android NDK r10d.primiano@chromium.org2015-03-161-15/+0
| | | | | | | | | | | | | | | | This is a reland of the previous CL (r1433). r1433 did not achieve what intended and failed the x86_64 build of Chrome with NDK r10c. The workaround logic in this CL is identical to r1433, but the #define magic is applied in a more appropriate proper place this time. Turns out Breakpad already has an Android compatibility layer, which is common/android/include. Piggybacking the fix there. BUG=breakpad:642 R=fdegans@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/3794002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1434 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Make breakpad compatible with Android NDK r10d.primiano@chromium.org2015-03-102-5/+16
| | | | | | | | | | | | | | | | | | | | | r1397 did introduce a workaround to deal with a typo in sys/user.h in the Android NDK. The typo has been fixed in [1]. However, breakpad cannot just switch to the fixed version as this would require atomic rolls of Breakpad and NDK in chromium, which would make reverts hard to handle. This change introduces an inelegant yet functional hack which makes breakpad compatible with both versions of the NDK, with and without the typo. It can be reverted once Chrome has stably rolled to NDK r10d. [1] https://android.googlesource.com/platform/bionic/+/f485547b BUG=breakpad:642 R=fdegans@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/7814002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1433 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Microdump writer: stop using new/malloc in compromised contextprimiano@chromium.org2015-03-101-9/+13
| | | | | | | | | | | | | | | | A recent change in the client-side microdump write (r1404) ended up introducing a call to new() to instantiate the line buffer that microdump uses to dump its lines. new/malloc is a luxury we cannot afford in a compromised context. This change switches the line buffer to be backed by the dumper page allocator, which on Linux/Android ends up requesting pages via mmap. Also, the microdump write bails out without crashing if the page allocator failed (crash during severe OOM). BUG=640 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1432 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix overflow error in breakpad for linuxmark@chromium.org2015-02-051-4/+4
| | | | | | | | | | | | | | | A computation in the stack unwind algorithm could cause an overflow if a base pointer read from crashed process is sufficiently close to top of address space. This causes a memory read that causes the dump thread to crash, resulting in a failure to generate crash dump. Check fixed to properly detect that this pointer is greater than actual memory range of current stack. Patch by Kyle Joswiak <kjoswiak@chromium.org> Review URL: https://breakpad.appspot.com/3754003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1425 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Handle failures of copying process data from a core file.benchan@chromium.org2015-02-026-16/+31
| | | | | | | | | | | | | | | | | | | | | | | | | When LinuxCoreDumper fails to copy process data from a core file, it fills the return buffer with a repeated sequence of a special marker. However, MinidumpWriter doesn't know about that and may incorrectly interpret the data. In many cases, MinidumpWriter simply copies the gibberish data to the minidump, which isn't too bad. However, the gibberish data may cause MinidumpWriter to behave badly in some other cases. For example, when MinidumpWriter tries to iterate through the linked list of all loaded DSOs via the r_map field of a r_debug struct, if the linked list is filed with the special marker, the code keeps iterating through the same address. This CL addresses the issue by having LinuxCoreDumper::CopyFromProcess() returns a Boolean value to indicate if the expected data is found from the core file. MinidumpWriter can then decide how to handle that. BUG=chromium:453484 TEST=Run core2md with the test data attached to chromium:453484. R=mark@chromium.org Review URL: https://breakpad.appspot.com/4724002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1420 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Remove unused variable 'kGUIDStringSize' in microdump_writer_unittest.benchan@chromium.org2015-01-281-4/+0
| | | | | | | | R=mark@chromium.org Review URL: https://breakpad.appspot.com/3754002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1417 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Stop calling memmove when unnecessaryhashimoto@chromium.org2015-01-271-2/+4
| | | | | | | | | BUG=chromium:450137 R=mark@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1416 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix the scope on the initialization of kMicrodumpOnConsole to match header.primiano@chromium.org2015-01-091-1/+2
| | | | | | | | | | | I whish I knew how this worked for months in chromium as it is clearly wrong. As reported by azarchs@ it is breaking the cygprofile instrumented build. BUG=chromium:410294 Review URL: https://breakpad.appspot.com/1784002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1413 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Remove pointers from serialized file formatmdempsky@chromium.org2014-12-111-5/+9
| | | | | | | | | BUG=breakpad:621 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/1764002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1410 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Microdumps: support aarch64 and lib mapping from APKprimiano@chromium.org2014-12-022-10/+36
| | | | | | | | | | | | | | | | | | - Filter modules by prot flags (only +x) not extensions. It wouldn't otherwise catch the case of Chrome mapping the library from the apk (which is mapped r-x but doesn't end in .so). - Use compile-time detection of target arch, in order to cope with multilib OSes, where uname() doesn't reflect the run-time arch. - Add OS information and CPU arch / count. - Add support for aarch64. - Add tests and stackwalk expectations for aarch64. - Fix a potential overflow bug in the processor. - Rebaseline the tests using smaller symbols. - Fix microdump_writer_unittest.cc on 32-bit host. BUG=chromium:410294 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1407 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix microdump_writer and add unittest.primiano@chromium.org2014-11-252-10/+150
| | | | | | | | | | | | This adds some small fixes to the microdump writer and introduces a unittest. BUG=chromium:410294 R=mmandlis@chromium.org Review URL: https://breakpad.appspot.com/2814002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1404 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Introduce microdump writer class.primiano@chromium.org2014-10-287-21/+490
| | | | | | | | | | | | | | | | | | | Microdumps are a very lightweight variant of minidumps. They are meant to dump a minimal crash report on the system log (logcat on Android), containing only the state of the crashing thread. This is to deal with cases where the user has opted out from crash uploading but we still want to generate meaningful information on the device to pull a stacktrace for development purposes. Conversely to conventional stack traces (e.g. the one generated by Android's debuggerd or Chromium's base::stacktrace) microdumps do NOT require unwind tables to be present in the target binary. This allows to save precious binary size (~1.5 MB for Chrome on Arm, ~10 MB on arm64). More information and design doc on crbug.com/410294 BUG=chromium:410294 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1398 4c0a9323-5329-0410-9bdc-e9ce6186880e