Commit graph

521 commits

Author SHA1 Message Date
Elliott Hughes
69541606c1 Merge "Add a fortify test to crasher." am: e674d32d2d
am: 4434b42cd0

* commit '4434b42cd0bd36be4ca7702e840886f67daaff2d':
  Add a fortify test to crasher.

Change-Id: I3b8b473aa256b7de7ca5e50e14b32d0c3b0565e1
2016-05-11 17:59:47 +00:00
Elliott Hughes
23d1cad9e0 Add a fortify test to crasher.
Change-Id: I675dbeaa39529583be5877946fd38b94ec341315
2016-05-10 14:44:59 -07:00
Christopher Ferris
8b474de4ac Set groups before dropping privileges.
The code for dumping tombstones tries to read the log data. This was
silently failing after the change to drop root privileges. Fix this
by explicitly setting the groups allowed before dropping privileges.

Bug: 28590884
(cherry picked from commit edc2380109)

Change-Id: I225365edccb11f8752027566fd42f3b10ce10260
2016-05-05 15:47:16 -07:00
Christopher Ferris
f89a23f27b Merge "Set groups before dropping privileges." into nyc-dev
am: fd1eee58f9

* commit 'fd1eee58f985b3d528ca352ff278d7b200390ab2':
  Set groups before dropping privileges.

Change-Id: I85c98abb0e7cc3b36ec714899540d65e6ca908c7
2016-05-05 21:57:30 +00:00
Christopher Ferris
fd1eee58f9 Merge "Set groups before dropping privileges." into nyc-dev 2016-05-05 21:49:43 +00:00
Christopher Ferris
512af70bc4 Merge "Fix null pointer dereference." into nyc-dev
am: dac26a76c3

* commit 'dac26a76c313b21b98d2b3d3ddcb6e824a78e233':
  Fix null pointer dereference.

Change-Id: If306266358eaaec46e34e5a5954a3a2323a02d7d
2016-05-05 21:23:36 +00:00
Christopher Ferris
157f2725ec Fix null pointer dereference.
In the function dump_thread_info, if /proc/<PID>/comm is unreadable, then
threadname will be used in a strncmp causing a crash. The fix is to
avoid the check if threadname is null.

Bug: 28615417
(cherry picked from commit 039976e553)

Change-Id: I1e61431b1549ecfdc49a72cbf193a364069cda79
2016-05-05 14:21:25 -07:00
Christopher Ferris
dac26a76c3 Merge "Fix null pointer dereference." into nyc-dev 2016-05-05 21:19:52 +00:00
Christopher Ferris
039976e553 Fix null pointer dereference.
In the function dump_thread_info, if /proc/<PID>/comm is unreadable, then
threadname will be used in a strncmp causing a crash. The fix is to
avoid the check if threadname is null.

Bug: 28615417
Change-Id: I54eda86404c927dbf5a987f5dd2108487df9f16c
2016-05-05 11:21:11 -07:00
Christopher Ferris
edc2380109 Set groups before dropping privileges.
The code for dumping tombstones tries to read the log data. This was
silently failing after the change to drop root privileges. Fix this
by explicitly setting the groups allowed before dropping privileges.

Bug: 28590884
Change-Id: Iaccb1d2928268fc9fc855f6e3814c31ce019badf
2016-05-05 11:13:50 -07:00
Christopher Ferris
e423c24f74 Merge "Fix problem with wait_for_gdb." into nyc-dev
am: a7431cfa57

* commit 'a7431cfa570c6385ecd2041d56ead2603d7b7b80':
  Fix problem with wait_for_gdb.

Change-Id: I6d995c423f4ad9134965a215b1eea4cc7fd338b9
2016-05-05 17:55:41 +00:00
Christopher Ferris
99235e9967 Fix problem with wait_for_gdb.
When someone enables wait_for_gdb, activity manager will kill the
stopped process before a developer can attach to the process. To
allow debugging in this case, change the code to only contact the
activity manager right before continuing the process that is
crashing.

Also, modify the conditions under which to do a gdb attach. The previous
code did a partial attach if perform_dump failed. The new version simply
allows an attach regardless of whether perform_dump passes or fails.

Bug: 28409358
(cherry picked from commit 9818bd2bbe)

Change-Id: I42f464b69332748e16b07d9d00f44b3aa26ce8b7
2016-05-05 10:50:39 -07:00
Christopher Ferris
9818bd2bbe Fix problem with wait_for_gdb.
When someone enables wait_for_gdb, activity manager will kill the
stopped process before a developer can attach to the process. To
allow debugging in this case, change the code to only contact the
activity manager right before continuing the process that is
crashing.

Also, modify the conditions under which to do a gdb attach. The previous
code did a partial attach if perform_dump failed. The new version simply
allows an attach regardless of whether perform_dump passes or fails.

Bug: 28409358
Change-Id: I4fe8d390c212d47e007cbe6543c2d114c3c7aeff
2016-05-04 17:42:30 -07:00
Christopher Ferris
1ba92f874a Connect to activity manager as root.
am: 0fc89f3

* commit '0fc89f34b99f20f0ebc0111df74490f4ebd44076':
  Connect to activity manager as root.

Change-Id: I28ad7d209d6d94be790bd4ffd1e5b31da4cd8589
2016-04-20 21:58:06 +00:00
Christopher Ferris
8fb38ae82d Connect to activity manager as root.
Before dropping root privileges, connect to the activity manager.
Also, only connect to the activity manager if this is a crash.

Bug: 28210681
(cherry picked from commit 0fc89f34b9)

Change-Id: Id25b92e550d71ffe1b9eafe43976ef514a83714b
2016-04-20 14:38:44 -07:00
Christopher Ferris
0fc89f34b9 Connect to activity manager as root.
Before dropping root privileges, connect to the activity manager.
Also, only connect to the activity manager if this is a crash.

Bug: 28210681
Change-Id: Ie266031910519fa2aa6835644a95c1fc56e24d8d
2016-04-20 11:30:33 -07:00
Josh Gao
70335deb59 debuggerd: set the name of the signal sender.
Bug: http://b/27925028
Change-Id: I6bff938e229d2368250d4b5c268fa24bd4badea0
(cherry picked from commit f3dde2f869)
2016-03-30 14:22:41 -07:00
Josh Gao
470df1b904 Merge "debuggerd: set the name of the signal sender." am: 3d0a87b
am: 437911e

* commit '437911ec87fe471a4cbe7e3dfa722e11d3187805':
  debuggerd: set the name of the signal sender.

Change-Id: I23723649fcc33a624f4aba80cde81f1bbb71fc3b
2016-03-30 19:15:39 +00:00
Josh Gao
f3dde2f869 debuggerd: set the name of the signal sender.
Change-Id: I6bff938e229d2368250d4b5c268fa24bd4badea0
2016-03-29 17:56:47 -07:00
Josh Gao
dac593937f debuggerd: add SIGSYS to the list of handled signals.
am: dfa163d

* commit 'dfa163df500ca71b71be315aa55e8859c946d0fb':
  debuggerd: add SIGSYS to the list of handled signals.
2016-03-26 01:16:25 +00:00
Josh Gao
dfa163df50 debuggerd: add SIGSYS to the list of handled signals.
Processes using seccomp will get SIGSYS when attempting to use a
disallowed syscall. We're currently not handling SIGSYS in bionic's
signal handler, but this change will let us dump a backtrace pointing at
rt_tgsigqueueinfo in our signal handler if seccomp policies block it
during a real crash.

Bug: http://b/27853687
Change-Id: I4e4aacc95eeef7249d895e19dc4ccd77a51c7a17
2016-03-25 14:34:22 -07:00
Josh Gao
6eb4eab106 debuggerd: waitpid for all children, and log the result.
Change-Id: Ic575e6db76ab153b4b238589a8cd299812d0e046
(cherry picked from commit 2808005521)
2016-03-23 14:28:01 -07:00
Josh Gao
a6219eae8d debuggerd: always send SIGCONT after detaching.
Bug: http://b/27330889
Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037
(cherry picked from commit 24464185eb)
2016-03-23 14:27:57 -07:00
Josh Gao
8aeabe15dd Merge "debuggerd: waitpid for all children, and log the result." 2016-03-23 21:10:38 +00:00
Josh Gao
6e183586e3 Merge "debuggerd: always send SIGCONT after detaching." 2016-03-23 21:09:21 +00:00
Josh Gao
2808005521 debuggerd: waitpid for all children, and log the result.
Change-Id: Ic575e6db76ab153b4b238589a8cd299812d0e046
2016-03-23 14:07:58 -07:00
Josh Gao
24464185eb debuggerd: always send SIGCONT after detaching.
Bug: http://b/27330889
Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037
2016-03-23 14:07:58 -07:00
Elliott Hughes
ae38923c3e Switch debuggerd over to unique_fd.
Change-Id: I858b9ac6a3ed47b4cc81cfe49f1ceb1e06356a03
2016-03-22 20:03:13 -07:00
Josh Gao
e59c76ab62 debuggerd: don't apply timeout when wait_for_gdb is on.
Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9
(cherry picked from commit 676a756b7b)
2016-03-17 15:33:24 -07:00
Josh Gao
676a756b7b debuggerd: don't apply timeout when wait_for_gdb is on.
Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9
2016-03-17 15:29:00 -07:00
Josh Gao
965d6f4d17 debuggerd: don't send SIGSTOP to crashing processes.
This was actually nonfunctional until f5e8f0b, because it was using kill
after privileges were dropped. This doesn't seem necessary after the
changes to the sibling thread ptrace logic, though.

