Commit Graph

28858 Commits

Author SHA1 Message Date
Alex Deymo f27b3da9eb Merge "Update qtaguid tag/untag documentation."
am: 499a0479fa

Change-Id: If601fb9b274f4c0e53c4b6eb066e684822a191db
2017-03-17 19:35:58 +00:00
Treehugger Robot 499a0479fa Merge "Update qtaguid tag/untag documentation." 2017-03-17 19:30:45 +00:00
Mark Salyzyn 9149de0d5c Merge "liblog: test: *.android_errorWriteWithinfoLog__android_logger_list_read__*"
am: 41e54267f3

Change-Id: Ib3aa841d8c97ae83aa10a21f264f8e1bc4411985
2017-03-17 18:41:50 +00:00
Mark Salyzyn 41e54267f3 Merge "liblog: test: *.android_errorWriteWithinfoLog__android_logger_list_read__*" 2017-03-17 18:34:28 +00:00
Alex Deymo 4822b01b12 Update qtaguid tag/untag documentation.
The qtaguid_tagSocket() function tags a network socket by passing a
reference to the given socket to the qtaguid kernel module. The module
will keep the socket alive even if the process calls close() on said
socket. In this scenario, the socket object would not be destroyed
even if all the file descriptor.

While this is at least a memory leak, it plays bad with epoll(7)
if you also didn't remove the socket from the epoll fd before closing
since epoll will not notice that the socket was closed and there is no
way to remove the socket from epoll after it was closed.

This patch updates the documentation to explicitly mention that the
socket must be untag before closing or bad things happen.

Bug: 36264049
Test: None.
Change-Id: I564a9b6d11d22b43a6c12312524386c0338b42ed
2017-03-17 17:48:52 +00:00
Mark Salyzyn 5707524003 liblog: test: *.android_errorWriteWithinfoLog__android_logger_list_read__*
We would experience failures as test runs interfere with each other.
Create a unique tag for each test run signature.  Switch from using
TEST_PREFIX to TEST_LOGGER to identify the logger transport being
inspected and make that part of the signature.  Make sure 32 bit and
64 bit tests do not interfere.

Test: gTest liblog-unit-tests
      cts-tradefed run cts -m CtsLiblogTestCases
Bug: 36232924
Change-Id: I4d58242e5ef8e68e2d4b27cecf538938e17acf3f
2017-03-17 10:41:39 -07:00
Christopher Ferris 639bab97f8 Merge "Elf interface for new unwinder."
am: cc404b51fc

Change-Id: Ie5e8c6814989db86e8888dc59fe7aff2f1fc15d0
2017-03-17 17:05:08 +00:00
Christopher Ferris cc404b51fc Merge "Elf interface for new unwinder." 2017-03-17 17:01:46 +00:00
Mark Salyzyn ecacca30e1 Merge "liblog: tests: __security and enoent failures"
am: 0add3ca7c4

Change-Id: Ib773ae306b0750b4c29470896d4b5cc47c1862bf
2017-03-17 16:58:05 +00:00
Mark Salyzyn 0add3ca7c4 Merge "liblog: tests: __security and enoent failures" 2017-03-17 16:46:42 +00:00
bohu 1284bbbb52 Merge "Emulator: enhance logcat -Q to handle qemu pipe device"
am: a14b5bbd2c

Change-Id: Ib19541aa9b1a18764bfe631a5b0c5bfd7b13a285
2017-03-17 16:30:40 +00:00
Treehugger Robot a14b5bbd2c Merge "Emulator: enhance logcat -Q to handle qemu pipe device" 2017-03-17 16:23:54 +00:00
bohu 94aab86d57 Emulator: enhance logcat -Q to handle qemu pipe device
Upon opening, qemu pipe (a.k.a. goldfish pipe) requires a purpose
string so that emulator can route the content to the right channel
on the host.

This CL will ask emulator to send the content to pipe based 'logcat'
service on the host.

Change-Id:  Icc71f81d5b95b64ea315fe10da82ff704416e449
2017-03-17 16:19:05 +00:00
Mark Salyzyn 58aaee8eb1 liblog: tests: __security and enoent failures
- __security test to allow 20ms resting time after setting ro.device_owner
- enoent test resort to using "su" command if we are not root to start
  and stop the logger.
