Commit Graph

29140 Commits

Author SHA1 Message Date
Felipe Leme 70fd64ec05 Merge "Don't display bugreport progress when it recedes."
am: 450c44052c

Change-Id: Ieff977589b4c41687727099868b548e0072469f8
2017-03-21 02:05:04 +00:00
Treehugger Robot 450c44052c Merge "Don't display bugreport progress when it recedes." 2017-03-21 01:58:12 +00:00
Josh Gao f9d12f272e Merge "adb: switch the jdwp control socket to SOCK_SEQPACKET."
am: 249836158e

Change-Id: Ia42f80f778b2ba78d5d6181038b144c89530f772
2017-03-20 23:28:34 +00:00
Treehugger Robot 249836158e Merge "adb: switch the jdwp control socket to SOCK_SEQPACKET." 2017-03-20 23:24:33 +00:00
Jeff Sharkey 2e86917f92 Merge "Allocate new UID for OTA update resource tracking."
am: 1ed1d3dac9

Change-Id: Ic365e6f4084d063363005cd42b66ee0799691031
2017-03-20 23:11:37 +00:00
Treehugger Robot 1ed1d3dac9 Merge "Allocate new UID for OTA update resource tracking." 2017-03-20 23:04:40 +00:00
Mark Salyzyn 166e24c91b libcutils: fs_config.c code compliance
Comply with clang-format. Adjust some comments.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I459a08b4dc4333ab3d75207621a27587849386a5
2017-03-20 15:32:11 -07:00
Tom Cherry 40578ab91f init: Fix leaking fd and error print
read_file() does not close its fd if either stat() fails or the file
has group/world writable permissions.

Use unique_fd to ensure that all return paths close the fd and make
the same change to write_file() for consistency.

Replace PLOG() with LOG() after a simple if conditional, that does not
set errno.

Old:
init: skipping insecure file '/data/bootchart/header': No such device or address
New:
init: skipping insecure file '/data/bootchart/header'

Test: Cause an invalid file read and check the error log
Test: Ensure non-error read_file() and write_file() work
Change-Id: Ib15d94e38362e335d671d30b36aa5605254ec7ab
2017-03-20 14:40:02 -07:00
Mark Salyzyn e989a22553 fs_mgr: remove private/android_filesystem_config.h
Test: compile
Bug: 33241851
Change-Id: I3807871dcdfe5c751b1eea6e57c1ff5aac15806e
2017-03-20 14:30:48 -07:00
Jeff Sharkey e1bddc78bf Allocate new UID for OTA update resource tracking.
Recent changes to OTA updates started "blaming" network usage on the
system UID, which makes it difficult to triage incoming bugreports
that claim heavy network usage.  Instead, this change gives OTA
updates an explicit UID to make triage easier.

Test: builds, boots
Bug: 36130264
Change-Id: I0a0cc009f3d891b19b419bc12cd237ef8ac64519
2017-03-20 14:57:42 -06:00
Josh Gao b2a7251c55 adb: switch the jdwp control socket to SOCK_SEQPACKET.
Switch the jdwp control socket to SOCK_SEQPACKET so we don't have to
worry about short reads for the PID.

Bug: http://b/36411868
Test: adb jdwp
Change-Id: I908b88e93b1e0ca2895eb8e777d8438a7bbfa92a
2017-03-20 13:37:13 -07:00
Josh Gao 7e5b10b18c Merge "adb: detect closed jdwp socket."
am: e1c4e04f82

Change-Id: Ife55285da64e0c12dac3cd8e8171126c3bb8b543
2017-03-20 20:04:38 +00:00
Josh Gao e1c4e04f82 Merge "adb: detect closed jdwp socket." 2017-03-20 19:57:15 +00:00
Felipe Leme dedcbaad51 Don't display bugreport progress when it recedes.
Also fixed InvalidNumberArgs that broke when usage() was moved out from
bugreport.cpp.

Fixes: 26354314
Bug: 28054087
Test: m -j32 adb_test && ./out/host/linux-x86/nativetest64/adb_test/adb_test --gtest_filter=BugreportTest.*

Change-Id: I7be5ef7de0fb0d339dc80a2abc816e1c905deb22
2017-03-20 11:49:21 -07:00
Josh Gao 3fd78c922c adb: detect closed jdwp socket.
If a process opens a JDWP socket, but crashes before writing the full
PID, adbd will spin forever.

Bug: http://b/36411868
Test: none
Change-Id: I1811759e15c3d9c819685c5fc159a566bd4bc842
2017-03-20 11:11:19 -07:00
Neil Fuller f604ea0783 Merge "Track a Java package rename in comments"
am: 5a258e72fe

Change-Id: I7fcc6eb4412868bccddefbc5bde4e292f8c525a3
2017-03-20 12:53:10 +00:00
Neil Fuller 5a258e72fe Merge "Track a Java package rename in comments" 2017-03-20 12:45:50 +00:00
Neil Fuller c749c9a0a1 Track a Java package rename in comments
Some classes referenced in comments in libcore.tzdata.update2 have
moved to libcore.tzdata.shared2.

Bug: 31008728
Test: mmm system/core/tzdatacheck
Change-Id: I390b375ab8fefbb46e69f4534000ff43ffcceae8
2017-03-20 10:29:00 +00:00
Hans Boehm 12d6afe6f1 Merge "Add heuristic data race detection to sp<>"
am: 04abdc6153