Bug: http://b/27427439
Change-Id: I6bffbc14e0cf5e377bbfa39c945518e0d436c223
(cherry picked from commit b17f228ff6)
2016-03-17 14:15:01 -07:00
Josh Gao
b17f228ff6 debuggerd: don't send SIGSTOP to crashing processes.
This was actually nonfunctional until f5e8f0b, because it was using kill
after privileges were dropped. This doesn't seem necessary after the
changes to the sibling thread ptrace logic, though.

Bug: http://b/27427439
Change-Id: I6bffbc14e0cf5e377bbfa39c945518e0d436c223
2016-03-17 13:47:48 -07:00
Josh Gao
a951f4ca55 debuggerd: fix stupid typo.
Change-Id: Icd9a25a71e1e8580a200fe68bce0b17d09c51642
2016-03-17 13:23:41 -07:00
Josh Gao
1b301836bb debuggerd: fix stupid typo.
Change-Id: Icd9a25a71e1e8580a200fe68bce0b17d09c51642
2016-03-17 13:21:56 -07:00
Josh Gao
036ff2ce83 debuggerd: monitor the worker process for failure.
Use sigtimedwait on SIGCHLD to watch our forked worker processes for
failure, so that we can guarantee that we always resume/kill the target
process if libunwind crashes.

Bug: http://b/27427439
Change-Id: I5a5da1f1abd7dc9d01223f5b3778e946e2d47d20
(cherry picked from commit 630bc80e18)
2016-03-17 13:11:08 -07:00
Josh Gao
e5dbdd09c7 debuggerd: fork the signal sender once.
Bug: http://b/27427439
Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66
(cherry picked from commit f5e8f0b9cd)
2016-03-17 13:11:05 -07:00
Elliott Hughes
1a69e2811e Clean up CLOEXEC in debuggerd.
Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765
(cherry picked from commit 17ba68d0cd)
2016-03-17 13:11:01 -07:00
Elliott Hughes
aa41756851 Remove dead code from debuggerd.
system/core/debuggerd/debuggerd.cpp:683:5: warning: Value stored to 'logsocket' is never read
    logsocket = -1;
    ^           ~~

Bug: http://b/27264392
Change-Id: I8eab8a02b67f219c32aea49e4d4957e5642df38f
(cherry picked from commit 6da1353863)
2016-03-17 13:10:58 -07:00
Josh Gao
630bc80e18 debuggerd: monitor the worker process for failure.
Use sigtimedwait on SIGCHLD to watch our forked worker processes for
failure, so that we can guarantee that we always resume/kill the target
process if libunwind crashes.

Bug: http://b/27427439
Change-Id: I5a5da1f1abd7dc9d01223f5b3778e946e2d47d20
2016-03-17 11:43:55 -07:00
Josh Gao
f5e8f0b9cd debuggerd: fork the signal sender once.
Bug: http://b/27427439
Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66
2016-03-17 11:27:31 -07:00
Josh Gao
bcb58e6d64 debuggerd: kill crashing processes with the signal they died with.
Bug: http://b/27675306
Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2
(cherry picked from commit 561497c0a8)
2016-03-16 16:16:41 -07:00
Josh Gao
561497c0a8 debuggerd: kill crashing processes with the signal they died with.
Bug: http://b/27675306
Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2
2016-03-16 16:10:48 -07:00
Josh Gao
48972c80d9 Merge "debuggerd: make sure that we kill the process after dumping." into nyc-dev 2016-03-10 22:32:34 +00:00
Christopher Ferris
c463ba45c4 Add error reporting mechanism for failing Unwind.
Remove the logging of an error if a thread disappears before the unwind
can begin. This can happen, so allow the caller to determine if this
is really a problem worth logging.

Bug: 27449879

(cherry picked from commit 206a3b9798)

Change-Id: If9e7cfeb6eb7b122679a734c1a9eacee8354ef18
2016-03-10 14:14:43 -08:00
Christopher Ferris
3f9c22c34c Merge "Add error reporting mechanism for failing Unwind." 2016-03-10 22:12:35 +00:00
Christopher Ferris
206a3b9798 Add error reporting mechanism for failing Unwind.
Remove the logging of an error if a thread disappears before the unwind
can begin. This can happen, so allow the caller to determine if this
is really a problem worth logging.

Bug: 27449879
Change-Id: Ie81718d53fb0e519fa0a7db9fd5f314b72bfa431
2016-03-10 12:39:15 -08:00
Josh Gao
c6348f4e7f debuggerd: make sure that we kill the process after dumping.
Bug: http://b/27367422
Change-Id: Icd704b1effd558904975cfc524714b51917a653f
(cherry picked from commit f0c8723bdd)
2016-03-09 16:23:44 -08:00
Josh Gao
f0c8723bdd debuggerd: make sure that we kill the process after dumping.
Bug: http://b/27367422
Change-Id: Icd704b1effd558904975cfc524714b51917a653f
2016-03-09 15:59:27 -08:00
Elliott Hughes
dbab798695 Merge "Clean up CLOEXEC in debuggerd."
am: f405d245eb

* commit 'f405d245eb1288c8085cfdeaa3e02b4af707c4f1':
  Clean up CLOEXEC in debuggerd.
2016-02-23 18:46:21 +00:00
Elliott Hughes
17ba68d0cd Clean up CLOEXEC in debuggerd.
Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765
2016-02-19 18:13:02 -08:00
Elliott Hughes
bdf9d18c34 Merge "Remove dead code from debuggerd."
am: fbaefc4d9d

* commit 'fbaefc4d9d4e7e40ec0262123cd54762b81ed47a':
  Remove dead code from debuggerd.
2016-02-19 19:42:29 +00:00
Elliott Hughes
fbaefc4d9d Merge "Remove dead code from debuggerd." 2016-02-19 19:36:22 +00:00
Elliott Hughes
6da1353863 Remove dead code from debuggerd.
system/core/debuggerd/debuggerd.cpp:683:5: warning: Value stored to 'logsocket' is never read
    logsocket = -1;
    ^           ~~

Bug: http://b/27264392
Change-Id: I8eab8a02b67f219c32aea49e4d4957e5642df38f
2016-02-19 10:41:17 -08:00
James Hawkins
0f5d443d0c Merge "system/core: Cleanup direct calls to opendir by containing in a std::unique_ptr."
am: bd04bb0d29

* commit 'bd04bb0d297c1a7cd5aabdc258b1829905fb067d':
  system/core: Cleanup direct calls to opendir by containing in a std::unique_ptr.
2016-02-19 17:51:44 +00:00
James Hawkins
588a2cad7f system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
2016-02-18 14:52:46 -08:00
Bill Yi
4409f1446c Merge commit '4352ee87fd74b931d4b58192fb8974e91aa899d0' into HEAD 2016-02-17 11:37:00 -08:00
Christopher Ferris
840887053c Merge "Newer kernels added SEGV_BNDERR."
am: 14c06e0769

* commit '14c06e0769817d81f18fcdc41132747ffc158745':
  Newer kernels added SEGV_BNDERR.
2016-02-05 02:20:13 +00:00
Christopher Ferris
5d56e28537 Newer kernels added SEGV_BNDERR.
Bug: 23789423
Change-Id: I6fdce75715edfce179df8c0e6a7205f26341ebd0
2016-02-04 14:07:23 -08:00
Elliott Hughes
1ef5b78a2f Merge "Start debuggerd as soon as logd is up."
am: 1b729b3e04

* commit '1b729b3e04b210d096ee2d447945f6b2c53b6029':
  Start debuggerd as soon as logd is up.
2016-02-02 21:10:47 +00:00
Elliott Hughes
2f74a5dae5 Start debuggerd as soon as logd is up.
Makes debugging early boot crashes easier.

Bug: http://b/26918597
Change-Id: I5bb883f1350ea5f7a545cb0e9f1034ecfcf47cdb
2016-02-02 13:03:41 -08:00
Josh Gao
f983e6ce5a Merge "debuggerd: fix debug.debuggerd.wait_for_gdb."
am: a590596dca

* commit 'a590596dcac8cc6a2ffaab110bdd89fdb5f837d8':
  debuggerd: fix debug.debuggerd.wait_for_gdb.
2016-01-15 19:40:49 +00:00
Josh Gao
2318cc0155 Merge "debuggerd: fix several bugs caused by fork/setuid change."
am: 1bf7000033

* commit '1bf700003368e8b68b34a0f9968ae5afd25dd4f2':
  debuggerd: fix several bugs caused by fork/setuid change.
2016-01-15 19:40:41 +00:00
Josh Gao
c362c45949 debuggerd: fix debug.debuggerd.wait_for_gdb.
Bug: http://b/26513486
Change-Id: I01c28ce810a49f8a4e0e2a86c7d018d95f9617c8
2016-01-15 11:31:17 -08:00
Josh Gao
7c89f9e955 debuggerd: fix several bugs caused by fork/setuid change.
Previously, we weren't PTRACE_ATTACHing to all of the threads of a
process, and we were also trying to do it after forking and dropping
privileges. This patch ensures that all ptrace attaching/detaching
happens in one place, before forking/exiting respectively.

Bug: http://b/26443860
Bug: http://b/26436605
Bug: http://b/26436486
Change-Id: Id94e0c1d9d56c051d0dd281d895aaa3285079198
2016-01-14 15:06:37 -08:00
Colin Cross
ce93dd6fcc Merge "debuggerd_test: provide stub selinux/android.h"
am: 5e19382e1c

* commit '5e19382e1c585967ee07b14fbb36a8027c92c394':
  debuggerd_test: provide stub selinux/android.h