- Add some instrumentation to guide us in the future if issues.

Test: gTest liblog-unit-tests
      cts-tradefed run cts -m CtsLiblogTestCases
Bug: 36232924
Change-Id: I6b926a1913497f7e6204493fc744ee6c454a5ce4
2017-03-17 09:11:45 -07:00
Mark Salyzyn 898c8a6e51 Merge changes I92cac83b,Ie897c40b
am: 4278f71118

Change-Id: I7cdd5f23e6b654b37f0c03e5d2ce05d2753646ad
2017-03-17 14:25:45 +00:00
Mark Salyzyn 4278f71118 Merge changes I92cac83b,Ie897c40b
* changes:
  logd: wakeup wrap timeout if realtime changes drastically
  logd: cap how far back in-place sort will go to 5 seconds
2017-03-17 14:18:24 +00:00
Mark Salyzyn 5e001776f4 logd: wakeup wrap timeout if realtime changes drastically
--wrap flag in logcat translates directly to the mTimeout inside logd,
the value set is ANDROID_LOG_WRAP_DEFAULT_TIMEOUT defined in
<log/log_read.h> as 7200 or 2 hours.  For a non blocking read with
a selected timeout, the logger waits until either the log buffer is
about to 'wrap' and prune the log entry, or at the specified timeout.
Non blocking in the logger context means that when there are no more
log entries, the socket is closed.

clock_gettime(CLOCK_REALTIME) is UTC 1970 epoch *NIX time. Is only
affected for time updates, not timezone or daylight savings time.
If there is a large user initiated time change, both the log entries
and the timeout mentioned above really get called into question, so we
trigger a release of the logs for clarity.  This is so that the log
reader can handle the disruptively updated time, and can immediately
check the local time if necessary.

The logger has a 5 second window for entries to land in time sorted
order into the logging list.  This should offer the log reader some
differentiation between logging order sequence for monotonically
increasing time, and sequence order in the face of user initiated time
adjustments that break monotonicity.

This change is about major time adjustments that can cause Fear,
Uncertainty or Doubt about log entries.  By returning, immediate action
can be taken, rather than having to comb through the logs with less
details about the time disruptions in hand.  The least it can do is
record what we have, and restart the call with a new tail time and
timeout.

Test: gTest liblog-unit-tests logcat-unit-test logd-unit-tests
Bug: 35373582
Change-Id: I92cac83be99d68634ffd4ebd2f3a3067cfd0e942
2017-03-17 14:17:55 +00:00
Mark Salyzyn 09d663229f logd: cap how far back in-place sort will go to 5 seconds
Add some deterministic behavior should the user change the hour
backwards when altering the device time, prevent sort-in-place
and cause the logger to land the new entries at the end.

Do not limit how far kernel logs can be sorted.

Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: Ie897c40b97adf1e3996687a0e28c1199c41e0d0c
2017-03-17 14:17:38 +00:00
bowgotsai d141190210 Merge "fs_mgr: change the log level in fs_mgr_read_fstab_dt()"
am: b280bb210b

Change-Id: I26f24af7a57a2e23d49956e059a9fd377a6c2c34
2017-03-17 02:14:29 +00:00
Treehugger Robot b280bb210b Merge "fs_mgr: change the log level in fs_mgr_read_fstab_dt()" 2017-03-17 02:12:36 +00:00
Andrew Scull 4614ba5134 Merge "Add eSE AID."
am: e323976e74

Change-Id: I0ce8f821fa1e2028a1d7a1275773b54bd250a612
2017-03-16 18:03:21 +00:00
Treehugger Robot e323976e74 Merge "Add eSE AID." 2017-03-16 17:58:48 +00:00
Josh Gao d8e854fdf1 Merge "crash_dump: fetch process/thread names before dropping privileges."
am: 7390d96ff2

Change-Id: If718a098680cf0fe6026ae1885f3a28363285ebc
2017-03-16 17:50:30 +00:00
Josh Gao 7390d96ff2 Merge "crash_dump: fetch process/thread names before dropping privileges." 2017-03-16 17:45:18 +00:00
Jeff Vander Stoep 9a1ed6106d Merge "init-debug.rc: don't mount debugfs"
am: 54e7365fee