Change-Id: I65a8920f2e44a34da3f3aada6536ad1a54a08ca0
2017-03-19 04:50:24 +00:00
Hans Boehm 04abdc6153 Merge "Add heuristic data race detection to sp<>" 2017-03-19 04:45:37 +00:00
Todd Poynor fa590754c7 Merge changes I1e067235,I01e44473
am: 36aa63eb44

Change-Id: I52a81f40d8fc4cb633eecab8e9aa6d8b7ae84889
2017-03-18 02:03:35 +00:00
Todd Poynor faa2c1f3db Merge "powerctl: add thermal-shutdown command"
am: 3472c1b130

Change-Id: Iad0d78b6f408bdc82740165550fbdccd00f52735
2017-03-18 01:58:06 +00:00
Treehugger Robot 36aa63eb44 Merge changes I1e067235,I01e44473
* changes:
  android_reboot: move reboot reason file to data/misc/reboot/
  libcutils: android_reboot: save reboot reason in file
2017-03-18 01:55:16 +00:00
Treehugger Robot 3472c1b130 Merge "powerctl: add thermal-shutdown command" 2017-03-18 01:50:49 +00:00
Hans Boehm 7f0b2601d3 Add heuristic data race detection to sp<>
Force assignment to read the old pointer value twice, and check
that it didn't change in the interim. Previous experience with
Skia suggests that this has a high probability of correctly detecting
a data race when it occurs, instead of potentially letting the
count associated with the old pointer value get decremented twice,
and corrupting the heap.

This does increase the size of sp assignments, which seem to
commonly get inlined. For the general case, we add a third
comparison and function call.

Some code reformatting to make this consistent with modern conventions
and pass automated checks.

Test: Booted aosp build. Ran libutils tests. Looked at generated code.

Bug: 31227650

Change-Id: Id93a05c6bf10f01ee15ff1bb409611f2058f988f
2017-03-17 17:47:28 -07:00
Todd Poynor e63f366ee3 android_reboot: move reboot reason file to data/misc/reboot/
Move last reboot reason file to new directory data/misc/reboot/ to
require only SELinux permissions specific to this new file.

Bug: 30994946
Test: manual: reboot command, setprop sys.powerctl
Change-Id: I1e067235aa4b06391cff8ab0741a9d317ba5b7da
2017-03-17 17:27:36 -07:00
Todd Poynor eac33da63b libcutils: android_reboot: save reboot reason in file
Save a string identifying the reason for last Android reboot or power
off in file /data/misc/recovery/last_reboot_reason .  This file may
be used for informing users of reboot or shutdown reasons at next
boot, and for other diagnostic purposes.

Bug: 30994946
Test: Manual: reboot, setprop sys.powerctl
Change-Id: I01e44473fdd21b33e9e4dced77aba9a66b6d3755
2017-03-17 17:26:57 -07:00
Todd Poynor 16663a2aa4 powerctl: add thermal-shutdown command
Add sys.powerctl property interface for initiating thermal shutdown.

Bug: 30994946
Test: Manual: setprop sys.powerctl thermal-shutdown
Change-Id: Iffce60bd3cb4b40a5859623d10b91bee5101f168
2017-03-17 17:16:40 -07:00
Tom Cherry d5a201cafe Merge "init: cleanup is_first_stage conditionals"
am: 1d1de8e282

Change-Id: I634e43d40165cddab25c2557839105be0dc27481
2017-03-17 19:46:55 +00:00
Treehugger Robot 1d1de8e282 Merge "init: cleanup is_first_stage conditionals" 2017-03-17 19:41:38 +00:00
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
Dimitry Ivanov ee34aecafe Add ld.config.txt to /system/etc
This file describes how loader should set up
default namespace for different kind of binaries.

Note that vendor and some of system binaries are
not yet ready for this config to be enabled - they
rely on libraries they shouldn't be relying upon.

Bug: http://b/30435785
Test: m
Change-Id: I7d5853a6b55db169be1dc2c38cc682711bf7f7f5
2017-03-17 12:27:37 -07: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
Tom Cherry 34e70410ee init: cleanup is_first_stage conditionals
A recent change to the is_first_stage conditionals created a unneeded
else { } block as both the code in the else { } block and any code
that runs after it are both in the second stage of init.  A first step
to clean this up is to remove this else block.

Secondly, given the above confusion, it makes sense to simplify the two
if (is_first_stage) conditions into one, which only now requires
duplicating one line to initialize logging and the actual "init
first/second stage started!" logs.

Lastly, there are a few commands ran at the beginning of both init
stages that do not need to be,

* boot_clock::time_point start_time = boot_clock::now();
This is only used in the first stage so keep it there

* umask(0);
umasks are preserved across execve() so it only needs to be set in the
first stage

* chmod("/proc/cmdline", 0440);
This needs to be moved until after /proc is mounted in the first
stage, but otherwise only needs to be done once

Test: Boot bullhead, check umask, check cmdline permissions, check
boot time property

Change-Id: Idb7df1d4330960ce282d9609f5c62281ee2638b9
2017-03-17 10:58:17 -07: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