2016-01-08 20:54:20 +00:00
Colin Cross
5e19382e1c Merge "debuggerd_test: provide stub selinux/android.h" 2016-01-08 20:49:47 +00:00
Dan Willemsen
3be0a0df2c Merge "Turn off -Wdate-time for crasher"
am: 392867cff1

* commit '392867cff1584f2ee475aae4b8f89778085a7de0':
  Turn off -Wdate-time for crasher
2016-01-06 00:35:00 +00:00
Dan Willemsen
392867cff1 Merge "Turn off -Wdate-time for crasher" 2016-01-06 00:23:37 +00:00
Josh Gao
8a43d6ae06 Merge "debuggerd: fork and drop privileges when dumping."
am: b8e9ebf8b4

* commit 'b8e9ebf8b4b840e4421534ffccce84d7ef49dc0f':
  debuggerd: fork and drop privileges when dumping.
2016-01-06 00:05:32 +00:00
Josh Gao
e7a9e52740 debuggerd: fork and drop privileges when dumping.
Bug: http://b/25195825
Change-Id: I913d8425232e79df3f7a051a8cc63de9c60f4780
2016-01-05 15:59:01 -08:00
Colin Cross
061e4a7d59 debuggerd_test: provide stub selinux/android.h
debuggerd_test stubs out the selinux/android.h interface, but was
relying on copied selinux headers to declare the interface.  Create a
stub selinux/android.h header included by the test to declare the
interface.

Change-Id: I6a2d402dda1797deb2515f10b663b1a84d498eac
2015-12-21 16:29:02 -08:00
Erik Kline
cbc6f68e32 Merge "Switch from using sockaddr to sockaddr_storage." am: 46b0b1c694
am: 4c1b3840f0

* commit '4c1b3840f092e63b0b8db8998b3bbc3465ff7c91':
  Switch from using sockaddr to sockaddr_storage.
2015-12-08 01:48:58 +00:00
Erik Kline
46b0b1c694 Merge "Switch from using sockaddr to sockaddr_storage." 2015-12-08 01:41:38 +00:00
Elliott Hughes
3608ee5e90 Merge "Track rename of base/ to android-base/." am: 912ed3d8ca
am: e2a9563be1

* commit 'e2a9563be1d540a1fb91489986bf6a72d54b59c8':
  Track rename of base/ to android-base/.
2015-12-07 23:36:59 +00:00
Erik Kline
7e16cc15b5 Switch from using sockaddr to sockaddr_storage.
This is to ensure sufficient space is always available.

Change-Id: Ifa87b93ecdc90dcacbfb24446c872344da6703d3
2015-12-07 16:07:46 +09:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Josh Gao
729ed79c51 Merge "debuggerd: remove some levels of indentation." am: cdff80c446
am: e2773a3f8e

* commit 'e2773a3f8eb1c770c1214fb43089f35cf4ca47c7':
  debuggerd: remove some levels of indentation.
2015-11-18 17:19:33 +00:00
Josh Gao
8ab7fd4017 debuggerd: remove some levels of indentation.
Use ScopedFd and unique_ptr to manage resources, so that we can early
exit instead of having 9 levels of indentation.

Change-Id: Ia5fed76c7d959f1f198ea540c56c508f7e1585c4
2015-11-17 14:44:50 -08:00
Josh Gao
93621bbf19 Merge "debuggerd: add .clang-format." am: c5a85f71ab
am: b4362070fc

* commit 'b4362070fc4c9b8178d75aaa6ab7932db5b845e1':
  debuggerd: add .clang-format.
2015-11-17 22:32:17 +00:00
Josh Gao
d918eedf29 debuggerd: add .clang-format.
Change-Id: I3584c170aadc3707638e407c7a8ca502f3670058
2015-11-16 17:26:22 -08:00
Nick Kralevich
7dafe5b818 Merge "Enable hidepid=2 on /proc" am: 2d8f1d4c47
am: ea8452cc72

* commit 'ea8452cc720cfcf2d8d1f469bbaafec968202e99':
  Enable hidepid=2 on /proc
2015-11-09 20:35:18 +00:00
Nick Kralevich
c39ba5ae32 Enable hidepid=2 on /proc
Add the following mount options to the /proc filesystem:

  hidepid=2,gid=3009

This change blocks /proc access unless you're in group 3009
(aka AID_READPROC).

Please see
  https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.txt
for documentation on the hidepid option.

hidepid=2 is preferred over hidepid=1 since it leaks less information
and doesn't generate SELinux ptrace denials when trying to access
/proc without being in the proper group.

Add AID_READPROC to processes which need to access /proc entries for
other UIDs.

Bug: 23310674
Change-Id: I22bb55ff7b80ff722945e224845215196f09dafa
2015-11-09 09:08:46 -08:00
Dan Willemsen
9bef9660fd Turn off -Wdate-time for crasher
This is an optional diagnostic tool where it's useful to know if you are
running the version that you just built. Allow the use of __TIME__
without a warning or error.

Bug: 24204119
Change-Id: I78063c2694b80ccaf5891d1cd649ea17eda978cb
2015-11-02 15:41:59 -08:00
Christopher Ferris
0dac031b03 Fix incorrect check of descsz value. am: d917514bd6 am: 69406d904a
am: 3f5fdc3522

* commit '3f5fdc35228b4bf9c86a91a35fc73a06d14391c5':
  Fix incorrect check of descsz value.
2015-10-29 19:23:54 +00:00
Christopher Ferris
d917514bd6 Fix incorrect check of descsz value.
Bug: 25187394

(cherry picked from commit 1fa55234d6)

Change-Id: Idbc9071e8b2b25a062c4e94118808d6e19d443d9
2015-10-22 17:54:24 -07:00
Dan Willemsen
eea68c6f98 Merge "Remove __DATE__/__TIME__ from init and debuggerd"
am: 512b0e60b4

* commit '512b0e60b4fb33ec5535c1784a99a27539787790':
  Remove __DATE__/__TIME__ from init and debuggerd
2015-10-22 22:00:20 +00:00
Dan Willemsen
30622bbb20 Remove __DATE__/__TIME__ from init and debuggerd
Keeping these means that every build has different init and debuggerd
binaries, even if the source was the same. So OTAs that don't touch
these sources would still need to update the binaries.

Both of these messages are only informational, so can be safely removed.
Bootchart already encodes build-specific information from the system
properties.

Bug: 24204119
Change-Id: I7ebd65a20a3e031e7528c9f741616e20b3cd7446
2015-10-22 13:12:18 -07:00
Nick Kralevich
545b7c9e39 am 2fb90dc8: Merge changes from topic \'userspace-audit\'
* commit '2fb90dc8b2b590e674c5e433e8bf3d3f08a887c8':
  debuggerd: audit pid, uid and gid on SE Linux denial
  property_service: log pid,uid and gid of setprop client
2015-10-10 20:11:08 +00:00
William Roberts
468573930d debuggerd: audit pid, uid and gid on SE Linux denial
When debugging SE Linux audit messages from debuggerd, its
unclear what process is triggering the access violation. To
assist in debugging, we also log pid, uid and gid.

Before:
avc:  denied  { dump_backtrace } for scontext=u:r:dumpstate:s0 ...

After:
avc: denied  { dump_backtrace } for pid=198 uid=1019 gid=1019 ..

Change-Id: I8263e6f5e77917139b73c3e84b76f7f97fd98003
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-10-06 12:25:27 -07:00
Stephen Hines
fc5185a578 am cabf610d: am d29f10cd: Merge "Fix build break due to unknown pragma (on gcc)."
* commit 'cabf610da0799abc302233acf4b3c420543a9c04':
  Fix build break due to unknown pragma (on gcc).
2015-10-01 06:49:19 +00:00
Stephen Hines
9466bb2ab6 Fix build break due to unknown pragma (on gcc).
Change-Id: I36bf855769b243139fd45186ac53578448b87a2b
2015-09-30 23:30:38 -07:00
Stephen Hines
e6a782cc9f am f141312c: am dc91dafa: Merge "Ignore explicit infinite recursion."
* commit 'f141312c826a1c03b10d1e8acd033f39063f7599':
  Ignore explicit infinite recursion.
2015-10-01 05:46:17 +00:00
Stephen Hines
18395cb507 Ignore explicit infinite recursion.
Clang 3.8 warns against this now, and it is tripping up part of a test.
We suppress the warning, since we are trying to actually test that this
behavior is properly handled.

Change-Id: I8705900572e1a6704bbdc001fece3e2d16c7077c
2015-09-29 23:55:14 -07:00
Yabin Cui
112ca2b24e am 33f02724: am 65744003: Merge "Revert "Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""""
* commit '33f027247da687a535ba2264fe98926a38742f68':
  Revert "Revert "Revert "Revert "Add BacktraceOffline for offline backtracing.""""
2015-09-22 22:19:43 +00:00
Yabin Cui
9e402bb20c Revert "Revert "Revert "Revert "Add BacktraceOffline for offline backtracing.""""
This reverts commit 94ece83270.

Change-Id: Ie06465c89a5fc115517130f9f2904cc855973155
2015-09-22 04:46:57 +00:00
Yabin Cui
d716a45f1d am 27b455bb: am 00ea49fc: Merge "Revert "Revert "Revert "Add BacktraceOffline for offline backtracing.""""
* commit '27b455bb0c2dbab7af14c3434438310a38cb64fa':
  Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""
2015-09-22 01:54:15 +00:00
Yabin Cui
94ece83270 Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""
This reverts commit 0a411c934a.