Change-Id: Ie8e0c959e21129dc883c9f8659ef75f05d0b5f2a
2017-03-16 17:36:18 +00:00
Treehugger Robot 54e7365fee Merge "init-debug.rc: don't mount debugfs" 2017-03-16 17:32:47 +00:00
Mark Salyzyn 5a0afe7d27 Merge changes I2a073293,Ia55ef8b9,I79a385fc
am: 82b5c619b8

Change-Id: Iec41ebf6c7cd0ade134e622e9dfec483491f9e9c
2017-03-16 17:14:18 +00:00
Treehugger Robot 82b5c619b8 Merge changes I2a073293,Ia55ef8b9,I79a385fc
* changes:
  logd: continue search out-of-order entries timestamp tail
  logd: drop mSequence from LogBufferElement
  logd: ensure LogBufferElement mSequence is monotonic
2017-03-16 17:09:35 +00:00
Mark Salyzyn 3b941d457b logd: continue search out-of-order entries timestamp tail
Regression from commit 8e8e8db549

For liblogcat reader -t or -T <timestamp> tail requests, continue
search for pertinent out-of-order entries for an additional 30 seconds
back into logging history to find a more inclusive starting point.

For example, if you have an out of order landing like
[..., 3, 6, 1, 8, 2, 5] and ask for 3 you used to get only 5, and now
you get 3, 6, 8, 5 as 'expected'

Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: I2a0732933fa371aed383d49c8d48d01f33db2a79
2017-03-16 16:57:53 +00:00
Mark Salyzyn 5a34d6ea43 logd: drop mSequence from LogBufferElement
Use getRealTime() instead and leverage private liblog log_time
comparison and math functions.  This saves 8 bytes off each
element in the logging database.

Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: Ia55ef8b95cbb2a841ccb1dae9a24f314735b076a
2017-03-16 08:22:00 -07:00
Mark Salyzyn 1d84f0b2af logd: ensure LogBufferElement mSequence is monotonic
- Improves accuracy of -t/-T '<timestamp>' behavior when out of order
  arrival of entries messes with mSequence as the list will now have
  monotonic sequence numbers enforced.
- Out of order time entries still remain because of reader requiring
  the ability to receive newly arrived old entries.
- -t/-T '<timestamp>' can still quit backward search prematurely
  because an old entry lands later in the list.
- Adjust insert in place algorithm from two loops of scan placement
  and then limit against watermark, into one that does all of that
  plus iteratively swap update the sequence numbers to set
  monotonicity.  Side effect will be that the read lock (which is
  actually the LogTimes lock) will be held longer while we search
  for a placement above the youngest LogTimes watermark.  We need
  to hold the read (LogTimes) lock because we may be altering the
  sequence numbers affecting -t/-T '<timestamp>' search.

Test: gTest logd-unit-tests liblog-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: I79a385fc149bac2179128b53d4c8f71e429181ae
2017-03-16 08:13:43 -07:00
Andrew Scull b364328a59 Add eSE AID.
This is used by components that communicate with the embedded secure
element.

Test: Boot system with a daemon and device using this AID.
Bug: 35628284
Change-Id: I1fd1a300c69fefbd19fda69add5d3b098be873c2
2017-03-16 15:05:19 +00:00
Dimitry Ivanov 424bdf9ca1 Merge "Add android::base::Realpath."
am: b3fde950f2

Change-Id: If241249cb24ce43aa91e91008090700b14f3064d
2017-03-16 06:57:07 +00:00
Treehugger Robot b3fde950f2 Merge "Add android::base::Realpath." 2017-03-16 06:53:00 +00:00
Josh Gao 57f58f8e4a crash_dump: fetch process/thread names before dropping privileges.
Processes that don't have dumpable set to 1 cannot have their
process/thread names read by processes that don't have all of their
capabilities. Fetch these names in crash_dump before dropping
privileges.

Bug: http://b/36237221
Test: debuggerd_test
Test: debuggerd -b `pidof android.hardware.bluetooth@1.0-service`
Change-Id: I174769e7b3c1ea9f11f9c8cbdff83028a4225783
2017-03-15 23:30:14 -07:00
Dimitry Ivanov 840b6019c0 Add android::base::Realpath.
Bug: http://b/31396973
Test: libbase_test on host and device
Change-Id: I1e5f15c76227ec1c2128baa38eb454d347987703
2017-03-15 22:20:50 -07:00
Dan Willemsen 5bb9220b75 Merge "Enable more modules on linux_bionic builds"
am: 75c414d1a3

