aboutsummaryrefslogtreecommitdiff
path: root/src/client
Commit message (Collapse)AuthorAgeFilesLines
* linux_core_dumper: handle missing SIGSYS supportMike Frysinger2019-03-142-0/+8
| | | | | | | | | | | | If the kernel/C library headers are old, they might not have the fields needed for SIGSYS decoding. Add ifdef checks for that and skip the logic entirely. Easier than adding arch-specific siginfo structs to the codebase. Bug: google-breakpad:791 Change-Id: Ia473e3ffa61fce4c42cf4c1e73a9df044599bc5c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1524447 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: support setting exception_informationMike Frysinger2019-03-124-1/+76
| | | | | | | | | | | | | | Many signals in Linux support additional metadata on a per-signal basis. We can extract that from NT_SIGINFO and pass it through in the exception_information fields. The current core dumper logic doesn't set exception_information at all, so this is an improvement. Bug: google-breakpad:791 Change-Id: I38b78d6494e9bc682441750d98ac9be5b0656f5a Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1497662 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: add a fallback definition for NT_SIGINFOMike Frysinger2019-03-071-0/+1
| | | | | | | | | | When building on an old system with outdated headers, this define might not be available. Add a fallback to our existing elf header. Bug: google-breakpad:790 Change-Id: I4dfe7a5cebd414cca3582a1a9cfc983503d5a779 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1507073 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: support NT_SIGINFO for reading crashing addressMike Frysinger2019-03-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | The current core dumper only parses NT_PRSTATUS notes. With signal details, this note only includes three fields: signo, code, and errno. We set exception_code to signo and exception_flag to code. The errno value isn't set by the kernel, so there's no need to save it. However, we never fill in exception_address which means all converted crashes look like they happen at address 0. This implies a NULL jump which is usually not the case, so it's just confusing. The prstatus structure doesn't offer anything directly that tracks this. Starting with linux-3.7, the kernel writes out the full siginfo structure in the NT_SIGINFO note. So lets support that to pull out si_addr which, for a bunch of common signals, is the value we want in exception_address. The size of the siginfo_t structure should be locked to 128 bytes at build time for all architectures, so this should hopefully be stable. Bug: google-breakpad:790 Change-Id: I458bad4787b1a8b73fad8fe068e9f23bec957599 Reviewed-on: https://chromium-review.googlesource.com/c/1497661 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons, iOS edition.Nico Weber2019-02-251-1/+1
| | | | | | | Bug: chromium:926235 Change-Id: I237e7b7d89e5746beea80754675a232c881f25f6 Reviewed-on: https://chromium-review.googlesource.com/c/1487336 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons, mac edition.Nico Weber2019-02-225-7/+7
| | | | | | | Bug: chromium:926235 Change-Id: I473a7727c1831717b92a582c50d98256ea41d854 Reviewed-on: https://chromium-review.googlesource.com/c/1482716 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons.Nico Weber2019-02-211-1/+1
| | | | | | | Bug: chromium:926235 Change-Id: I7f0795ebd651303b6f7fb6981c2f639e17a536bb Reviewed-on: https://chromium-review.googlesource.com/c/1481232 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Delete deprecated SetFirstChanceExceptionHandler functionAndreas Haas2019-02-193-38/+0
| | | | | | | | | | | | | | | This CL removes the code I marked as deprecated in https://crrev.com/c/1411776. I could not delete the code in that CL before I removed all uses in Chrome in https://crrev.com/c/1411643. The tracking bug contains more information. R=mark@chromium.org Bug: chromium:921971 Change-Id: I77597826ef6e69a13ece529a5d24702bc72aa436 Reviewed-on: https://chromium-review.googlesource.com/c/1412353 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Introduce SetFirstChanceHandler with more strict signatureAndreas Haas2019-01-153-3/+40
| | | | | | | | | | | | | | | | | | | Eventually, I want to remove the current version of SetFirstChanceHandler. That is why I changed the name of the current callback type to FirstChanceHandlerDeprecated. I also made sure that it is not possible to have two different FirstChanceHandlers set at the same time. This is the first of a set of CLs to clean up the API between Chrome, BreakPad, and V8. See more information in the tracking bug. R=mark@chromium.org Bug: chromium:921971 Change-Id: Ia8c2fd9bd875c36dd7ae8bb4a02e538556bc67a1 Reviewed-on: https://chromium-review.googlesource.com/c/1411776 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Extract intruction pointer correctly for Windows ARM64Tom Tan2019-01-031-1/+3
| | | | | | | Bug: 893460 Change-Id: Ibbdf734e72c29c4779b6a701dceec1626056a9ba Reviewed-on: https://chromium-review.googlesource.com/c/1393763 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* Adds method to get the date of the most recent iOS crash report.Evan Bernstein2018-10-084-0/+63
| | | | | | | | Also adds method to determine if breakpad is started. Change-Id: I272765e7ac6bbc07d77ca2d8dcc34d51c205116e Reviewed-on: https://chromium-review.googlesource.com/c/1260625 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* win: fix formatting after 21c98747Joshua Peraza2018-08-271-1/+1
| | | | | | Change-Id: If50c3563fec7a8a9edf05c22f7d157201184df38 Reviewed-on: https://chromium-review.googlesource.com/1191671 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* win: replace a while loop with a for loopJoshua Peraza2018-08-271-1/+1
| | | | | | | | | This is the recommended resolution to warning C4127. https://msdn.microsoft.com/en-us/library/6t66728h.aspx Change-Id: Ifcffe68e21d9a6383bb9aef07503cbb034caca19 Reviewed-on: https://chromium-review.googlesource.com/1191661 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Fix Windows client_tests GYP build after 88d8114fda3eMark Mentovai2018-08-151-0/+1
| | | | | | | | Bug: google-breakpad:770 Change-Id: I5539cda6053c39a11c354fba7f3e689ae02d3019 Reviewed-on: https://chromium-review.googlesource.com/1176126 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Define and use a a new MDRawContextARM64Joshua Peraza2018-08-011-0/+10
| | | | | | | | | | | This struct matches the layout defined by Microsoft and replaces Breakpad's MDRawContextARM64_Old. This CL updates the processor to understand either the old or new structs, but clients continue to write the old structs. Change-Id: I8dedd9ddb2ec083b802723b9ac87beb18d98edbd Reviewed-on: https://chromium-review.googlesource.com/1155938 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Rename MDRawContextARM64 and its context flagsJoshua Peraza2018-08-016-11/+11
| | | | | | | | | | This makes way for the addition of a struct matching Microsoft's layout for ARM64. Change-Id: I115f25290863e7438852691d1ec3c9324a42f7a5 Reviewed-on: https://chromium-review.googlesource.com/1152158 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* mac: Fix broken xcode projectsJoshua Peraza2018-07-311-55/+51
| | | | | | Change-Id: I1cd8f0b0224c9b629dda720c11f6c081b175f8bd Reviewed-on: https://chromium-review.googlesource.com/1157121 Reviewed-by: Mark Mentovai <mark@chromium.org>
* ios: Fix build of exception_handler_no_machJoshua Peraza2018-07-091-1/+1
| | | | | | Change-Id: I2a9f85e78f6d3189f018824ad98e39af30d2ecf8 Reviewed-on: https://chromium-review.googlesource.com/1129465 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Initialize variables for MSANSergey Abbakumov2018-04-102-2/+2
| | | | | | | | | | The variables in the CL are not initialized. Even if it's safe not to initialize them here, MSAN doesn't know that. Bug: 394028 Change-Id: I597a7d76aa19d5789decd0f85150fa31c9655269 Reviewed-on: https://chromium-review.googlesource.com/1001573 Reviewed-by: Lei Zhang <thestig@chromium.org>
* Linux: Write out si_code for SIGBUS exceptions.Lei Zhang2018-04-035-11/+26
| | | | | | | | | Store the information in the exception record's exception_information field. Change-Id: Ie215cae2f070fdab63c3d05cc1bc4fb4b7b095fa Reviewed-on: https://chromium-review.googlesource.com/990799 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fixing incorrect include guard (missing #define)Daniel Bratell2018-02-231-0/+1
| | | | | | | | | Noticed while adding an include guard presubmit check in Chromium. Change-Id: I9e677412d881b32a58d695208045b575bb8f8be6 Reviewed-on: https://chromium-review.googlesource.com/934448 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix crash when an NSException is thrown.Adam Harrison2018-02-022-11/+10
| | | | | | | | old_handlers is zeroish whenever an NSException is thrown. This caused PROT_WRITE to never be set and resulted in an EXC_BAD_ACCESS when trying to set the handler to NULL. Change-Id: Ibb7da448204431c7602b1001f3a5216303c4c9d1 Reviewed-on: https://chromium-review.googlesource.com/899907 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Extend ifdef to include helper functionsLars Volker2018-01-311-2/+2
| | | | | | | | | | The previous change to fix compiling on Android < N forgot to include a helper in the ifdef, thus not fixing the problem. This change extends the ifdef to include all helpers used by the test. Change-Id: Ibb3030f54a81b5609a0b55ccef387a3cba22d088 Reviewed-on: https://chromium-review.googlesource.com/895240 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Remove barrier to fix Android build.Lars Volker2018-01-311-1/+3
| | | | | | | | | | | The unittest for #752 made use of pthread_barrier_t, which is not supported on Android. This change replaces the barrier code with a simple sleep, which proved sufficient to trigger the race. It only affects the test and does not affect the original fix for #752. Change-Id: I82c32cf00899176fa09089e716ed85850b8711e6 Reviewed-on: https://chromium-review.googlesource.com/895168 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Do not use non-standard stdext::checked_array_iterator with libc++.Peter Collingbourne2018-01-181-1/+1
| | | | | | | Bug: chromium:801780 Change-Id: Id1b0b2330d7d609bda62869bcda5bb2f6fde12bd Reviewed-on: https://chromium-review.googlesource.com/872458 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Only restore the signal handler if sigaction has not changedLars Volker2018-01-092-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restoring the signal handler in ExceptionHandler::SignalHandler() can lead to a race in scenarios where multiple threads crash within a short time. This can cause threads to alternately try to write a minidump without ever terminating the process. The first thread to write a minidump will reset the signal handler to the SIG_DFL using signal() in InstallDefaultHandler(). The next thread to execute SignalHandler() will detect this and will reset the signal handler to SignalHandler(). If the first thread takes too long to write its minidump (e.g. when there are many threads), the chances increase that the second thread will enter SignalHandler() before the first one leaves the critical section. After resetting the signal handler, the second thread will fail to write a minidump (since the file already exists) and will try to reset the signal handler to the default by calling RestoreHandlersLocked(). However, in the meantime the first thread will have entered SignalHandler() again and will overwrite it one more time. After that, no further attempts will be made to restore the default signal handler and both threads will continue to re-raise the signal and attempt to write minidump files. This change adds a check to make sure that cur_handler.sa_sigaction is still pointing to SignalHandler() before re-installing the handler. To test this we start a large number of sleeping threads and two threads that will crash simultaneously. Without the fix, this would reproducibly lead to a loop between the two crashing threads. Bug: 752 Change-Id: I784328cfff17ddc7476d6668354570ab867ba405 Reviewed-on: https://chromium-review.googlesource.com/855137 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Fix minidump on ChromeOSYunlian Jiang2017-12-201-8/+25
| | | | | | | | | | | | | Chrome somehow changed the memory mapping with hugepage enabled. This makes the hack in CrOSPostProcessMappings more general. BUG=chromium:793452 TEST=with this patch on Chromium, minidump_dump *dmp shows the right information on chrome Change-Id: Iff58bf1a712a6e66cbd2d813422db7549a3080a5 Reviewed-on: https://chromium-review.googlesource.com/837963 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Reconcile -[BreakpadController withBreakpadRef:] with its documentation.Robert Sesek2017-12-151-3/+1
| | | | | | | | | | The header states that if the controller is not -start:'ed that it will call the block with a NULL BreakpadRef. As previously implemented, it asserted if it was not started. Change-Id: I3a329a773c0484dc1b74013717b68426758ea2cd Reviewed-on: https://chromium-review.googlesource.com/829834 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Remove duplicate import.Adam Harrison2017-12-051-1/+0
| | | | | | | The mac exception_handler is included in a conditional below. Change-Id: I505fad7ef6731706a39b7aaacc9a948800fc3069 Reviewed-on: https://chromium-review.googlesource.com/809306 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Create LongStringDictionary and replace SimpleStringDictionary on iOSYi Wang2017-11-032-19/+29
| | | | | | | | | | | This relands fd0a0d2b7ae9dd3d8a02b6a12e7941f7189fbb6c which was reverted in 5dad29423e62292c6ff468cabfee4422ba55b18b, with a fix for guarding kMaxSuffixLength which only used in assert()s with macros which breaks chromium.mac/ios-device. Change-Id: I5ee21b7f290517d6e7a0ef90b693b97f92392549 Reviewed-on: https://chromium-review.googlesource.com/751922 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Don’t set exit_after_write to false for tvOS.Adam Harrison2017-11-031-0/+2
| | | | | | | | | On tvOS, the app fails to shutdown after write. Allow exit_after_write to be false for tvOS in order to force an exit() after write. Change-Id: Ib2e1e1d03264a2972f5607b3070f4a6287aa0a98 Reviewed-on: https://chromium-review.googlesource.com/752071 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Revert "Create LongStringDictionary and replace SimpleStringDictionary ↵Mark Mentovai2017-11-022-29/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | usages in client/ios/Breakpad.mm." This reverts commit fd0a0d2b7ae9dd3d8a02b6a12e7941f7189fbb6c. Reason for revert: Build failures reported at https://chromium-review.googlesource.com/c/chromium/src/+/750591#message-cc4f7dd486fa1da7373ad5d83d56f550d607d429 Failed build on chromium.mac/ios-device: https://build.chromium.org/p/chromium.mac/builders/ios-device/builds/73163, https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.mac%2Fios-device%2F73163%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout [637/3593] CXX obj/third_party/breakpad/client/long_string_dictionary.o FAILED: obj/third_party/breakpad/client/long_string_dictionary.o […] ../../third_party/breakpad/breakpad/src/common/long_string_dictionary.cc:46:16: error: unused variable 'kMaxSuffixLength' [-Werror,-Wunused-const-variable] const size_t kMaxSuffixLength = 4; ^ 1 error generated. […] [641/3593] CXX ios_clang_arm64/obj/third_party/breakpad/client/long_string_dictionary.o FAILED: ios_clang_arm64/obj/third_party/breakpad/client/long_string_dictionary.o ../../third_party/breakpad/breakpad/src/common/long_string_dictionary.cc:46:16: error: unused variable 'kMaxSuffixLength' [-Werror,-Wunused-const-variable] const size_t kMaxSuffixLength = 4; ^ 1 error generated. Change-Id: I285eaac6abfcb7d173a0d1e4998b92d5c8dd6ecb Reviewed-on: https://chromium-review.googlesource.com/751723 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix double declaration of tgkill when using Android NDK Headers.Nicholas Baldwin2017-10-301-7/+1
| | | | | | | | | | | | | As of Android API level 16 tgkill is declared in the NDK version of signal.h, which conflicts with the static definition found in src/client/linux/handler/exception_handler.cc. This change removes the static tgkill definition and replaces its use with sys_tgkill from the linux syscall support library. Bug: Change-Id: Ic70addd8a064cfa36345d86b7e36409e2089e909 Reviewed-on: https://chromium-review.googlesource.com/738912 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Create LongStringDictionary and replace SimpleStringDictionary usages in ↵Yi Wang2017-10-272-19/+29
| | | | | | | | | client/ios/Breakpad.mm. Bug: Change-Id: I401028f5d90417d79fb109b510aaa9660a039b44 Reviewed-on: https://chromium-review.googlesource.com/688301 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Move main executable handling out of procmaps parser loop.Peter Collingbourne2017-10-171-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | If the mapping for the main executable needed to be merged (for example, if it was linked with lld and therefore contains an r mapping followed by an r/x mapping), we would never reach the code that makes it the first module. Handle that situation by moving that code into a separate loop. This fixes an issue where breakpad_unittests fails on Android devices when linked with lld. It appears that the glibc dynamic loader happens to always load executables (or at least the executables that we create) at a lower address than DSOs, so we never hit this bug on desktop Linux. Testing: "make check" with both gold and lld as linker. Also breakpad_unittests when patched into Chromium on Linux (lld) and Android (gold and lld). Bug: chromium:469376 Change-Id: I6329e4afd2f1bf44c25a6c3e684495e21dba83a6 Reviewed-on: https://chromium-review.googlesource.com/722286 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Rename src/common/memory.h to memory_allocator.h.Ted Mielczarek2017-10-177-7/+7
| | | | | | | | | | | | memory.h shadows a system header which normally isn't a problem because of the include paths in Breakpad, but the Firefox build system winds up with src/common in the include path so we've had a workaround for this for years. Renaming the file lets us get rid of that workaround and shouldn't hurt anything. Change-Id: I3b7c4239dc77f3b2b7cf2b572a0cad88cd7e8522 Reviewed-on: https://chromium-review.googlesource.com/723261 Reviewed-by: Mark Mentovai <mark@chromium.org>
* ios: Adds a no-Mach exception handlerAdam Harrison2017-10-123-0/+447
| | | | | | | | | | This exception_handler_no_mach does not use Mach for exception handling so that clients such as tvOS and watchOS that do not support mach messages can handle POSIX signals. Change-Id: I4a4574e58834bc590e110e6ecd1825f8af1437a2 Reviewed-on: https://chromium-review.googlesource.com/714276 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix MSVC build on 64-bitOrgad Shaneh2017-09-253-5/+5
| | | | | | | | | | | Mostly int<->size_t implicit conversions. Warning 4366 (The result of the unary '&' operator may be unaligned) appears in minidump.cc:907, but I don't know why. It looks aligned to me. Change-Id: I641942adc324f8f9832b20662083dc83498688a8 Reviewed-on: https://chromium-review.googlesource.com/637390 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Replace remaining references to 'struct ucontext' with 'ucontext_t'Mark Mentovai2017-09-206-33/+33
| | | | | | | | | | | | | | | | | This relands https://chromium.googlesource.com/breakpad/breakpad/src/+/e3035bc406cee8a4d765e59ad46eb828705f17f4, which was accidentally committed to breakpad/breakpad/src, the read-only mirror of src in breakpad/breakpad. (Well, it should have been read-only.) See https://crbug.com/766164. This fixes issues with glibc-2.26. See https://bugs.gentoo.org/show_bug.cgi?id=628782 , https://sourceware.org/git/?p=glibc.git;h=251287734e89a52da3db682a8241eb6bccc050c9 , and https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html for context. Change-Id: Id66f474d636dd2afa450bab925c5514a800fdd6f Reviewed-on: https://chromium-review.googlesource.com/674304 Reviewed-by: Mark Mentovai <mark@chromium.org>
* drop bundled gflags from the checkoutMike Frysinger2017-09-131-1/+2
| | | | | | | | | | | | The only code using gflags is google_crash_report_sender, and nothing builds or tests that code currently. Switch it over to using system versions of gflags so we can drop the local prebuilts. Tested local builds by hand of the tool. Bug: google-breakpad:360 Change-Id: I75d79b176468c948773079a54d87e70709feaf87 Reviewed-on: https://chromium-review.googlesource.com/665799 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add crash reason and address to microdumps.Tobias Sargeant2017-08-144-0/+111
| | | | | | | | | | | | This will allow us to provide the right information for webview renderer crashes. At the moment the crash information for the browser process is captured (from the debuggerd output) instead. BUG=754715 Change-Id: I409546311b6e38fe1cf804097c18d7bb2a015d83 Reviewed-on: https://chromium-review.googlesource.com/612381 Reviewed-by: Robert Sesek <rsesek@chromium.org>
* A couple of minor fixesLeonard Mosescu2017-07-111-1/+1
| | | | | | | | | | | | | | | | 1. Fixing ExceptionHandlerTest.FirstChanceHandlerRuns: exit() is not an async-signal-safe function (http://man7.org/linux/man-pages/man7/signal-safety.7.html) 2. Fixing entry point signature in minidump_dump Changed "const char* argv[]" to "char* argv[]" to match the standard entry point signature 3. Updating .gitignore to exclude unit test artifacts Change-Id: I9662898d0bd97769621fb6476a720105821c60f0 Reviewed-on: https://chromium-review.googlesource.com/562356 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Ivan Penkov <ivanpe@chromium.org> Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* Fix asan buildsEric Holk2017-06-221-23/+23
| | | | | | | | | | | | | When rolling this into Chrome, we got compile failures due to DoNullPointerDereference being undefined but the new FirstChanceHandlerRuns tests depends on this and was still defined. The fix is to only enable the FirstChanceHandlerRuns test on non-asan builds. Bug: Change-Id: I5a3da0a21e2d0dd663ffc01137496d16905293a6 Reviewed-on: https://chromium-review.googlesource.com/544186 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add first chance exception handler APIEric Holk2017-06-193-0/+44
| | | | | | | | | | | | | | This change adds the option for Breakpad hosts to register a callback that gets the first chance to handle an exception. The handler will return true if it handled the exception and false otherwise. The primary use case is V8's trap-based bounds checking support for WebAssembly. Bug: Change-Id: I5aa5b87d1229f1cef905a00404fa2027ee86be56 Reviewed-on: https://chromium-review.googlesource.com/509994 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Merge exec and non-exec segments while merging executable bit.Peter Collingbourne2017-05-261-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bfd and gold linkers create segments like this: r/x, r/w where the r/x segment covers the start of the ELF file. lld's segments look like this: r, r/x, r/w where the r segment covers the start of the ELF file. So we cannot rely on the location of the r/x to tell where the start of the ELF is. But we can still rely on the r and r/x mappings being adjacent. So what we do is when we see an r segment followed by an r/x, merge the r into the r/x and claim that it is executable. This way, the minidump writer will continue to see a single executable segment covering the entire executable. Testing: "make check" passes when breakpad is compiled with lld compiled from trunk (requires bug fix from LLVM r303689). Also patched change into chromium and tested these builds: $ cat args.gn is_chrome_branded = true is_debug = false is_official_build = true use_lld = true allow_posix_link_time_opt = false is_cfi = false $ cat args.gn target_os = "android" target_cpu = "arm" is_debug = false is_official_build = true is_chrome_branded = true With both builds breakpad_unittests passes and chrome/chrome_modern_public_apk create good minidumps after navigating to chrome://inducebrowsercrashforrealz (checked that minidump contains stack trace entry for content::HandleDebugURL). Bug: chromium:716484 Change-Id: Ib6ed3a8420b83acf4a5962843930fb006734cb95 Reviewed-on: https://chromium-review.googlesource.com/513610 Reviewed-by: Primiano Tucci <primiano@chromium.org>
* Don't attempt to use PTRACE_GETREGS if it isn't defined.John Budorick2017-05-251-1/+5
| | | | | | | | | | | Follow up to https://chromium-review.googlesource.com/c/484479/, which does not compile on arm64. Bug: chromium:725754 Change-Id: Iaa6fbc332564909a10e2602a1026c14fb25625f4 Reviewed-on: https://chromium-review.googlesource.com/515044 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Simplify ELF parser code.Peter Collingbourne2017-05-251-5/+4
| | | | | | | | | | | | | The layout of Elf32_Nhdr and Elf64_Nhdr is the same, so remove templating and code that extracts the elfclass from the ELF file. Testing: "make check" and breakpad_unittests when patched into chromium. Bug: chromium:716484 Change-Id: I41442cfff48afc6ae1a5b604d22b67550a910376 Reviewed-on: https://chromium-review.googlesource.com/514450 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Use __NR_exit_group in MinidumpWriterTest.MinidumpStacksSkippedIfRequested.John Budorick2017-05-241-10/+24
| | | | | | | | | Also adds waits for all child processes spawned in MinidumpWriterTest. Bug: 725754 Change-Id: I3248925993dede2c113ab1989b322a9d9c8f24bd Reviewed-on: https://chromium-review.googlesource.com/513480 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix race in ExceptionHandler::GenerateDump()Lars Volker2017-05-101-3/+9
| | | | | | | | | | | | | | | | | | | | | When writing a minidump on Linux, we called clone() in linux/handler/exception_handler.cc with the CLONE_FILES flag. If the parent process died while the child waited for the continuation signal, the write side of the pipe 'fdes' stayed open in the child. The child would not receive a SIGPIPE and would wait forever. To fix this, we clone without CLONE_FILES and then close the read-side of fdes in the master before the ptrace call. That way, if the master dies, the child will receive a SIGPIPE and will die, too. To test this I added a sleep() call before SendContinueSignalToChild() and then killed the master, manually observing that the child would die, too. Bug: 728 Change-Id: Ifd72de835a34e7d9852ae1a362e707fdc6c96c7e Reviewed-on: https://chromium-review.googlesource.com/464708 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Fixing breakpad on old linux kernelAndrew Ermakovich2017-04-212-29/+53
| | | | | | | | | | Try to read the trace's registers by PTRACE_GETREGS if kernel doesn't support PTRACE_GETREGSET. Bug: Change-Id: I881f3a868789747ca217f22a93370c6914881f9a Reviewed-on: https://chromium-review.googlesource.com/484479 Reviewed-by: Mike Frysinger <vapier@chromium.org>