Change-Id: Ic1824afac6c32f1087b66de9d6368a561f235d13
2015-09-22 01:38:17 +00:00
Yabin Cui
36787a37fd am 92db97de: am ebc49654: Merge "Revert "Revert "Add BacktraceOffline for offline backtracing."""
* commit '92db97dea06895b0e22e4ad5fd1152dc24c94efa':
  Revert "Revert "Add BacktraceOffline for offline backtracing.""
2015-09-21 21:36:59 +00:00
Tom Cherry
984bd8323d resolved conflicts for 5caca3dd to mnc-dr-dev-plus-aosp
Change-Id: I773e514a8232b77cdd566dc36c9efc4e15f206f0
2015-09-21 14:25:34 -07:00
Yabin Cui
0a411c934a Revert "Revert "Add BacktraceOffline for offline backtracing.""
This reverts commit ab5e583327.

And statically link llvm libraries on host to remove dependency
on 32-bit llvm shared library which is not included in the prebuilt.

Bug: 22229391

Change-Id: I8210687655ee1809fd820ab2a6ca5dfaf3f9096d
2015-09-21 12:54:45 -07:00
Tom Cherry
20391b1de5 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I52616b8ab1165fdef716f9b8f958665f2308c12e
2015-08-21 10:14:43 -07:00
Elliott Hughes
f39383103b bionic no longer sends SIGPIPE to debuggerd.
Static binaries don't get the signal handler installed (that's done by the
dynamic linker) so we don't need to worry about seeing SIGPIPE crashes from
old binaries.

Bug: http://b/20659371
Change-Id: I3b5566634fadd3e822262561188d29814bccd1fd
2015-07-30 08:15:57 -07:00
Christopher Ferris
a3ee46f105 Merge "Dump memory going from unreadable to readable." 2015-07-09 23:38:26 +00:00
Christopher Ferris
456abbabf2 Dump memory going from unreadable to readable.
If the first read when dumping memory returns no data, skip ahead to
the next page boundary and try and read from there. This fixes a case
where the address at which to start dumping memory is unreadable, but
crosses back into readable memory.

Bug: 22234753
Change-Id: Ie28d5c027013577ca06f5396aba498366a3b6749
2015-07-09 15:35:47 -07:00
Christopher Ferris
d79f2bebcc New property that determines when to wait for gdb.
Use debug.debuggerd.wait_for_gdb being set to non-zero to
determine if debuggerd should stop and wait for someone to
attach gdb to the crashing process.

Bug: 22233908
Change-Id: Id55a1572b479a70d395b7270392ce6fb70dbfdca
2015-07-08 16:01:49 -07:00
Christopher Ferris
41a0654e2a Merge "Replace all _LOG error calls with ALOGE." 2015-07-08 19:16:03 +00:00
Elliott Hughes
39a28c2526 Fix debuggerd's gdbclient instructions.
We improved gdbclient to make the process simpler, but didn't update
debuggerd to match.

Bug: http://b/22233857
Change-Id: If4137943f567a9e566a3ac7f485c9b1eab2c68e9
2015-07-07 14:34:39 -07:00
Christopher Ferris
b36b592338 Replace all _LOG error calls with ALOGE.
The debuggerd code sometimes calls _LOG(..., logtype::ERROR, ...)
and sometimes ALOGE(). Standardize on ALOGE since the _LOG message
will wind up in the tombstone in weird places, but using ALOGE
will wind up in the logcat portion of the tombstone.

Bug: 21467089
Change-Id: Ie893f5e91d45b48ef3f5864c3a714e60ac848fb3
2015-07-01 13:23:19 -07:00
Nick Kralevich
4d87095ebf Remove calls to is_selinux_enabled()
d34e407aeb removed support for
running with SELinux completely disabled. SELinux must either be
in permissive or enforcing mode now.

Remove unnecessary calls to is_selinux_enabled(). It always returns
true now.

Change-Id: Ife3156b74b13b2e590afe4accf716fc7776567e5
2015-06-12 22:12:33 -07:00
Christopher Ferris
21bd040eff Change the 64 bit map address format.
Previously, the map printing in tombstones for 64 bit devices uses
a variable length value. This means that the maps are not lined up.
The new format is to print the map as 00000000'00000000 in all ways.

Also fix a bug where the backtrace_map_t did not initialize all
parameters.

Add unit tests for all of the dump_all_maps function.

Bug: 20950813
(cherry picked from commit 862fe02919)

Change-Id: Ife5c48bddeb19006a98f9e87520474e97b97f6d9
2015-06-03 12:12:31 -07:00
Christopher Ferris
862fe02919 Change the 64 bit map address format.
Previously, the map printing in tombstones for 64 bit devices uses
a variable length value. This means that the maps are not lined up.
The new format is to print the map as 00000000'00000000 in all ways.

Also fix a bug where the backtrace_map_t did not initialize all
parameters.

Add unit tests for all of the dump_all_maps function.

Bug: 20950813
Change-Id: I30901c8a0251b00d85c4c01476b033ef8db84e32
2015-06-03 10:24:21 -07:00
Christopher Ferris
0c3f1ae66b Refactor dump_memory function.
- Add dumping memory around registers for x86/x86_64.
- Add unit tests for new dump_memory function.
- Cleanup all of the machine.cpp files.
- Increase the high address check for 32 bit, and decrease the high
  address allowed for 64 bit slightly to match mips64.

Bug: 21206576
(cherry picked from commit e8bc77eb84)

Change-Id: I49ec237e30076a232f084da1072bf9aba15dc0cd
2015-05-28 11:45:34 -07:00
Christopher Ferris
a684d9dad5 Merge "Refactor dump_memory function." 2015-05-28 18:02:10 +00:00
Christopher Ferris
e8bc77eb84 Refactor dump_memory function.
- Add dumping memory around registers for x86/x86_64.
- Add unit tests for new dump_memory function.
- Cleanup all of the machine.cpp files.
- Increase the high address check for 32 bit, and decrease the high
  address allowed for 64 bit slightly to match mips64.

Bug: 21206576
Change-Id: I6f75141f3282db48b10f7c695a1cf2eb75a08351
2015-05-27 17:21:38 -07:00
Elliott Hughes
9fc8343772 Don't use TEMP_FAILURE_RETRY on close in system/core.
Bug: http://b/20501816
Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
(cherry picked from commit 47b0134ec2)
2015-05-27 13:27:06 -07:00
Elliott Hughes
47b0134ec2 Don't use TEMP_FAILURE_RETRY on close in system/core.
Bug: http://b/20501816
Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
2015-05-15 19:16:40 -07:00
Christopher Ferris
f0861f9f8f Switch UniquePtr to std::unique_ptr.
Bug: 21209050
Change-Id: I91d4c44de479b37f2729382fcdf103b8c69aa668
(cherry picked from commit 6e96403b8f)
2015-05-15 17:41:20 -07:00
Christopher Ferris
6e96403b8f Switch UniquePtr to std::unique_ptr.
Bug: 21209050
Change-Id: I91d4c44de479b37f2729382fcdf103b8c69aa668
2015-05-15 17:30:21 -07:00
Christopher Ferris
eb19e76632 Prevent crashes if a map cannot be created.
Under some conditions, /proc/<pid>/maps might return nothing. If we
try and unwind in this case, we'll crash. Check this case and fail
the unwind.

Add checks that no other functions try and use map_ without
checking for nullptr.

Add logging when an unwind fails so it's clear what happened.

Bug: 21162746
Change-Id: I56ce51dda0cfc9db20475a441f118108196aa07c
(cherry picked from commit 30c942cf10)
2015-05-15 11:32:53 -07:00
Christopher Ferris
30c942cf10 Prevent crashes if a map cannot be created.
Under some conditions, /proc/<pid>/maps might return nothing. If we
try and unwind in this case, we'll crash. Check this case and fail
the unwind.

Add checks that no other functions try and use map_ without
checking for nullptr.

Add logging when an unwind fails so it's clear what happened.

Bug: 21162746
Change-Id: I56ce51dda0cfc9db20475a441f118108196aa07c
2015-05-14 17:56:41 -07:00
Christopher Ferris
af67fb2475 Add offset to map data.
Also, print the offset in the maps section.

Bug: 20864928
Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61
(cherry picked from commit 5c8856854d)
2015-05-06 16:35:50 -07:00
Christopher Ferris
5c8856854d Add offset to map data.
Also, print the offset in the maps section.

Bug: 20864928
Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61
2015-05-06 12:50:09 -07:00
Christopher Ferris
b0481f4809 All debuggerd log output marked fatal.
This avoids the log daemon skipping some of the log output from
debuggerd.

Bug: 20846525
(cherry picked from commit b0412a5c2b)
Change-Id: Ifed48814d76c7e855645b6d5487d5e6e1fcafd9e
2015-05-05 14:16:21 -07:00
Christopher Ferris
b0412a5c2b All debuggerd log output marked fatal.
This avoids the log daemon skipping some of the log output from
debuggerd.

Bug: 20846525
Change-Id: Ifed48814d76c7e855645b6d5487d5e6e1fcafd9e
2015-05-05 13:27:41 -07:00
Christopher Ferris
2106f4ba95 Add load base to map for relocation packing.
The new linker relocation packing support uses non-zero load bases,
so we better handle them properly.

Also print out the load base for a map if it's non-zero.

Bug: 20687795
(cherry picked from commit 329ed7dae4)

Change-Id: Ibc37d8c8bb032820dca4e7531184349ba6d402d2
2015-05-01 17:09:49 -07:00
Christopher Ferris
329ed7dae4 Add load base to map for relocation packing.
The new linker relocation packing support uses non-zero load bases,
so we better handle them properly.

