Commit graph

353 commits

Author SHA1 Message Date
Elliott Hughes
6fff551728 Teach debuggerd about SIGSYS SYS_SECCOMP signals.
These should be easier to interpret.

Bug: http://b/31171101
Change-Id: I362361d218390ab2306f86976172f8365b26b6ef
2016-09-07 13:55:50 -07:00
Christopher Ferris
f83c7923f9 Update for kernel headers v4.7.2.
The new uapi kernel headers added a new SEGV reason code, so
add it to the tombstone code.

Update sync.c to include the needed data structures itself. Someone
else will be fixing this to work on old versus new kernels.

Change-Id: Icb27713ea38a20003c7671a9bca262eebd96099b
2016-08-26 16:48:18 -07:00
Mark Salyzyn
2d562c9dce Merge "logger: validate hdr_size field in logger entry"
am: fcf7ab8b1b

Change-Id: Ic88fe616256ab4949040771d3bed1dfb823ab981
2016-08-24 16:05:04 +00:00
Treehugger Robot
fcf7ab8b1b Merge "logger: validate hdr_size field in logger entry" 2016-08-24 15:56:23 +00:00
Elliott Hughes
8615d79d85 Merge "Most accept/accept4 calls in system/core don't actually want the remote address."
am: 299d64144b

Change-Id: I3fb9678dfed08f0b1d6e90e547ecae6cdcabc9a1
2016-08-23 23:03:20 +00:00
Treehugger Robot
299d64144b Merge "Most accept/accept4 calls in system/core don't actually want the remote address." 2016-08-23 22:48:24 +00:00
Mark Salyzyn
305374cf0f logger: validate hdr_size field in logger entry
- check hdr_size to make sure it is in the expected range
  from sizeof entry_v1 to entry (entry_v4).
- alter msg() method to report NULL on invalid hdr_size
- alter all users of msg() method.

Bug: 30947841
Change-Id: I9bc1740d7aa9f37df5be966c18de1fb9de63d5dd
2016-08-23 14:51:50 -07:00
Josh Gao
504d4ccd7c Merge "debuggerd: don't display fault addr for manually sent signals."
am: ad52cbb9ec

Change-Id: I34284b398c32dbdfe2074d44d316f81fc45deee8
2016-08-23 21:23:15 +00:00
Treehugger Robot
ad52cbb9ec Merge "debuggerd: don't display fault addr for manually sent signals." 2016-08-23 21:03:18 +00:00
Elliott Hughes
0d2ef3dc86 Merge "debuggerd: set SOCK_NONBLOCK in accept rather than later."
am: 82b67fff06

Change-Id: I6f2e72a4847fbfac8e1ba78321be7e026f7629bd
2016-08-23 20:05:48 +00:00
Elliott Hughes
3dcfa3fb1c Most accept/accept4 calls in system/core don't actually want the remote address.
So don't write the extra code for it or waste the kernel's time
copying it around.

Change-Id: I93de64064c2d4fe58ba5b5322cfa69bf31a76dad
2016-08-23 12:50:00 -07:00
Josh Gao
344ca5a681 debuggerd: don't display fault addr for manually sent signals.
Bug: http://b/30819045
Change-Id: Ic8ab21298dcba6acdfa876e7c729b14b0bf2afbb
Test: `killall -TRAP surfaceflinger` no longer shows fault addr,
      crasher still does
2016-08-23 12:31:14 -07:00
Elliott Hughes
874c674c60 debuggerd: set SOCK_NONBLOCK in accept rather than later.
Change-Id: I95586984dd7aec798d75b150be238d5f6f7c91da
2016-08-22 14:17:25 -07:00
Josh Gao
60083bed75 Merge "debuggerd: remove unnecessary arguments."
am: 7a746f3a68

Change-Id: I0a01639dd3096372eb5bbbe28362cdbf1c1da4af
2016-08-13 00:38:54 +00:00
Josh Gao
4c4a172ee9 Merge "debuggerd: remove useless timeout from wait_for_signal."
am: 5f2bc28ebf

Change-Id: Iee4f22c04ad330c91f86ca03583f8e36b2816039
2016-08-12 20:02:10 +00:00
Josh Gao
a04c80255c debuggerd: remove unnecessary arguments.
These were previously required when bionic used tgkill to reraise
signals, but now that we use rt_tgsigqueueinfo to reraise signals, they
are no longer necessary.

Change-Id: I46ba9f14039a727d0a2c4c3a9d93a3532ba8f263
2016-08-12 11:00:18 -07:00
Josh Gao
f5a960a187 debuggerd: remove useless timeout from wait_for_signal.
The watchdog already handles things for us, so the timeout logic in
wait_for_signal is pointless.

Change-Id: Id81ad5f294068216b73e04c4e2ceca072ae1bbc0
2016-08-12 11:00:18 -07:00
Josh Gao
40efc4c664 Merge "Define TARGET_IS_64_BIT when building libdebuggerd_client for android64."
am: 07f14c9cdd

