Commit graph

27413 commits

Author SHA1 Message Date
Tom Cherry
554c1fa234 Merge "init: use read_file and write_file to implement do_copy builtin" 2017-04-04 16:42:50 +00:00
Yongqin Liu
dbe88e7953 init: use read_file and write_file to implement do_copy builtin
this will make the implementation more cleaner,
and has error message output when failed on some operations

also add the O_TRUNC flag explicitly for the open function
called in write_file.

And add more test on read_file and write_file functions

Bug: 36726045
Test: manual with hikey
Test: boot and init tests on bullhead
Test: cast with fugu, per b/36726045
Merged-In: If3c30a2fff58cfece2fcd27e69c30382146e6808

Change-Id: If3c30a2fff58cfece2fcd27e69c30382146e6808
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2017-04-04 06:21:29 +00:00
Treehugger Robot
815578cef2 Merge "init: Use std::string for write_file()" 2017-04-04 02:21:55 +00:00
Elliott Hughes
d2d8b68f70 Merge "Show install path in "adb --version" and "fastboot --version"." 2017-04-04 01:16:11 +00:00
Josh Gao
ca8954f7b8 Merge "debuggerd_test: add test for process/thread names." 2017-04-04 01:14:35 +00:00
Treehugger Robot
fd72bbe91f Merge "Make ueventd error messages indicate where the error is in ueventd script" 2017-04-03 23:50:31 +00:00
Tom Cherry
53089aa25c init: Use std::string for write_file()
The content parameter of write_file() previously took a char* that was
then converted to a std::string in WriteStringToFd().  One unfortunate
effect of this, is that it is impossible to write data that contains
'\0' within it, as the new string will only contain characters up
until the '\0'.

This changes write_file() to take an std::string, such that
std::string::size() is used to determine the length of the string,
allowing it to contain null characters.

Also change the path parameter of read_file() and write_file() for
consistency.

Lastly, add a test for handling strings with '\0' in them.

Bug: 36726045
Test: Boot bullhead, run unit tests
Change-Id: Idad60e4228ee2de741ab3ab6a4917065b5e63cd8
2017-04-03 16:41:22 -07:00
Christopher Desjardins
7d3e2c4d4e Make ueventd error messages indicate where the error is in ueventd script
Test: Boot bullhead
Test: Observe errors with file and line number with faulty ueventd.rc

Change-Id: Ieae6151e253f1e6437dfdebd14da4e1e04a45fae
2017-04-03 22:20:55 +00:00
Josh Gao
a5199a9e43 debuggerd_test: add test for process/thread names.
Make sure that we can get the process/thread names for nondumpable
processes with capabilities.

Bug: http://b/36237221
Test: /data/nativetest/debuggerd_test/debuggerd_test32
Change-Id: Iedd4eae18065c2e64abeebff15e3b9b09a630550
2017-04-03 13:18:34 -07:00
Vineeta Srivastava
8bc5c8521a Merge "Add vbmeta image support for verified boot" 2017-04-03 20:13:19 +00:00
Keun-young Park
8aae1b158a Merge "add shutdown animation" 2017-04-03 19:27:34 +00:00
Elliott Hughes
2aeed10a28 Merge "Switch to a shell_and_utilities phony module." 2017-04-03 17:15:17 +00:00
Elliott Hughes
521d303582 Switch to a shell_and_utilities phony module.
(cherrypick of 8ad0e66e77c795d11e9cd5c7b576eed0da60537e.)

Bug: N/A
Test: builds
Change-Id: I700700abb4de76017a2ff811ceff19ea2ee86eb2
2017-04-03 17:14:26 +00:00
Treehugger Robot
7c06d2c79a Merge "Revert "Allocate GID to use reserved disk space."" 2017-04-03 15:14:33 +00:00
Mark Salyzyn
54f20c5553 Merge "liblog: Speed up and extend the radio log redirect code" 2017-04-03 14:21:57 +00:00
Mark Salyzyn
3c013de8d8 Merge changes Ic590c230,Ibd4be82b
* changes:
  logd: liblog benchmark check BM_log_overhead regression
  liblog: benchmark add BM_log_event_overhead_42 for a well known tag
2017-04-03 14:21:41 +00:00
Mark Salyzyn
a9b5a5e96a Merge "logd: correctly label identical lines" 2017-04-03 14:21:13 +00:00
Jeff Sharkey
d185445eee Revert "Allocate GID to use reserved disk space."
This reverts commit 82f8bb785e.

Sadly, we'd have to extend CAP_SYS_RESOURCE to a bunch of execution
domains to make this work, which isn't feasible.

Bug: 36450358
Change-Id: Iffe88e45d538c044382eb0d0ac24ff11a10d73c3
2017-04-03 04:00:36 +00:00
Treehugger Robot
53108b269e Merge "fs_mgr: removing fs_mgr_read_fstab_with_dt()" 2017-04-01 03:05:25 +00:00
Treehugger Robot
145e185ddb Merge "Allocate GID to use reserved disk space." 2017-04-01 01:33:16 +00:00
Keun-young Park
7830d59500 add shutdown animation
- Run shutdown animation during shutdown if surfaceflinger is
  available / running.