Also print out the load base for a map if it's non-zero.

Bug: 20687795
Change-Id: Iec2d1db2051e7b4a278c1dfa57d745128a7f2974
2015-05-01 16:04:24 -07:00
Elliott Hughes
f5290ee1a7 Use WriteFully in debuggerd to talk to ActivityManager.
(cherry picked from commit b7cd09b93e)

Change-Id: Ic81b4134fe563d8ebb15ba4ff3e9b2e8893c97a5
2015-04-27 12:51:42 -07:00
Elliott Hughes
b7cd09b93e Use WriteFully in debuggerd to talk to ActivityManager.
Change-Id: I5b57fda9b0343434e1c0f9189147075a368e0282
2015-04-24 22:25:12 -07:00
Yabin Cui
03dca28def Fix alignment when reading note segment.
ELF said that padding is present, if necessary, to ensure 4-byte
alignment for the descriptor and next note entry, but such padding
is not included in namesz and descsz.

Change-Id: I7896783f3d9a787772d56c49905f52a493c9fba1
2015-04-14 10:27:54 -07:00
Christopher Ferris
a21bd93ef5 Print the build id of shared libraries if present.
For every map that has a name, and if it's a mapped in shared library,
print the build id.

Refactor the way dump_all_maps logs data.

Refactor the way stack segments are dumped.

Bug: 19371018
Change-Id: Ic08d05a4b13f128925743936fb84d8059f7cb56f
2015-03-17 15:13:35 -07:00
Douglas Leung
2ea9a32434 Add backtrace support for mips64.
Change-Id: I12ea2fcbe6780bb596f51988eae1ceafcec858df
2015-03-09 18:43:10 -07:00
Mark Salyzyn
2d3f38a6b8 liblog: introduce ANDROID_LOG_* flags
Move away from using POSIX open(2) flags and introduce ANDROID_LOG_* flags to
replace them. Add security by preventing random mode flags from getting into
underlying POSIX calls. ANDROID_LOG_* flags overlap POSIX O_* flag definitions.

Change-Id: Ib32bb64c287e8bf150be62242e1ba46bb37839fc
2015-02-25 17:44:18 +00:00
Christopher Ferris
ab9e7dcef6 Do not dump maps/memory/code of sibling threads.
Modifies the code so that if the unwind fails, the code still prints
as much data as possible.

Also, for sibling threads, skip printing the maps and memory/code
since it's not likely to be very relevant.

Fix a few cases where extra space is at the end of lines.

Fix an inverted if statement that was checking the wrong condition.

Bug: 18816322
Change-Id: Ic659e0c34489bf2c65c5a23e2b83e31653b927e4
2015-02-09 19:22:33 -08:00
Christopher Ferris
12385e3ad0 Move map data into backtrace data proper.
The backtrace structure used to include a pointer to a backtrace_map_t
that represented the map data for a particular pc. This introduced a
race condition where the pointer could be discarded, but the backtrace
structure still contained a pointer to garbage memory. Now all of the map
information is right in the structure.

Bug: 19028453
Change-Id: If7088a73f3c6bf1f3bc8cdd2bb4b62e7cab831c0
2015-02-06 15:00:09 -08:00
Christopher Ferris
b817094081 Remove the pt_regs_mips_t structure.
The kernel finally has the pt_regs structure properly defined for mips,
so we don't need to define it ourselves.

Change-Id: Ifdf75ed827cd2390962e9b3a182bdbbf02fe0732
2015-01-26 13:52:35 -08:00
Christopher Ferris
9774df6134 Move 32 bit/64 bit check into debuggerd.
On 64 bit systems, calls to dump_backtrace_to_file or dump_tombstone
try and directly contact the correct debuggerd (32 bit vs 64 bit)
by reading the elf information for the executable.
Unfortunately, system_server makes a call to dump_backtrace_to_file
and it doesn't have permissions to read the executable data, so it
defaults to always contacting the 64 bit debuggerd.
This CL changes the code so that all dump requests go to the 64 bit
debuggerd, which reads the elf information and redirects requests for
32 bit processes to the 32 bit debuggerd.

Testing:

- Forced the watchdog code in system_server to dump stacks and
  verified that all native stacks are dumped correctly.
- Verified that dumpstate and bugreport still properly dump the native
  processes on a 64 bit and 32 bit system.
- Intentionally forced the 64 bit to 32 bit redirect to write only a
  byte at a time and verified there are no errors, and no dropped data.
- Used debuggerd and debuggerd64 to dump 32 bit and 64 bit processes
  seemlessly.
- Used debuggerd on a 32 bit system to dump native stacks.

Bug: https://code.google.com/p/android/issues/detail?id=97024
Change-Id: Ie01945153bdc1c4ded696c7334b61d58575314d1
2015-01-20 17:22:07 -08:00
Elliott Hughes
c184d5655a #include <arpa/inet.h> for htonl.
Not sure why this only shows up with clang.

Change-Id: Id5603483e32f8a8d4b091dbb31b3142e3f77deac
2014-12-18 23:49:17 +00:00
Yabin Cui
2331b95609 Make crasher smash-stack work.
Bug: 18721888
Change-Id: Id0280df7cb2c29832256d3d395e6399fcef9aa2b
2014-12-11 17:49:12 -08:00
Dmitriy Ivanov
052fc0a225 Print ASCII near register for all archs
Bug: 17880617
Change-Id: I6870e8ac670c08e45d8efb64479976a38edfdc93
2014-12-10 10:21:12 -08:00
Dan Albert
80b88cb5d2 Move debuggerd to libc++.
Bug: 15193147
Change-Id: I935a08e98077b688d1735fb5b84a615cb7df8810
2014-11-15 16:35:30 -08:00
Christopher Ferris
d4c7a1cfad am a11ac455: Merge "Fix debuggerd issues."
* commit 'a11ac45536f0722becefccdb6b58378c5d9d0d4b':
  Fix debuggerd issues.
2014-11-03 20:23:55 +00:00
Christopher Ferris
1072f917cf Fix debuggerd issues.
- Fix a problem where a tid exits before the attach completes, and it
  causes debuggerd to self terminate.
- Fix a problem where sibling tid dumps do not properly wait for the tid
  to get signalled.

Bug: 17800180
Bug: 12567315

(cherry picked from commit 84ddb34a3a)

Change-Id: I45e33865614d4c96f4a89cf117398666b556d500
2014-11-03 11:26:33 -08:00
Chih-Hung Hsieh
845867b2c2 am d88323b2: Merge "Add volatile to avoid clang optimization."
* commit 'd88323b2667c443c2738eb601eb0b9eaad1c3049':
  Add volatile to avoid clang optimization.
2014-10-28 04:49:12 +00:00
Chih-Hung Hsieh
a1ff475b07 Add volatile to avoid clang optimization.
BUG: 18108178
Change-Id: Ie5b8b1808fcf6d1eacc14a7c6ac0c8d49641fec2
2014-10-23 16:50:51 -07:00
Jeff Brown
55fbad69a1 am c3e6eb21: Merge "Move ABI: line below header when dumping stacks." into lmp-dev
* commit 'c3e6eb21b58ae3067ed03358687d1edb851f2abf':
  Move ABI: line below header when dumping stacks.
2014-09-12 05:43:08 +00:00
Jeff Brown
9b12d53b1a Move ABI: line below header when dumping stacks.
Bug: 17474152
Change-Id: I66b6e7e1cbb004f7a1915a2c1515df6555fe176f
2014-09-11 14:20:04 -07:00
Dmitriy Ivanov
a639b97d4a Do not suppress maps dump when si_addr<PAGE_SIZE
Also remove alignment of si_addr.

(cherry picked from commit f10aa3ae9d)

Bug: 16950250
Change-Id: I60170b9eb7dd8fe99c0eeeaec74d13cfbaa920d9
2014-08-11 10:01:58 -07:00
Dmitriy Ivanov
c326115115 am 75ef453e: am 2f40ddf3: Merge "Do not suppress maps dump when si_addr<PAGE_SIZE"
* commit '75ef453e5d3352aad8c55cd8fa572945c6f4bbfa':
  Do not suppress maps dump when si_addr<PAGE_SIZE
2014-08-10 00:08:34 +00:00
Dmitriy Ivanov
f10aa3ae9d Do not suppress maps dump when si_addr<PAGE_SIZE
Also remove alignment of si_addr.

Change-Id: Ie5445bf8a5baa49e04e37c643c25ebd0f1dc9d22
2014-08-09 12:07:51 -07:00
Mark Salyzyn
a9d3ed32e9 am 1d497f8a: am cddc97cb: Merge "debuggerd: tombstone: suppress logger request for logd process"
* commit '1d497f8a92994abeb5baeaacdec037268838af20':
  debuggerd: tombstone: suppress logger request for logd process
2014-07-29 23:26:05 +00:00
Mark Salyzyn
45ae446cab debuggerd: tombstone: suppress logger request for logd process
Change-Id: I619880342ee6febd1a6cc98d2a4f536120efc1c8
2014-07-28 15:16:05 -07:00
Mark Salyzyn
2f2e79de0c debuggerd: tombstone: suppress logger request for logd process
(cherry pick from 45ae446cab)

Change-Id: I619880342ee6febd1a6cc98d2a4f536120efc1c8
2014-07-29 16:13:23 -07:00
Brigid Smith
166cfe68c3 Added default constructor for log_t.
Bug: 16357258

(cherry picked from commit c75a02fe3f)