Change-Id: Ieac230f7a5cd0107420f0f5dfc84d1d9a19e70e0
2016-08-10 22:23:06 +00:00
Robert Sesek
9eb02c973f Define TARGET_IS_64_BIT when building libdebuggerd_client for android64.
This is needed to connect to the right debuggerd server for the crashing
process. Without this change, the following errors are observed, because a
32-bit process is trying to connect to the 64-bit debuggerd (as opposed to
debuggerd32):

  Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 14153 (static_crasher)
  debuggerd: handling request: pid=14153 uid=0 gid=0 tid=14153
  debuggerd: Not allowed to redirect action 0 to 32 bit debuggerd

Bug: 24414818
Change-Id: I2f275fbc804b0abc6e876a743e51dd8494817103
2016-08-09 14:04:05 -04:00
Chih-Hung Hsieh
89cc78b77f Merge \"Fix google-explicit-constructor warnings in system/core.\"
am: 6dc68cb5f9

Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
2016-07-29 17:01:17 +00:00
Chih-Hung Hsieh
034c475931 Fix google-explicit-constructor warnings in system/core.
* Declare explicit conversion constructors.
* Add NOLINT for implicit conversion constructors.
* Fix also some misaligned indendations.

Bug: 28341362
Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e
Test: build with clang-tidy
2016-07-26 11:26:01 -07:00
Pirama Arumuga Nainar
89cc8a57f4 Merge \"Disable warnings triggered in Clang r271374\"
am: fa1a21d085

Change-Id: I8ae8ec5436e7dc1173e463307ba0e925861156a0
2016-07-19 23:41:49 +00:00
Pirama Arumuga Nainar
6fbbc4cdfa Disable warnings triggered in Clang r271374
http://b/28149048
http://b/29823425

Disable -Wvarargs that gets triggered in
system/core/debuggerd/test/ptrace_fake.cpp:ptrace_fake.  The second bug
above tracks that this warning gets re-enabled.

Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

Change-Id: Ife68675a77431bcc4717b4da297c14dc486d1413
2016-07-19 20:29:05 +00:00
Colin Cross
68bfe51348 Merge \"Rename Android.soong.mk to Android.mk\"
am: b07df4dd3f

Change-Id: I9d9a232539b9991ab935e143140a3b77d896ebc7
2016-07-12 16:20:21 +00:00
Colin Cross
b39e4025ae Rename Android.soong.mk to Android.mk
Soong is always on now, so we don't have to distinguish between
makefiles that should be ignored because Soong is handling them with an
Android.bp file, and makefiles that are still needed with Soong.  All
obsolete Android.mk files have been removed, rename all Android.soong.mk
files to Android.mk.

Change-Id: Iabbddcbfb2c837cfd4556241b570474452cc5d4d
2016-07-11 16:56:51 -07:00
Josh Gao
88347e1430 Merge changes from topic \'debuggerd_client\'
am: abf88685e3

Change-Id: I2a61e4e8b5ec5a4ab6566ab4f8eb31653255fbc5
2016-06-20 20:47:18 +00:00
Treehugger Robot
abf88685e3 Merge changes from topic 'debuggerd_client'
* changes:
  adb: use libdebuggerd_client.
  debuggerd: add libdebuggerd_client.
2016-06-20 20:22:18 +00:00
Christopher Ferris
e1eb2272d6 Merge \"Fix race condition updating local map data.\"
am: 863d8e11b9

Change-Id: I00899ce500c2ae8bc58b6eb42c01d8688dd232c0
2016-06-18 00:05:26 +00:00
Josh Gao
9c02dc5916 debuggerd: add libdebuggerd_client.
Bug: http://b/24414818
Change-Id: I079c534d2c952b6975bf0428eb86cc7a55525737
2016-06-17 13:11:29 -07:00
Christopher Ferris
3a14004c7f Fix race condition updating local map data.
If the underlying local map changes, it's possible for multiple
threads to try and modify the map data associated with the UnwindLocalMap
object. Add a lock when generating the local map to avoid this problem.

In addition, add a read lock whenever any caller gets the maps iterator.
Updated all iterator callers to make this lock.

Bug: 29387050
Change-Id: Ie34822c3d8fd3bdb3dd126aeeb399969c36508c1
2016-06-16 23:28:11 -07:00
Chih-Hung Hsieh
dccd3a3698 Merge "Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace." am: dab7d9de03
am: fa7569c921

* commit 'fa7569c921b9ca0db894287ea826cbd3b041d880':
  Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.

Change-Id: I63223e36f3627d312051c86d54919b6cef33766c
2016-05-19 00:05:39 +00:00
Chih-Hung Hsieh
67867dbd79 Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.
Bug: 28705665
Change-Id: I469b2a882f6d1f399bfc22c75a26da245991fc33
2016-05-18 15:53:15 -07:00
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