Commit Graph

26763 Commits

Author SHA1 Message Date
Josh Gao 4e0648e7ca Merge "debuggerd_handler: properly crash when PR_GET_DUMPABLE is 0."
am: 90e05f68e2

Change-Id: Ie98457c464d36c183fe1d1c366d7b93ac2594657
2017-01-23 22:37:21 +00:00
Josh Gao 90e05f68e2 Merge "debuggerd_handler: properly crash when PR_GET_DUMPABLE is 0." 2017-01-23 22:30:56 +00:00
Josh Gao fca7ca3585 debuggerd_handler: properly crash when PR_GET_DUMPABLE is 0.
Actually exit when receiving a signal via kill(2) or raise(2) and
PR_GET_DUMPABLE is 0.

Bug: none
Test: /data/nativetest/debuggerd_test/debuggerd_test32
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=pthread_DeathTest.pthread_mutex_lock_null_64
Change-Id: I833a2a34238129237bd9f953959ebda51d8d04d7
2017-01-23 14:13:36 -08:00
Josh Gao 450ad07aaf Merge changes Iacaa796f,I7549f674,Ic9d70880,I96cb09b7,I5c2658a8
am: 400973fa88

Change-Id: I14f9696a3312e34968b1e6966d32c643a2f5f6fc
2017-01-23 20:54:47 +00:00
Josh Gao dac69b6bf1 crash_dump: set a watchdog timer.
am: 7c6e3133f5

Change-Id: I4b7bdbaaa3d37cd3a7c6f68d535d04d4a7163b3e
2017-01-23 20:54:43 +00:00
Josh Gao 6121036e3a crash_dump: switch to PTRACE_SEIZE.
am: 122479f4a0

Change-Id: I8e724349119797cf7d4f8330363db8423a541a5d
2017-01-23 20:54:30 +00:00
Josh Gao 110f6f8df8 crash_dump: clear the default crash handlers.
am: 575941115e

Change-Id: I877a0b4852cc213557aaa4cf0fa84c1aaf9bc180
2017-01-23 20:54:25 +00:00
Josh Gao 742dd98672 crash_dump: remove extra log.
am: d20d687de5

Change-Id: I1a496d47dcca2a05fc45a2b2a19fbe32b1e7fba8
2017-01-23 20:54:19 +00:00
Josh Gao f47ca0f2d5 debuggerd_handler: actually wait for pseudothread to exit.
am: b64dd85c94

Change-Id: I9b850bf980e0d076a332becb948c10be3f322fc7
2017-01-23 20:54:15 +00:00
Josh Gao 400973fa88 Merge changes Iacaa796f,I7549f674,Ic9d70880,I96cb09b7,I5c2658a8
* changes:
  crash_dump: set a watchdog timer.
  crash_dump: switch to PTRACE_SEIZE.
  crash_dump: clear the default crash handlers.
  crash_dump: remove extra log.
  debuggerd_handler: actually wait for pseudothread to exit.
2017-01-23 20:43:05 +00:00
Josh Gao 7c6e3133f5 crash_dump: set a watchdog timer.
PTRACE_DETACH is only necessary if the process is in group-stop state,
the tracer exiting is sufficient to detach and resume tracees.

Using this, set a 5 second timer with alarm(2) that just kills us, to
avoid leaving processes stopped.

Bug: http://b/34472671
Test: debuggerd_test
Test: crasher + manually inserting a 10 second sleep into crash_dump
Change-Id: Iacaa796f79037aa1585f3f2159abe45ef0069311
2017-01-23 11:39:31 -08:00
Josh Gao 122479f4a0 crash_dump: switch to PTRACE_SEIZE.
ptrace(PTRACE_ATTACH) does not immediately put the traced process in a
stopped state. If we manage to call PTRACE_CONT on it before it
finishes, we'll fail. Switch to using PTRACE_SEIZE and PTRACE_INTERRUPT
to guarantee that the target stops immediately.

This also has the advantage of never putting the process in group-stop
state, which means if we exit prematurely (e.g. if we crash during
stack unwinding), the target process will be resumed without any
intervention needed.

Bug: http://b/34472671
Test: while true; do debuggerd -b `pidof audioserver`; done
Change-Id: I7549f67489646cf300b8c9aa8c735e5e897806ef
2017-01-23 11:34:49 -08:00
Josh Gao 575941115e crash_dump: clear the default crash handlers.
crash_dump is a dynamic executable that gets the default crash dumping
handlers set by the linker. Turn them off to prevent crash_dump from
dumping itself.

Bug: http://b/34472671
Test: inserted an abort into crash_dump
Change-Id: Ic9d708805ad47afbb2a9ff37e2ca059f23f421de
2017-01-23 11:34:49 -08:00
Josh Gao d20d687de5 crash_dump: remove extra log.
We're already aborting via LOG(FATAL), there's no reason to log again.