Change-Id: I96be34ee1664af54b0dcbc928ea542cd749852fd
2014-07-29 16:08:34 -07:00
Nick Kralevich
d753da344e am c70ebca4: am 6bc762b2: Merge "Add SELinux MAC to debuggerd."
* commit 'c70ebca44cc37b0d261736446ccf52bbdb61e7d1':
  Add SELinux MAC to debuggerd.
2014-07-24 20:31:11 +00:00
Stephen Smalley
69b800391c Add SELinux MAC to debuggerd.
debuggerd allows uid-0 processes to dump tombstones or backtraces
of any process, and uid-system processes to dump backtraces of any
processes.  Restrict these operations via SELinux based on the
client context, the target process context, and the action.

Depends on I8e120d319512ff207ed22ed87cde4e0432a13dda for the
corresponding policy definitions.

Change-Id: Ib317564e54e07cc21f259e75124b762ad17c6e16
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-07-24 16:01:56 -04:00
Elliott Hughes
8d2136922a am 4a95a209: am 719fd238: Merge "Added default constructor for log_t."
* commit '4a95a209e8fc472461aa75282b486e1860edde19':
  Added default constructor for log_t.
2014-07-17 23:09:05 +00:00
Brigid Smith
c75a02fe3f Added default constructor for log_t.
Bug: 16357258
Change-Id: I39169b35653d2b717fadbcff75978db01cc375ef
2014-07-17 15:49:39 -07:00
Nick Kralevich
04f9b2a809 debuggerd: use O_NOFOLLOW|O_CLOEXEC for tombstones
Change-Id: I71bdfba30346a9fad3129b404f39eda8190698e3
2014-07-16 20:08:41 -07:00
Elliott Hughes
e9f7361ea9 Add SIGFPE to crasher.
Bug: 3399996

(cherry picked from commit 3ecc42106e)

Change-Id: I075613ca3c022ce8d38a06a5ba236ceff32d181c
2014-07-15 13:18:32 -07:00
Elliott Hughes
aae5d43755 Add missing arm64 registers.
Also fix dumping of arm64's vector registers, which are actually 128 bits wide.

Also move the arm/arm64 FP registers to the tombstone. (We've never dumped
them at all for the other architectures.)

(cherry picked from commit b40c50351e)

Change-Id: Ic646fb9ea01e9beb42e1757feb8742c1d4efafa7
2014-07-14 18:56:53 -07:00
Elliott Hughes
3ecc42106e Add SIGFPE to crasher.
Bug: 3399996
Change-Id: I115caf846a47f57984c1b1844104e37d29e6f24e
2014-07-15 11:38:47 -07:00
Elliott Hughes
b40c50351e Add missing arm64 registers.
Also fix dumping of arm64's vector registers, which are actually 128 bits wide.

Also move the arm/arm64 FP registers to the tombstone. (We've never dumped
them at all for the other architectures.)

Change-Id: I239a86dd225b47fa90109bc824b7610df67ad812
2014-07-14 17:12:20 -07:00
Elliott Hughes
cb7aae167e Fix arm emulator "D register out of range for selected VFP version" build failure.
Change-Id: Ia37cb3f8ecb00a927fa3fc8b4131c158413646e7
2014-07-09 16:41:04 -07:00
Elliott Hughes
e7f18e14a9 Integrate vfp-crasher with crasher.
There's no good reason to separate "fill the integer registers with
recognizable patterns and crash" from "fill the FP registers with recognizable
patterns and crash".

Also remove the incorrect use of ARCH_ARM_HAVE_VFP_D32 rather than try to fix
it.

Change-Id: I3a4a3aca1575de5489314027ae52168997404d79
2014-07-09 12:19:32 -07:00
Elliott Hughes
7e775952e1 Fix LP64 tombstone.cpp build failure.
Change-Id: Id071417f56dd883e9d2e38a6f3296cb23a0352fb
2014-07-08 11:35:58 -07:00
Brigid Smith
8606eaa770 Improving maps output.
Maps output now displays fault address location more intelligently.  If
the fault is not in a mapped region, it now shows where that address is
with respect to the other maps.

In addition, the size of the map is now printed as part of the output.

Also, crasher now supports an "mmap" option which mmaps/munmaps a region
of memory and then attempts to access it, causing a fault address in
between mapped regions that can be used to test that new part of the
maps output.

Change-Id: Ia5e1926802bdfcbbdb7857e3631ddf395ae0c5b8
2014-07-08 10:53:49 -07:00
Mark Salyzyn
17e85c0671 debuggerd: synchronize cosmetics to internal
Change-Id: I66bc2b181cd75da188c046571492224d5ac3fc98
2014-06-27 15:55:19 -07:00
Elliott Hughes
e080be5754 Merge "Fixed tid/pid mixup in debuggerd gdbclient output." 2014-06-26 18:34:59 +00:00
Brigid Smith
75582957cf Fixed tid/pid mixup in debuggerd gdbclient output.
Now the debugging output shows the tid of the crashed thread instead of
the pid of the process that crashed.

Change-Id: I637f409ff02d73d458edc6d1a5c462c21d128211
2014-06-27 09:21:12 -07:00
Mark Salyzyn
e43290d7ed tombstone: log output header suppressed in crash
Bug: 15520846
Change-Id: I18934cc60af3dda98ab729fbabc4c7a66834512e
2014-06-27 10:32:22 -07:00
Michael Wright
80f596984e Print ABI in backtraces.
This lets the stack tool figure out which toolchain to use
automatically.

Change-Id: Ia235d6904622423fe6fbc7b0315a1861e52a41ad
2014-06-24 17:14:26 -07:00
Brigid Smith
20c214f857 Fixed pathname for connecting to debugger.
The debug output was still showing the pathname that worked with
gdbclient before my changes, and therefore did not work after the fact.

Change-Id: Ie12d79f5346088914ce0a70bda69780707b31d31
2014-06-24 10:04:41 -07:00
Brigid Smith
f473200d35 Fixing debuggerd header output.
PID and TID output line was missing.

Change-Id: I609af5727bc22ea0b97f3975ddb3cf0102910bc2
2014-06-23 11:03:40 -07:00
Brigid Smith
2e8290463e Maps output now marks the fault address location.
If the fault address is not within a mapped region, it logs an error
message after the output.  Otherwise, it prefixes the location of the
fault address with "--->" to make it easier to locate.

Change-Id: I330adaade4402ffeb09f1a6d34a944c2f054d06d
2014-06-20 09:30:16 -07:00
Elliott Hughes
e901c1bf8a Fix debuggerd "format '%p'" build breakage.
Change-Id: I589d44485e55c23d1f1a6edfa8310a90cac2429e
2014-06-19 11:46:27 -07:00
Brigid Smith
e17f267b2a Updated non-ARM archs to reflect logging changes.
Change-Id: I0af865881c19ea4a57ec1aa9455bc32c08a60d75
2014-06-19 11:33:38 -07:00
Brigid Smith
50eb546ec1 Removed log.quiet and log = NULL cases from debuggerd.
Now the functionality implemented by these semi-confusing cases has been
replaced with the same logtype enum behavior that is easier to
understand, and cases that used log-looking behavior to print to logcat
(when log = NULL) now use the more transparent ALOGE/ALOGD functions.

Change-Id: I7e38f2d4ca74a828df4d2266b3ea34edd3c6f5bb
2014-06-19 10:59:01 -07:00
Brigid Smith
7b2078eeb4 Changed maps output in debuggerd.
Now the map output is only sent to the tombstone, and the entire
contents of /prod/$PID/maps is logged, not just 3 lines.  Additionally,
crasher now supports "crasher SIGSEGV-non-null", which attempts to write to a
dereferenced function address, causing a SIGSEGV at a non-zero address.
This new crasher mode can be used to test the new maps output.

Bug: 15343662
Change-Id: I796d92e8352a6b9714bbbfe96f3143c56565ef2f
2014-06-17 15:32:22 -07:00
Brigid Smith
1babede38b Fixed logcat debug output issue.
Change-Id: Ibeb048b683ec11b05af23371e5e4b17cdd50fea0
2014-06-17 14:24:43 -07:00
Brigid Smith
62ba489ba0 Changing how debuggerd filters log messages to different locations.
The system by which debuggerd filters its output to different locations
is now based on an enum called logtype with easy to understand
categories for log messages (like THREAD, MEMORY, etc.) instead of the
old, fairly esoteric scope_flags variable.  Now much of the output that
previously went to logcat does not show up on the screen, but all output
can be found in the tombstone file.  In addition, the tombstone's
location is now printed so it can be located easily.

Bug: 15341747
Change-Id: Ia2f2051d1dfdea934d0e6ed220f24345e35ba6a2
2014-06-16 14:41:21 -07:00
Elliott Hughes
20df39a089 Merge "Adding ABI output to debuggerd tombstones." 2014-06-04 21:11:47 +00:00
Brigid Smith
9c8dacce55 Adding ABI output to debuggerd tombstones.
Bug: 15084471
Change-Id: If9fb260a3403e86f80928f2f5f79331fc0936030
2014-06-04 12:29:24 -07:00
Christopher Ferris
3520086e3d Fix x86 and x86_64 builds.
Change-Id: I1ee9117843aff2abe4067f288b8496d4bfc78c9e
2014-06-03 17:13:37 -07:00
Elliott Hughes
ddde05f3ee Merge "[MIPS64] Build debuggerd for mips64" 2014-06-03 23:26:33 +00:00
Duane Sand
a80b759857 [MIPS64] Build debuggerd for mips64
Change-Id: I361e9668baa218fc01e723c2df1a34ca6329cf47
2014-06-03 16:24:57 -07:00
Elliott Hughes
8c597684b1 Clean up the debuggerd makefile.
In particular, turn on -Wunused, which is globally off by default
thanks to build/core/config.mk.