Change-Id: If8a08b3f080344e61ebf5a0555354edb95cfb92e
2017-03-16 02:33:19 +00:00
Treehugger Robot 75c414d1a3 Merge "Enable more modules on linux_bionic builds" 2017-03-16 02:27:54 +00:00
bowgotsai 172c1d8b6e fs_mgr: change the log level in fs_mgr_read_fstab_dt()
Devices having no early mount enabled won't have fstab in device tree.
Lower the log level to INFO when fstab is absent there.

Bug: 35811655
Test: boot into recovery mode in a device without fstab in dt
Change-Id: I4b1e0e6554f50b8118770d00aa8f54be86aca858
2017-03-16 10:25:39 +09:00
Dan Willemsen e0cd1e043d Enable more modules on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: Ib4ebd909322cf464b6a40040e4b60ece7d905b6f
2017-03-15 15:44:00 -07:00
Mark Salyzyn a1f43ebf89 Merge "logcat: test: tail_# occasional failures"
am: e7b335b471

Change-Id: I4176e5e0ef3f0e2b8bc0edc9c49410f516f371f6
2017-03-15 19:04:19 +00:00
Treehugger Robot e7b335b471 Merge "logcat: test: tail_# occasional failures" 2017-03-15 18:55:26 +00:00
Elliott Hughes 3547ba5e3f Merge "Move "fastboot oem" to std::string."
am: 54182110ae

Change-Id: I82a7eb3ab983989a3fbd9829abd28e866c816846
2017-03-15 18:36:04 +00:00
Treehugger Robot 54182110ae Merge "Move "fastboot oem" to std::string." 2017-03-15 18:28:12 +00:00
Elliott Hughes 4a66730d6a Move "fastboot oem" to std::string.
Not sure how this code got missed when we moved everything else off
C string handling...

  $ adb reboot bootloader
  $ fastboot oem `perl -e 'print "x"x1024;'`

Before:
  <crashes>

After:
  error: Command length (1028) exceeds maximum size (64)

(The error says 1028 instead of 1024 because it includes the "oem ".)

Bug: http://b/36232671
Test: fastboot oem `perl -e 'print "x"x1024;'`
Change-Id: Ib4664e49222bd2b71be5aa3fe81f386d6073414f
2017-03-15 09:40:28 -07:00
Andreas Gampe 0daaa5aec8 Merge "Logd: Fix wrong parameters"
am: 913ad12543

Change-Id: I4046e79b452c4be8dc75e774aa7bb9264c602b10
2017-03-15 15:41:56 +00:00
Treehugger Robot 913ad12543 Merge "Logd: Fix wrong parameters" 2017-03-15 15:38:14 +00:00
Evgenii Stepanov 591b09650b Merge "Fix heap-buffer-overflow detected by ASAN."
am: 3d028f14c8

Change-Id: Ia3c137490fae9da00f73dedd414ba2b8cd04a975
2017-03-15 06:52:56 +00:00
Treehugger Robot 3d028f14c8 Merge "Fix heap-buffer-overflow detected by ASAN." 2017-03-15 06:46:28 +00:00
Jeff Vander Stoep 082807f3b4 init-debug.rc: don't mount debugfs
Motivation:
1. Reduce skew between userdebug and user builds.
2. Make the decision to mount debugfs on debug builds on a
   per-device basis.
3. Prepare to not mount it at all to reduce the attack surface
   of the kernel, reduce boot time, and free up memory.
4. Remove the selinux denial on devices that mount twice, i.e.
   unconditionally in the device specific .rc file and in the
   init-debug.rc file.
   avc: denied { mounton } for path="/sys/kernel/debug" dev="debugfs"
   ino=1 scontext=u:r:init:s0 tcontext=u:object_r:debugfs:s0
   tclass=dir permissive=0

If desired, debugfs may be mounted in device specific rc files
instead.

Bug: 31856701
Bug: 35197529
Test: Build and boot Marlin. Selinux denial no longer observed.
Change-Id: Ie0d954f77f7cf70ed2b94f67a57a6c9eba45ba8e
2017-03-14 21:56:24 -07:00