Bug: none
Test: mma
Change-Id: I96cb09b716b19381d6a6931048827ef45f87170b
2017-01-23 11:34:49 -08:00
Josh Gao b64dd85c94 debuggerd_handler: actually wait for pseudothread to exit.
Occasionally, the pseudothread wouldn't exit in time after unlocking
the mutex to get crash_dump to proceed, resulting in spurious error
messages. Instead of using a mutex to emulate pthread_join, just
implement it correctly.

Bug: http://b/34472671
Test: debuggerd_test
Change-Id: I5c2658a84e9407ed8cc0ef2ad0fb648c388b7ad1
2017-01-23 11:34:49 -08:00
Mark Salyzyn 8b844b98e3 Merge "logcat: do not report security buffer errors"
am: 13c15e05d0

Change-Id: I7ba555fa3d7d160e8489f9b6816494dcd093c372
2017-01-23 15:28:45 +00:00
Mark Salyzyn 13c15e05d0 Merge "logcat: do not report security buffer errors" 2017-01-23 15:25:04 +00:00
Josh Gao 95a3a2fc3d Merge "adb: check for and report inotify_init1 failure."
am: 41ee55a875

Change-Id: I5454f46e519aa7b9660f1ec98f445e6d820808e0
2017-01-21 01:10:05 +00:00
Treehugger Robot 41ee55a875 Merge "adb: check for and report inotify_init1 failure." 2017-01-21 01:05:02 +00:00
Mark Salyzyn 26a1facfbf logcat: do not report security buffer errors
Do not report security buffer errors if not specifically
named in the buffer list.

Test: gTest logcat-unit-test --gtest_filter=logcat.security
Bug: 34511645
Change-Id: I028d51abad0329fcf42e467b135d035b06c1d2e3
2017-01-20 15:30:34 -08:00
Josh Gao fb9a7e5995 adb: check for and report inotify_init1 failure.
Bug: http://b/34396687
Test: mma
Change-Id: I55ea84db49017a6533ac54db5072e3e75ba30097
2017-01-20 15:26:00 -08:00
Josh Gao f83489c02c Merge "init: don't start tombstoned until /data is mounted."
am: b479a5002e

Change-Id: I00bbcc2adbdc31486e9fe5e4deed9901feacbb4c
2017-01-20 22:17:53 +00:00
Treehugger Robot b479a5002e Merge "init: don't start tombstoned until /data is mounted." 2017-01-20 22:13:38 +00:00
James Hawkins cd39315a35 Merge "bootstat: Remove debug logging of bootstat_mtime_matches_content."
am: b5e530f720