Change-Id: Iba3ee1c0726f43eced972a53959f0e1cd97190c9
2014-06-03 15:12:07 -07:00
Mark Salyzyn
e4369d68a2 logd: logcat: debuggerd: audit logs to events and main
- auditd spawn log copy to events and main
- logcat delete events as one of the default logs
- debuggerd do not collect events.
- squish multiple spaces
- switch from strcpy to memmove for overlapping buffers

BUG: 14626551
Change-Id: I89b30273ce931ed2b25a53ea9be48e77f4c1bbf4
2014-05-27 14:29:56 -07:00
Douglas Leung
6254f32f21 Fix register dump and back trace after a crash.
Change-Id: Ie5f6624b9dcf81d84769b9cdaf9d8a301c8826f7
Signed-off-by: Douglas Leung <douglas@mips.com>
2014-05-21 16:41:20 -07:00
Elliott Hughes
a323b504a7 Teach debuggerd the name of SIGTRAP.
Also add SIGTRAP to the list of signals we don't want to double fault on.

Bug: 15024256
Change-Id: I23ab80800563c007fcd3e42527329fedf762f0c8
2014-05-16 21:12:17 -07:00
Elliott Hughes
27ab751c7b Remove the broken LED flashing code from debuggerd.
Change-Id: I4d0cbe14daa90ac5f91ce4597584448ee3c65dda
2014-05-16 20:54:36 -07:00
Elliott Hughes
d9bf2b2137 Output correct gdbserver instructions from debuggerd.
Bug: 15021938
Change-Id: I2df433d939f5f83ed2a2a30af357b83e4d8e5331
2014-05-16 19:51:41 -07:00
Elliott Hughes
c4afc19236 Merge "Add SIGTRAP support to crasher and debuggerd." 2014-05-17 00:39:22 +00:00
Elliott Hughes
7e35ae8fc8 Add SIGTRAP support to crasher and debuggerd.
Bug: 15024256
Change-Id: I3f34993fcfd9799306852b0a2195db468370be6e
2014-05-16 17:27:59 -07:00
Mark Salyzyn
989980c55d logd: logcat: debuggerd: auditd logs to events
- auditd switch to recording logs to events log id
- logcat add events as one of the default logs
- debuggerd collect events log as well.

ToDo: debuggerd & bugreport collect intermixed logs.

BUG: 14626551
Change-Id: I958f0e729b7596748be57488a38824db5645be7b
2014-05-15 08:50:50 -07:00
Elliott Hughes
99d4a697c7 Fix mips debuggerd <corkscrew/ptrace.h> build breakage.
The uapi headers have everything we need, and the corkscrew
header files have been removed.

Change-Id: I274b44463638112f1ab290926094c094c9253586
2014-05-07 15:42:41 -07:00
Christopher Ferris
c5bb49a138 Log stack even if tombstone cannot be created.
Bug: 14498701
Change-Id: I62c271bef2f73166eeb91d3fa3ce1e1b724a081f
2014-05-05 15:01:14 -07:00
Mark Salyzyn
f1a8dfa0eb debuggerd: turn on -Werror
- Deal with some -Wunused / -Wunused-variable issues

Change-Id: I39849fe30170f69d1cab7d4ad2629b3a49e14ee7
2014-05-02 14:16:00 -07:00
Elliott Hughes
855fcc3114 Use the si_code value bionic passes us.
Bionic needs to re-raise various signals, which means the si_code
debuggerd sees has been clobbered. If bionic sends us the original
si_code value, we can use that instead of the one we see when the
ptrace the crashed process' siginfo.

Change-Id: If116a6bc667d55a6fb39b74f96673292af4e4c8c
2014-04-25 20:20:39 -07:00
Elliott Hughes
bd395b9a14 Add missing si_code values to debuggerd.
Also add static_asserts so we'll be notified if any more new ones show up.

Change-Id: I3a502dd4da35354e1ac65865191d31ccdacef298
2014-04-24 13:53:22 -07:00
Elliott Hughes
da6b2e2fd7 Improve liblog's fatal logging.
This makes LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF as good as regular
assert(3).

Change-Id: I0666684d30cae7baf23c64b33d35c1e43f81acf0
2014-04-24 13:28:24 -07:00
Mark Salyzyn
99f47a9e7c logd: liblog: logcat: debuggerd: Add LOG_ID_CRASH
Change-Id: Iea453764a1a4fc1661f461f10c641c30150e4d20
2014-04-16 15:38:50 -07:00
Colin Cross
87a6b1d799 debuggerd: use LOCAL_MULTILIB
Use LOCAL_MULTILIB to build multiple versions of executables
instead of manually creating two build rules.

Change-Id: I1a993ff7b5f527a88735f46eec9822bb97d16490
2014-03-26 15:16:23 -07:00
Colin Cross
579c9bc8a4 build debuggerd and debuggerd64 on 64-bit architectures
Change-Id: I1518d45ae0c5e0fed31d071fdaf19a67bad1bdfc
2014-02-12 22:32:26 -08:00
Nick Kralevich
2e7347d617 Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API." 2014-02-12 23:09:28 +00:00
Christopher Ferris
4207df11c5 Merge "Use stat structure to keep oldest mtime." 2014-02-08 02:13:58 +00:00
Christopher Ferris
68bd59f6d2 Use stat structure to keep oldest mtime.
Change-Id: If9496127db28d2dcd09bc5b3144632a43afb8d55
2014-02-07 18:08:38 -08:00
Elliott Hughes
0df8e4f86c Use socklen_t instead of int in debuggerd.
Also other trivial C++ cleanup.

Change-Id: I9b5278c5205e0ea4f9dcbbe3e7b99921dd2436dc
2014-02-07 12:13:30 -08:00
Stephen Smalley
27a93650c0 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:38:32 -05:00
Elliott Hughes
5d9fe779c8 system/core LP64 cleanup.
Fixes -Wint-to-pointer and -Wpointer-to-int warnings, plus various -Wformat
warnings.

Change-Id: I6c5eea6b4273d82d28b8e5d2925f3e5457511b17
2014-02-05 18:02:11 -08:00
Elliott Hughes
f7b4b519e4 Fix debuggerd's symbol offset output.
Before:
  00007fff33e489d8  00007ff286e4ad94  /system/lib64/libc.so (__libc_init+54u)

After:
  00007fff45c6c158  00007f61bc36fd94  /system/lib64/libc.so (__libc_init+84)

Change-Id: I36796c99843a41583824a96793a5a4c81ddb666e
2014-01-31 23:13:55 -08:00
Elliott Hughes
e9edf7a0ef LP64 should have debuggerd and debuggerd64.
Change-Id: I4e39c200e6867bb9a5bbcfec1c449b8864028feb
2014-01-31 17:15:10 -08:00
Elliott Hughes
6694d3e3d5 Remove dead code that looked like part of debuggerd.
Note that these were two different functions. The definition was unused,
and the declaration was undefined.

Change-Id: I2edd10a0ab9422cd5252bdb9ccdd726dc5fad531
2014-01-31 10:37:18 -08:00
Kévin PETIT
abc60c26b7 AArch64: Port debuggerd
Change-Id: Ib18f76f375a1d70c84e0a09d221e17ac43144b96
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-01-30 18:05:03 -08:00
Pavel Chupin
c6c194ced0 LP64: Enable debuggerd/libbacktrace/libunwind.
Change-Id: I2e432839f86c33c2adbaac8cc12ca8961956044b
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-01-30 17:15:24 -08:00
Kévin PETIT
4bb477205a debuggerd: a few generic improvements
This one makes dump_memory reasonably architecture-agnostic so it is
possible to share the code between architectures.

It also includes a few small improvements in tombstone.cpp.

Change-Id: Ib8a9599bfa420b41e80207988e87aee1b9d79541
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-01-30 15:55:33 -08:00
Christopher Ferris
d391c9b4ac Merge "Re-enable libunwind for arm." 2014-01-28 21:23:50 +00:00
Christopher Ferris
df2906186b Re-enable libunwind for arm.
Update to handle the new optimized way that libunwind works.

In addition, a small refactor of the BacktraceMap code.

A few new tests of for good measure.

Change-Id: I2f9b4f5ad5a0dfe907b31febee76e4b9b94fb76f
2014-01-28 12:03:36 -08:00
Mark Salyzyn
fca0bd1a38 debuggerd: Support newline split in log messages
(cherry picked from commit 706fad2b5f)

Change-Id: I2c19f12ef027ab1e1455ce78824537da1b03edcd
2014-01-27 15:17:13 -08:00
Mark Salyzyn
22b5cef127 debuggerd: Incorporate liblog reading API
(cherry picked from commit a63f927ce1)

Change-Id: Ic26e9dba3b45c827d122b03e34cc4a5bd48f7deb
2014-01-27 15:11:10 -08:00
Christopher Ferris
46756821c4 Rewrite libbacktrace to be all C++.
This includes removing the map_info.c source and replacing it with the
BacktraceMap class to handle all map related code.

Change all callers of libbacktrace map functionality.

Also modify the corkscrew thread code so that it doesn't need to build
the map twice (once in the corkscrew format and once in the libbacktrace
format).

Change-Id: I32865a39f83a3dd6f958fc03c2759ba47d12382e
2014-01-16 16:12:29 -08:00
Christopher Ferris
20303f856f Next phase of the move, reformat use C++ features.
Use the libbacktrace C++ interface instead of the C interface in debuggerd.

