Commit graph

249 commits

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