Change-Id: Id5fffdf3564500b129ccc35a429dd323f422e30b
2017-01-20 21:50:20 +00:00
Treehugger Robot b5e530f720 Merge "bootstat: Remove debug logging of bootstat_mtime_matches_content." 2017-01-20 21:46:56 +00:00
Josh Gao 42a0fed78b init: don't start tombstoned until /data is mounted.
When vold mounts the encrypted /data partition, it first checks for and
kills processes that have open fds to the tmpfs placeholder at /data.
This resulted in a 20 second boot-time regression (vold's timeout period)
when tombstoned was started before vold.

Bug: http://b/34461270
Test: boot is faster, no messages from vold in console spew
Test: tombstoned still started by init
Change-Id: Ib5e9ddb05f40c9da852f00e103861c6ff2d94888
2017-01-20 13:18:51 -08:00
Josh Gao 2bd9fa0612 Merge "crash_dump: don't abort if we fail to attach a sibling."
am: ac0403b1e5

Change-Id: Iadd44cbe99bc21a7d067815960c5aa250ddedde5
2017-01-20 21:07:47 +00:00
Josh Gao ac0403b1e5 Merge "crash_dump: don't abort if we fail to attach a sibling." 2017-01-20 21:02:30 +00:00
Josh Gao 42fd74bd1f crash_dump: don't abort if we fail to attach a sibling.
A TOCTOU race can occur between listing threads and attaching them.
Don't abort and leave the process in a stopped state when this happens.

Bug: http://b/34472671
Test: while true; do debuggerd -b `pidof audioserver`; done
Change-Id: Ib1632c3423fddf506b5c7874223c82fada78a85e
2017-01-20 12:55:07 -08:00
Dave Weinstein 776978788b Merge "Move the kptr_restrict setting from init.rc to init.cpp."
am: c734a0a9ee

Change-Id: Ib8674efbe3d284da593186e8fc2f917e3ff8c077
2017-01-20 20:26:44 +00:00
Dave Weinstein c734a0a9ee Merge "Move the kptr_restrict setting from init.rc to init.cpp." 2017-01-20 20:24:10 +00:00
Mark Salyzyn 17fc5dad3b Merge "logd: test: switch to /data/backup/ for sepolicy avc injection"
am: d289e36847

Change-Id: I80afddde7f550596135dd9549f22f55a95bd3081
2017-01-20 19:45:10 +00:00
Treehugger Robot d289e36847 Merge "logd: test: switch to /data/backup/ for sepolicy avc injection" 2017-01-20 19:42:51 +00:00
James Hawkins a51b165c7a bootstat: Remove debug logging of bootstat_mtime_matches_content.
Bug: 34507152
Test: bootstat_tests
Change-Id: I97f84dd04eb44e6a5d00cf9a2f6b24a5b3e9297f
2017-01-20 11:20:36 -08:00
Mark Salyzyn e79f85ca42 Merge "liblog: BM_log_latency improvement"
am: 9d3722be72

Change-Id: I823a97f19fa9aee1c482c517da3541d70d97722d
2017-01-20 19:09:37 +00:00
Mark Salyzyn 9d3722be72 Merge "liblog: BM_log_latency improvement" 2017-01-20 19:04:54 +00:00
Mark Salyzyn 142b43d4ab liblog: BM_log_latency improvement
This reduces BM_log_latency from ~300ns to ~100ns.  Because, well, we
read the clock earlier and that is what BM_log_latency tries to
measure.  The one major improvement in the switch from kernel logger
to user space logger was that we picked up the timestamp in the
context of the caller before doing anything else, but alas changes
over time neglected this fact and placed isloggable checking ahead
of this important fact.

Test: liblog_benchmarks, check results
Change-Id: I4bc9fc3cf8b1659e88417d967b1d0f3743f9e456
2017-01-20 17:53:27 +00:00
Mark Salyzyn c3c06294e5 logd: test: switch to /data/backup/ for sepolicy avc injection
Resolve issues seen on continuous testing frame:

- statistics test, info instead of fail on missing radio log data.
- sepolicy switch from /data/misc/logd/ to /data/backup/ as the
  directory we access(2) to inject sepolicy violations.  The key here
  is we are still root, but we are in u:r:shell:s0, and the directory
  does not provide us DAC access (0700 system system) so we trigger
  the pair dac_override and dac_read_search on every try to get past
  the message de-duper.  /data/misc/logd is not always there, until
  logpersist is enabled, but /data/backup is always there.
- a stricter signature of '): avc: denied'
- put in a looser threshold for sepolicy_rate_limiter_spam test.

Test: gTest logd-unit-tests --gtest_filter=logd.sepolicy*
Bug: 34454758
Change-Id: I28ce4fdb51dc4869944e3253b593ce222d16ec98
2017-01-20 09:42:02 -08:00
Dave Weinstein 44f7e4f421 Move the kptr_restrict setting from init.rc to init.cpp.
Also ensure that it uses the highest supported value, and
abort if the value is not above a minimum threshold.

Test: Tested against the curent kernel (maximum value of 2,
      set to 0 by the kernel initially) and against a
      modified kernel (maximum value of 4, set to 4 by the
      kernel initially)

Bug: 30368199
Change-Id: I608db577258b68b390ffe96f452e1f7c0bc9ad8a
2017-01-20 09:40:43 -08:00
Jaekyun Seok 57337e7791 Merge "Load default/build props from each partition"
am: 8dbab358f0

Change-Id: Id2330e53018b7e9638383eda697db7550b1a8324
2017-01-20 04:02:20 +00:00
Treehugger Robot 8dbab358f0 Merge "Load default/build props from each partition" 2017-01-20 03:58:52 +00:00
George Burgess IV 5675b05f52 Merge "Fix a call to openat with incorrect arguments"
am: 18044da576

Change-Id: Ib2e858afb84ec87933ba34969b3fd8afb3814a0f
2017-01-20 00:05:29 +00:00
Treehugger Robot 18044da576 Merge "Fix a call to openat with incorrect arguments" 2017-01-19 23:58:22 +00:00
Paul Lawrence f029da5368 Merge "Enable seccomp in init with generated policy"
am: cfb8800e18

Change-Id: I5db39f788e643d299a92a2494873e10dec1d76fb
2017-01-19 23:30:33 +00:00
Treehugger Robot cfb8800e18 Merge "Enable seccomp in init with generated policy" 2017-01-19 23:26:10 +00:00
George Burgess IV 7008c8484d Fix a call to openat with incorrect arguments
Caught by running clang-FORTIFY over Android.

Bug: None
Test: Builds
Change-Id: If138c4bbb7f5fb40bbb20e24adbb25a6ef1286ac
2017-01-19 13:33:52 -08:00
Jeff Sharkey d150012349 Merge "Define GID range for external data and OBBs."
am: 1e7cdf3c7d

Change-Id: I14bab914f585c5d7ad95d63ceb3096981ee4f3a5
2017-01-19 16:23:57 +00:00
Jeff Sharkey 1e7cdf3c7d Merge "Define GID range for external data and OBBs." 2017-01-19 16:16:40 +00:00
Gustavo Padovan 519bf2c698 Merge changes Icb8e6290,Iadde7b21,I743ab92c,Ie078fbc2,I2ab3cd46, ...
am: c42bd0931f

Change-Id: Ic0a59fafc040e778bfce3af97326b090ac8d59d0
2017-01-19 00:42:21 +00:00
Gustavo Padovan 7b98240813 libsync: tests: redefine PollOnDestroyedTimeline()
am: 801492b8a6

Change-Id: I1e75acee45764fa6a3c246edfad544a682fa20bd
2017-01-19 00:42:20 +00:00