Reformat the debuggerd code to be closer to Google C++ style.

Fix all debuggerd casts to be C++ casts.

Add a frame number to the frame data structure for ease of formatting and
add another FormatFrameData function.

Change the format_test to use the new FormatFrameData function.

Modify all of the backtrace_test to use the C++ interface.

Change-Id: I10e1610861acf7f4a3ad53276b74971cfbfda464
2014-01-13 14:21:52 -08:00
Christopher Ferris
d607495b89 Move to C++ for debuggerd.
This is part 1, only including the bare minimum changes because
our diff tool doesn't easily show differences when a file moves. This
also breaks it into a small chunk in case some other changes break things,
as unlikely as I think that will be.

Change-Id: Ib7a3e7a2cc1ac574d15b65fda23813ebcf5d31af
2014-01-10 16:05:12 -08:00
Elliott Hughes
cac5d8c223 Use the more portable <elf.h> instead of <sys/exec_elf.h>.
Bug: 12476126
Change-Id: I08684987e867371d5537dadf1acb3408b420ad0c
2014-01-10 14:40:53 -08:00
Christopher Ferris
9846497f79 Refactor to share map_info amongst threads.
Allow the use of the same map info to be shared when getting information on
multiple threads from the same pid.

Change-Id: I2e460e20154a10f4894ae563331fb32179e4551f
2014-01-08 15:32:28 -08:00
Elliott Hughes
9e7d2180c7 Switch ARM debuggerd over to <sys/user.h>.
Change-Id: I106d4e80a2e819f1d47ca81893340f567bb8b4d9
2013-11-26 18:01:29 -08:00
The Android Open Source Project
66ed50af68 Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
2013-11-22 13:44:43 -08:00
Elliott Hughes
76e7f5e508 Switch MIPS over to <sys/user.h>.
Bug: 11559337
Change-Id: I47ce51ec2d45d9cfdfbb6cccce93a66b0f02d967
2013-11-20 11:31:29 -08:00
Elliott Hughes
18ddd42092 Remove x86 debuggerd dependencies on non-uapi headers and corkscrew.
Also remove a hack that claims to be "just like ARM", but which was
different from the ARM and MIPS behavior.

Change-Id: I9b16da9a56430998ded27d304ce52c7cc8bfedfc
2013-11-14 17:06:46 -08:00
Christopher Ferris
17e91d44ed Rewrite libbacktrace using C++.
The old code was essentially trying to be C++ in C and was awkward. This
change makes it all objects with a thin layer that C code can use.

There is a C++ backtrace object that is not very useful, this code will
replace it.

This change also includes moving the backtrace test to a gtest, and adding
coverage of all major functionality.

Bug: 8410085
Change-Id: Iae0f1b09b3dd60395f71ed66010c1ea5cdd37841
2013-10-28 17:55:25 -07:00
Christopher Ferris
f84f7fa4d2 am 9492b6e7: am 2de8102d: Merge "Fix bug in abort message processing."
* commit '9492b6e72cef71422ba624e3cd11f07156cfb34a':
  Fix bug in abort message processing.
2013-10-09 23:08:59 -07:00
Christopher Ferris
dbd2ab4dca Fix bug in abort message processing.
Bug: 11156592
Change-Id: I4b82e7be5d7fccd167f6c52f78a5af3d3a553779
2013-10-09 18:31:40 -07:00
Christopher Ferris
816c9a64f9 am fa135f5c: am 7dbe9660: Merge "Update debuggerd to use libbacktrace."
* commit 'fa135f5ce95a8eff2ff51c03ad2e9d9b2a8b2274':
  Update debuggerd to use libbacktrace.
2013-10-04 15:42:14 -07:00
Christopher Ferris
365e4ae745 Update debuggerd to use libbacktrace.
Remove all of the code in debuggerd that uses libcorkscrew directly
and replace with libbacktrace.

Also do a bit of refactoring to clean up some functions that were
passing around variables that weren't used.

Bug: 8410085

Change-Id: I27da4fbe3f12ce38a85b4432fc1119984c9c391b
2013-10-03 11:07:56 -07:00
Colin Cross
9227bd3855 Move liblog headers to system/core/include/log
Move the liblog headers to log/ instead of cutils/ to complete
the separation of libcutils and liblog.  cutils/log.h still
exists and includes log/log.h in order to support the many existing
modules that use cutils/log.h.

Change-Id: I2758c9f4aedcb809ca7ba8383d0f55041dd44345
2013-07-24 12:32:39 -07:00
Elliott Hughes
0246f8f6f6 am a570312a: am f265426f: am 596ee9ea: Merge "Improve the crasher stack-overflow command."
* commit 'a570312a56938f6ebfcadc3ec9830ab8a2407654':
  Improve the crasher stack-overflow command.
2013-07-16 10:24:44 -07:00
Elliott Hughes
f265426f02 am 596ee9ea: Merge "Improve the crasher stack-overflow command."
* commit '596ee9ea8ae37b17fbdff91508f55250d528f1d2':
  Improve the crasher stack-overflow command.
2013-07-16 10:21:22 -07:00
Elliott Hughes
b1be27e29b Improve the crasher stack-overflow command.
Runs a lot quicker, with no intermediate noise.

Change-Id: Icd911ff305da2e0889029dc78d5c2b39f32111c5
2013-07-15 17:19:02 -07:00
Nick Kralevich
96bcd488c2 debuggerd: Ignore SIGPIPE
The system server may prematurely close the connection to
/data/system/ndebugsocket if it's not interested in the data
from debuggerd.  If it does so, we don't want to die due to a
SIGPIPE.

Change-Id: Iaef1f497bcd630144e6df6a06644a3293b85b6e0
2013-06-18 17:57:08 -07:00
Elliott Hughes
65d8ec099d am 6ef0dfec: Merge "Add a new test to crasher to upset dlmalloc."
* commit '6ef0dfecca9fde5abe15ceea30e0615897d7b374':
  Add a new test to crasher to upset dlmalloc.
2013-06-12 14:23:29 -07:00
Elliott Hughes
6f40cafd9f Add a new test to crasher to upset dlmalloc.
We should also add a test for heap corruption, but I failed to come up
with a kind of corruption that dlmalloc actually detects (rather than
just crashing accidentally).

Change-Id: I7457e732729635b171ffc44517c3de71f55608e6
2013-06-12 14:04:34 -07:00
Elliott Hughes
82081f71f6 am cb6a842c: Merge "Add a stack overflow test to crasher, and document all the options."
* commit 'cb6a842c6e2048e6cd3c5a2d478113347c75d7aa':
  Add a stack overflow test to crasher, and document all the options.
2013-04-23 19:29:40 -07:00
Elliott Hughes
3808c4ecb4 Add a stack overflow test to crasher, and document all the options.
Change-Id: Iebe80c24ef43f08d258881e7847516d414436931
2013-04-23 17:14:56 -07:00
Christopher Tate
300fd6fdbc Fix regression: log mem maps around native fault address
Restore the logging of the mem maps around the fault address along
with the rest of the faulting thread's information.  (It was still
being written to the tombstone file, but the logging got dropped on
the floor in the refactoring around AM report integration).

Bug 8654694

Change-Id: Id8851fa765dfe6b6ce41ccfc39e85eaac0acc629
2013-04-18 14:12:31 -07:00
Ying Wang
083b5ccba3 Add liblog
Bug: 8580410
Change-Id: Iab3a9b4307f207c14a04a922cc7350c54e60e9ad
2013-04-09 22:03:45 -07:00
Christopher Tate
7716aef138 Uploaded native crash dumps do not include memory contents
Also fixed the LOG() macro to actually write to the log again, tracking
the change in _LOG() argument semantics.

Bug 8322568

Change-Id: I79330c85c26d3ffb734315b6d0f2c0bb80bd234a
2013-04-05 16:30:15 -07:00
Elliott Hughes
e5f8a692e4 Modify debuggerd to cope with the abort message.
(cherry picked from commit 707b8bbe18)

Bug: 8531731
Change-Id: I2785a07ef83e085f338d3094f9972de23117807c
2013-04-05 15:59:17 -07:00
Elliott Hughes
707b8bbe18 Modify debuggerd to cope with the abort message.
Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
2013-04-04 13:52:01 -07:00
Christopher Tate
ded2e5acfc debuggerd now notifies the Activity Manager about native crashes
The Activity Manager sets up a permission-guarded domain socket, which
debuggerd connects to when a crash happens.  If this is successful,
the daemon then mirrors the logged crash report to that socket, then
closes it.

Bug 8322568

Change-Id: Ife0c772a628ef82e8457094e511ce1edbfe57460
2013-04-01 10:37:24 -07:00
Elliott Hughes
e05093b924 am 3e77b752: am 0b535558: Merge "Unwinding implementation via eh_frame sections for x86"
* commit '3e77b7521ba96fd1ff6fed0e019aff5f46a31428':
  Unwinding implementation via eh_frame sections for x86
2013-03-14 17:25:04 -07:00
Pavel Chupin
af2cb3667b Unwinding implementation via eh_frame sections for x86
Backtracing through eh_frame section is more effective allowing to reuse
ebp register for other purposes within routine. GCC with turned on
optimizations (-O1 and above) implicitly defines -fomit-frame-pointer
anyway. eh_frame sections are generated by default with GCC on any
optimization level.

This change implements remote unwinding (separate process unwinding).
Local unwinding is already implemented through _Unwind_Backtrace call
which is implemented in libgcc.

Change-Id: I1aea1ecd19c21710f9cf5f05dc272fc51b67b7aa
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-03-14 19:11:44 +04:00