- services necessary for animation should be added to animation
  class.
- Keep debugging tools while non-critical services are terminated:
  logd, adbd, tombstoned

bug: 36526187
Test: many reboots

Change-Id: I758f700a622c6005f3df9f29de2b55270055ad4d
2017-03-31 16:48:20 -07:00
Jeff Sharkey
82f8bb785e Allocate GID to use reserved disk space.
Filesystems like ext4 allow the setting of the "resgid" parameter
to designate a GID that is allowed to use the "reserved" disk space
(in addition to UID 0).  We'll be granting this GID to critical
system processes, so that the system is usable enough for the user
to free up disk space used by apps.

Test: builds
Bug: 36450358
Change-Id: I224bd1e597130edb411a1528872faff1ada02a89
2017-03-31 16:39:45 -06:00
Mark Salyzyn
ae2abf112c logd: correctly label identical lines
Move lastTid array from local in LogBuffer::flushTo to per-reader
context in LogTimes::mLastTid and pass into LogBuffer::flushTo.

Replace NULL with nullptr in touched files.

Simplify LogTimeEntry::cleanSkip_Locked initialization of skipAhead
to memset, to match mLastTid memset initialization.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Test: adb logcat -b all | grep chatty | grep -v identical
Bug: 36488201
Change-Id: I0c3887f220a57f80c0490be4b182657b9563aa3f
2017-03-31 13:56:38 -07:00
James Hawkins
bc9cb3885b Merge "bootstat: Refactor init/utils/boot_clock into base/chrono_utils." 2017-03-31 20:47:09 +00:00
Mark Salyzyn
81ab11af67 logd: liblog benchmark check BM_log_overhead regression
Failed to acquire BM_log_print_overhead as it was renamed from
BM_log_overhead in commit 8f2492f582
(liblog: benchmark: Use local LOGGER_NULL frontend')

The test report would not clearly identify which entry was missing, or
unparsed, so unrolled the loop and incorporating the indexes by name
so that gTest failure report offers a much better clue to the problem.

Test: gTest logd-unit-tests --gtest=logd.benchmark
Bug: 36683634
Bug: 27405083
Change-Id: Ic590c230569871651fb716054ecf635385d0f8a2
2017-03-31 13:41:45 -07:00
Mark Salyzyn
fe8c96d152 liblog: benchmark add BM_log_event_overhead_42 for a well known tag
Measure the cost of using a known test event log tag from
system/core/logcat/event.logtags:

42    answer (to life the universe etc|3)

Test: liblog_benchmarks BM_log_event_overhead_42
Bug: 36683634
Change-Id: Ibd4be82bebfcedd381c84e8078cf6d05a636aa98
2017-03-31 13:25:36 -07:00
Vineeta Srivastava
20ef986715 Add vbmeta image support for verified boot 2017-03-31 13:22:34 -07:00
Mark Salyzyn
525b34d142 liblog: Speed up and extend the radio log redirect code
This code was supposed to be deprecated in time.  Let's make it more
efficient and add QC_RIL prefix to the list of catches to redirect
from the main logs to the radio logs.

Test: gTest liblog-unit-tests
Change-Id: I38b371b25da472ec77cbde4affeebf2eafcf6155
2017-03-31 13:10:18 -07:00
Tom Cherry
cf29755e28 Merge "Make init builtin command installkey respect property updates" 2017-03-31 16:41:02 +00:00
Treehugger Robot
5c4af9698c Merge "fs_mgr_avb_ops: stores the by-name prefix of /misc instead of fstab struct" 2017-03-31 04:10:37 +00:00
Treehugger Robot
2e0f8a3b13 Merge "fs_mgr_avb: allow top-level vbmeta struct to be in 'boot' partition" 2017-03-31 03:46:25 +00:00
Treehugger Robot
85a6ca459f Merge changes I20670684,If38c6d14,I94889125,I66169ed5
* changes:
  tombstoned: add tests for b/36685795.
  tombstoned: fix a race between intercept and crash_dump.
  tombstoned: refactor request dequeuing a bit.
  tombstoned: don't increment num_concurrent_dumps until success.
2017-03-31 02:37:22 +00:00
Bowgo Tsai
f5bbfd64a9 fs_mgr_avb_ops: stores the by-name prefix of /misc instead of fstab struct
fs_mgr_avb_ops->read_from_partition() relies on the by-name prefix to
get the device file when reading a partition. Previously we store the
fstab struct and use fs_mgr_get_entry_for_mount_point() for every read.

It's better to do that once and store the by-name prefix for later use.

Bug: 33254008
Test: test AVB on bullhead
Change-Id: Ie999851b529f984e29ccbf39fb52a8220056fe0c
2017-03-31 10:25:04 +08:00
Wonsik Kim
3428d0c2c0 Merge "Revert "init: use read_file and write_file to implement do_copy builtin"" 2017-03-31 00:22:00 +00:00
Wonsik Kim
395e29472f Revert "init: use read_file and write_file to implement do_copy builtin"
This reverts commit 82bac0de6d.

Change-Id: Ibfdf453bd85ba4fcd1948b78bd22e639a883653e
2017-03-31 00:18:13 +00:00
Josh Gao
c1314c8b13 Merge "Revert "adb: check our socketpair ends in our win32 emulation."" 2017-03-30 23:54:24 +00:00
Josh Gao
352a84574d tombstoned: add tests for b/36685795.
Add some tests for edge cases which may have triggered b/36685795.

Bug: http://b/36685795
Test: debuggerd_test
Change-Id: I20670684c8dae422af157be21e44ba5d6d3214d3
2017-03-30 16:49:19 -07:00
Josh Gao
460b336d6a tombstoned: fix a race between intercept and crash_dump.
Previously, there was no way to detect when tombstoned processed an
intercept request packet, making it possible for a intercept request
followed by a crash_dump being processed in the wrong order.

Add a response to intercept registration, to eliminate this race.

Test: debuggerd_test
Change-Id: If38c6d14081ebc86ff1ed0edd7afaeafc40a8381
2017-03-30 16:49:02 -07:00
Josh Gao
807a45807b tombstoned: refactor request dequeuing a bit.
Also make it loop, so that upon failing to start a dequeued crash
request, we continue to the next one.

Bug: http://b/36685795
Test: debuggerd_test
Change-Id: I94889125f16f4681c6fa0fa9cac456302602ce01
2017-03-30 16:19:53 -07:00
Calin Juravle
23fc5afa2d Merge "Set libnativeloader style to clang-format-2" 2017-03-30 22:28:06 +00:00
Calin Juravle
2c317ceaba Merge "Set libnativebridge style to clang-format-2" 2017-03-30 22:27:56 +00:00
Elliott Hughes
1fd46dfa72 Show install path in "adb --version" and "fastboot --version".
Bug: http://b/36766455
Bug: http://b/34691048
Test: ran tests
Change-Id: I4b67ec54d41a281fe7a33c017d3cfbc8055e3b43
2017-03-30 15:10:24 -07:00
Josh Gao
13078245a0 tombstoned: don't increment num_concurrent_dumps until success.
Previously, we would increment num_concurrent_dumps and fail to
decrement it if we failed to start the request. Change this to
only increment after we've successfully started the dump.

Bug: http://b/36685795
Test: debuggerd_test
Change-Id: I66169ed56ed44271e1d8fe1298d95260be7a32a3
2017-03-30 14:51:38 -07:00
James Hawkins
e78ea77f69 bootstat: Refactor init/utils/boot_clock into base/chrono_utils.
Use this for bootstat and init. This replaces the custom uptime parser in
bootstat.

This is a reland of aosp/338325 with a stubbed implementation for Darwin.

This change also has clang_format fixes (automatic).

Bug: 34352037
Test: chrono_utils_test
Change-Id: I72a62a3ca1ccfc0a4ccc6294ff1776c263144686
2017-03-30 14:24:12 -07:00
Josh Gao
3726a0195b Revert "adb: check our socketpair ends in our win32 emulation."
This reverts commit 5990191c4e.

Some Windows users are seeing mismatches between the two ends.

Bug: https://code.google.com/p/android/issues/detail?id=258400
Test: mma
Change-Id: Ie3a121a2754332608ff64b3b016adcb4258d41f3
2017-03-30 13:12:37 -07:00
Treehugger Robot
c65f842cd1 Merge "Add test config to libcutils_test_static" 2017-03-30 18:26:33 +00:00
Christopher Ferris
ce12417925 Merge "Add DwarfMemory class." 2017-03-30 18:10:29 +00:00
Bowgo Tsai
37a0b318ef fs_mgr_avb: allow top-level vbmeta struct to be in 'boot' partition
get_hashtree_descriptor() currently restricts HASHTREE descriptor to be
either in /vbmeta or in the same partition for dm-verity setup.

Also allows it to be from /boot partition because the top-level vbmeta
might be appended at /boot in legacy devices without /vbmeta.

Bug: 35880930
Test: test AVB on bullhead with top-level vbmeta being at /boot
Change-Id: I1ebd16a3c9f17bced6055146e8843b5918a737eb
2017-03-30 20:37:12 +08:00
Dan Shi
d8f533aab2 Add test config to libcutils_test_static
Design doc:
Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap
https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
Change-Id: I9faa1c929fff43635aff06b4228501e1227c4d06
2017-03-29 23:13:08 -07:00
Treehugger Robot
9ead7c4a74 Merge "send SIGTERM only once" 2017-03-30 04:10:41 +00:00