summaryrefslogtreecommitdiff
path: root/debuggerd/debuggerd_test.cpp
AgeCommit message (Collapse)Author
2018-01-18debuggerd: add seccomp policies and tests.Josh Gao
Bug: http://b/38508369 Test: debuggerd_test32/64 on walleye and aosp_x86_64 Change-Id: I7e69e37bcd1823d271b9f2b0a13b8c9cba9a8e84
2017-12-19base: extract {ASSERT,EXPECT}_MATCH helpers from debuggerd_test.Josh Gao
Add some helper macros that perform regex string matching to <android-base/test_utils.h>. Test: libbase_test32/64 on host Change-Id: I1b0f03dc73f8b4fdfb8ac6c75d59ef421e0e9640
2017-12-15crash_dump: fork a copy of the target's address space.Josh Gao
Reduce the amount of time that a process remains paused by pausing its threads, fetching their registers, and then performing unwinding on a copy of its address space. This also works around a kernel change that's in 4.9 that prevents ptrace from reading memory of processes that we don't have immediate permissions to ptrace (even if we previously ptraced them). Bug: http://b/62112103 Bug: http://b/63989615 Test: treehugger Change-Id: I7b9cc5dd8f54a354bc61f1bda0d2b7a8a55733c4
2017-11-03crash_dump: don't inherit environment from parent.Josh Gao
Bug: http://b/68381717 Test: debuggerd_test Change-Id: Ie1b342bc9901cb9ae9b79147899928a19052cbad
2017-10-11Add missing includes.Dan Albert
Test: mma Bug: None Change-Id: I5ee2d09eeac2b4e2056719498916cbdfb79725d2
2017-08-18crash_dump: print the identity of tracers.Josh Gao
Instead of printing a useless "ptrace attach failed: strerror(EPERM)" message, print the name and pid of a competing tracer when we fail to attach because a process is already being ptraced. Bug: http://b/31531918 Test: debuggerd_test32, debuggerd_test64 on aosp_angler Test: strace -p `pidof surfaceflinger`; debuggerd -b surfaceflinger Change-Id: Ifd3f80fe03de30ff38c0e0068560a7b12875f29d
2017-06-22Debuggerd: Fix debuggerd_testAndreas Gampe
Follow-up to commit 695713e931f0436aca56be9c0dacf2a5dd4e56e7 in bionic. Change expectations of the abort callstack. Test: mmma system/core/debuggerd Test: adb shell /data/nativetest/debuggerd_test/debuggerd_test32 Test: adb shell /data/nativetest64/debuggerd_test/debuggerd_test64 Change-Id: I350a29ee1713a7ebdd50f2b9bdc2078c671e22c7
2017-06-16debuggerd_test: find backtrace frame in all lines in CrasherTestJaesung Chung
Kernel can use vsyscall for system calls. The vsyscall implementation in the kernel gives one more depth in the backtrace. It leads to failures on CrasherTest. This CL makes tests find a system call frame not only in the first line but also in all lines on the backtrace. Bug: 62600694 Test: passes all CrasherTests. Change-Id: Ice383bb94db097e7e9a9e4f74d8fa5ecc528122a
2017-06-07tombstoned: turn on java trace support + unit tests.Narayan Kamath
The SELinux changes that this depends on have now landed. This change also adds a few lower level unit tests of intercept functionality. Test: make; debuggerd_test Change-Id: I0be5e85e7097e26b71db269c9ed92d9b438bfb28
2017-06-01debuggerd_client: increase pipe buffer size to max.Josh Gao
If a process tries to dump itself (e.g. system_server during ANRs), crash_dump will block trying to write to its pipe if it's not sufficiently large. Increase the pipe size to the max, and add a test to make sure that it's always at least 1MB (the default value). Bug: http://b/38427757 Test: debuggerd_test Change-Id: Iddb0cb1e5ce9e687efa9e94c2748a1edfe09f119
2017-05-31tombstoned: allow intercepts for java traces.Narayan Kamath
All intercept requests and crash dump requests must now specify a dump_type, which can be one of kDebuggerdNativeBacktrace, kDebuggerdTombstone or kDebuggerdJavaBacktrace. Each process can have only one outstanding intercept registered at a time. There's only one non-trivial change in this changeset; and that is to crash_dump. We now pass the type of dump via a command line argument instead of inferring it from the (resent) signal, this allows us to connect to tombstoned before we wait for the signal as the protocol requires. Test: debuggerd_test Change-Id: I189b215acfecd08ac52ab29117e3465da00e3a37
2017-05-22tombstoned: Add a shared library version of libtombstoned_client...Narayan Kamath
.. for ART and the frameworks to link against. In the new stack dumping scheme (see related bug), the Java runtime will communicate with tombstoned in order to obtain a FD to which it can write its traces. Also move things around to separate headers that are private implementation details from headers that constitute the public debuggerd API. There are currently only three such headers : - tombstoned/tombstoned.h - debuggerd/client.h - debuggerd/handler.h Bug: 32064548 Test: make Change-Id: If1b8578550e373d84828b180bbe585f1088d1aa3
2017-05-05debuggerd_handler: use syscall(__NR_get[pt]id) instead of get[pt]id.Josh Gao
bionic's cached values for getpid/gettid can be invalid if the crashing process manually invoked clone to create a thread or process, which will lead the crash_dump refusing to do anything, because it sees the actual values. Use the getpid/gettid syscalls directly to ensure correct values on this end. Bug: http://b/37769298 Test: debuggerd_test Change-Id: I0b1e652beb1a66e564a48b88ed7fa971d61c6ff9
2017-04-27debuggerd_handler: don't assume that abort message implies fatal.Josh Gao
Applications can set abort messages via android_set_abort_message without actually aborting. This leads to following non-fatal dumps printing their output to logcat in the same format as a regular crash. Bug: http://b/37754992 Test: debuggerd_test Change-Id: I9c5e942984dfda36448860202b0ff1c2950bdd07
2017-04-05Merge changes Ib8369088,I743433bcJosh Gao
* changes: debuggerd_test: remove useless pipe. debuggerd_client: fix infinite timeouts.
2017-04-04debuggerd_test: remove useless pipe.Josh Gao
Bug: http://b/36897117 Test: none Change-Id: Ib8369088153fe44de2af9037299bdfce7b709b98
2017-04-03debuggerd_test: add test for process/thread names.Josh Gao
Make sure that we can get the process/thread names for nondumpable processes with capabilities. Bug: http://b/36237221 Test: /data/nativetest/debuggerd_test/debuggerd_test32 Change-Id: Iedd4eae18065c2e64abeebff15e3b9b09a630550
2017-03-30tombstoned: add tests for b/36685795.Josh Gao
Add some tests for edge cases which may have triggered b/36685795. Bug: http://b/36685795 Test: debuggerd_test Change-Id: I20670684c8dae422af157be21e44ba5d6d3214d3
2017-03-30tombstoned: fix a race between intercept and crash_dump.Josh Gao
Previously, there was no way to detect when tombstoned processed an intercept request packet, making it possible for a intercept request followed by a crash_dump being processed in the wrong order. Add a response to intercept registration, to eliminate this race. Test: debuggerd_test Change-Id: If38c6d14081ebc86ff1ed0edd7afaeafc40a8381
2017-02-17debuggerd_test: add capability test.Josh Gao
Also, remove the dependency on crasher. Bug: http://b/35100921 Bug: http://b/35241370 Test: /data/nativetest/debuggerd_test/debuggerd_test32 Test: /data/nativetest64/debuggerd_test/debuggerd_test64 Change-Id: I318f6de764d435251417953bf175ba321b59981f
2017-02-13debuggerd_handler: don't use waitpid(..., __WCLONE).Josh Gao
waitpid(..., __WCLONE) fails with ECHILD when passed an explicit PID to wait for. __WALL and __WCLONE don't seem to be necessary when waiting for a specific pid, so just pass 0 in the flags instead. Bug: http://b/35327712 Test: /data/nativetest/debuggerd_test/debuggerd_test32 --gtest_filter="*zombie*" Change-Id: I3dd7a1bdf7ff35fdfbf631429c089ef4e3172855
2017-02-07debuggerd_test: improve error when crasher fails to exec.Josh Gao
Bug: http://b/35100742 Test: rm /system/bin/crasher && /data/nativetest/debugerd_test/debuggerd_test32 Change-Id: I02faec3b7f7ef62bb8a2ac2af730506e3d28e03e
2017-02-07debuggerd_test: fix crasher path.Josh Gao
https://android-review.googlesource.com/#/c/331200 moved crasher to using soong, which changed its location from /system/xbin/crasher to /system/bin/crasher. Bug: http://b/35100742 Test: /data/nativetest/debuggerd_test/debuggerd_test32 Test: /data/nativetest64/debuggerd_test/debuggerd_test64 Change-Id: I16a2050b257277023773cc0c960b5ab36e0c7cd4
2017-01-23debuggerd_handler: properly crash when PR_GET_DUMPABLE is 0.Josh Gao
Actually exit when receiving a signal via kill(2) or raise(2) and PR_GET_DUMPABLE is 0. Bug: none Test: /data/nativetest/debuggerd_test/debuggerd_test32 Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=pthread_DeathTest.pthread_mutex_lock_null_64 Change-Id: I833a2a34238129237bd9f953959ebda51d8d04d7
2017-01-23crash_dump: set a watchdog timer.Josh Gao
PTRACE_DETACH is only necessary if the process is in group-stop state, the tracer exiting is sufficient to detach and resume tracees. Using this, set a 5 second timer with alarm(2) that just kills us, to avoid leaving processes stopped. Bug: http://b/34472671 Test: debuggerd_test Test: crasher + manually inserting a 10 second sleep into crash_dump Change-Id: Iacaa796f79037aa1585f3f2159abe45ef0069311
2017-01-17debuggerd: advance our amazing bet.Josh Gao
Remove debuggerd in favor of a helper process that gets execed by crashing processes. Bug: http://b/30705528 Test: debuggerd_test Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906