Commit graph

261 commits

Author SHA1 Message Date
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