Commit Graph

29218 Commits

Author SHA1 Message Date
Mark Salyzyn bc1d2aeff9 logd: test: logd.sepolicy* errors
If setcon fails, try alternate setcon, and then if it still
fails call getcon to confirm if it is an OK sepolicy context
anyways.

Test: gTest logd-unit-tests --gtest_filter=logd.sepolicy*
Change-Id: Iaf20b8a1a4a7312247288e1879884a54893c15ae
2017-04-06 07:40:10 -07:00
Treehugger Robot 3d5cd59d73 Merge "Add test config to bootstat_tests" 2017-04-06 03:01:29 +00:00
Treehugger Robot 66b8491719 Merge "libcutils: fs_config: target_out_path assumed /system" 2017-04-06 00:03:14 +00:00
Christopher Ferris ff93b794b5 Merge "Convert opens to use unique_fd." 2017-04-05 22:47:25 +00:00
Mark Salyzyn 7130fb345d libcutils: fs_config: target_out_path assumed /system
Strip off /system/ and add appropriate config directory.

Test: manual build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: I2563248e91cea10fef3cc2f9e954e4782fdfce4f
2017-04-05 22:32:22 +00:00
Mark Salyzyn acc0e98b0f Merge "liblog: worry over resource leaks" 2017-04-05 22:28:38 +00:00
Mark Salyzyn 191afba9bd liblog: worry over resource leaks
Add comments so that future selves can clearly see there are no file
descriptor resource leaks on normal return.

SideEffects: None
Test: Build
Change-Id: Ieec504fea00fb849cdb69c669655a918d1334e61
2017-04-05 13:02:08 -07:00
Christopher Ferris 48d08c2c9d Convert opens to use unique_fd.
Fixes a potential leak of fds in WriteStringToFile.

Test: I wrote a temporary test that failed the fchmod on host in
Test: WriteStringToFile. I verified this fails with the old code after running
Test: out of fds and passes with the new code.
Change-Id: I168160841e35dd480d59a69bb4aa8176899fbb32
2017-04-05 12:30:12 -07:00
Christopher Ferris 568dc01fdf Merge "Add Symbols parsing." 2017-04-05 17:26:32 +00:00
Rubin Xu 7887dd8567 Merge "Fix liblog#__security failure" 2017-04-05 17:22:43 +00:00
Dan Shi 0f0cccc102 Add test config to bootstat_tests
This change allows TradeFederation to run the test directly.
Refer to b/35882476 for design and discussion of this change.

Bug: 35882476
Test: local test
tradefed.sh run template/local --template:map test=bootstat_tests

Change-Id: I3bc2fa19faebe21f6faf8b81e206ea1581918344
2017-04-05 14:49:47 +00:00
Rubin Xu 235cf8d729 Fix liblog#__security failure
Update pid and gid value after calling setuid()

Bug: 36480230
Test: cts-tradefed run cts -m CtsLiblogTestCases -t liblog#__security_buffer
Change-Id: I707f7c724d64236ec17f2d978c85883a7b4f180f
Merges-In: I707f7c724d64236ec17f2d978c85883a7b4f180f
2017-04-05 11:27:48 +01:00
Treehugger Robot c1c0de3945 Merge "Add test config to libcutils_test" 2017-04-05 06:39:42 +00:00
Josh Gao 8b951f5adc Merge changes Ib8369088,I743433bc
* changes:
  debuggerd_test: remove useless pipe.
  debuggerd_client: fix infinite timeouts.
2017-04-05 04:20:14 +00:00
Treehugger Robot 7bbd2a5290 Merge "init.rc: add class_start early_hal" 2017-04-05 00:35:00 +00:00
Dan Shi dccf5a1dc8 Merge "Add test config to libappfuse_test" 2017-04-05 00:04:39 +00:00
Treehugger Robot 47356e69fe Merge "logcatd: introduce logcatd executable" 2017-04-04 21:48:23 +00:00
Christopher Ferris e7ba4cc222 Add Symbols parsing.
Bug: 23762183

Test: New unit tests pass.
Change-Id: Ib67fee879120b5e82889076a0f7221dc429ac140
2017-04-04 14:41:34 -07:00
Steven Moreland 5d56bad4bd init.rc: add class_start early_hal
This class is used to start hals which are required in order to mount
data (for instance keymaster).

Test: works to start early_hal in internal
Bug: 36278706
Change-Id: If06908135e59b187683d8cf4cc4a00b490559081
2017-04-04 21:22:47 +00:00
Josh Gao 951cf70071 debuggerd_test: remove useless pipe.
Bug: http://b/36897117
Test: none
Change-Id: Ib8369088153fe44de2af9037299bdfce7b709b98
2017-04-04 14:09:04 -07:00
Josh Gao 287d50dc59 debuggerd_client: fix infinite timeouts.
Bug: http://b/36897117
Test: debuggerd_test
Test: debuggerd -b `pidof zygote`
Change-Id: I743433bc420b1c433b82ef62795abb6ea9f5d840
2017-04-04 14:08:54 -07:00
Christopher Ferris 3f220aaa63 Merge "Add DwarfOp support." 2017-04-04 20:53:43 +00:00
Treehugger Robot b15882faab Merge "logd: cap out-of-order entry search" 2017-04-04 19:41:52 +00:00
Christopher Ferris 55d22ef67c Add DwarfOp support.
Bug: 23762183

Test: New unit tests pass.
Change-Id: I9581701ee2721283a1114adab4e1bcff881980cc
2017-04-04 12:35:50 -07:00
Treehugger Robot 4b8087aeb2 Merge "adb: don't reset usb when connecting it." 2017-04-04 19:29:09 +00:00
Mark Salyzyn 832f6c704a Merge "libcutils: create private/fs_config.h" 2017-04-04 19:15:09 +00:00
Mark Salyzyn a9403f0db8 libcutils: create private/fs_config.h
private/fs_config.h is required in order to build an independent
test that requires internal binary knowledge of the
etc/fs_config_(files|dirs) files.

Test: compile
Bug: 36071012
Change-Id: I268bcfdbb6d45b7bf6040cbf307a4e34812f5fef
2017-04-04 19:14:32 +00:00
Mark Salyzyn 0f92fdc5d6 logd: cap out-of-order entry search
Reduce the period we are willing to look back at for out-of-order
entries.  Cap the number of iterations we are willing to look back
for out-of-order entries to 300.

Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 36875387
Bug: 36874561
Bug: 36861142
Change-Id: Icee289dfc0a37ccab9912dc8ab40a10ef3967b7a
2017-04-04 11:03:26 -07:00
Christopher Ferris 69b4dfe13e Merge "Add overflow checks in Memory objects."
am: 856bccbdc3

Change-Id: Id9e9c65c724d1ce75cc3cefed06d14f5785d2259
2017-04-04 17:37:15 +00:00
Christopher Ferris 856bccbdc3 Merge "Add overflow checks in Memory objects." 2017-04-04 17:29:49 +00:00
Yabin Cui 5d002b8d6a adb: don't reset usb when connecting it.
Calling libusb_reset_device() resets the usb connection with device
on linux platform. It can interfere with other usb interfaces and only
works on linux.
Removing it only affects when adb server is killed while doing IO with
device, which will be solved in later patches.

Bug: http://b/32952319
Test: none
Change-Id: I19522435eadd938ff95d49cbae3bcaa5c8f6d184
2017-04-04 10:29:21 -07:00
Mark Salyzyn d3d3dddd31 Merge "logcat: Add -h and --help flags"
am: 23e308398f

Change-Id: Icffb5b13a46f9fe3e1903cf1255b7218948c2db8
2017-04-04 16:54:22 +00:00
Tom Cherry ed73c21658 Merge "init: use read_file and write_file to implement do_copy builtin"
am: 554c1fa234

Change-Id: I4a2a2d86780a34cc3d5b4c17396ebba6681aae8d
2017-04-04 16:50:53 +00:00
Treehugger Robot 23e308398f Merge "logcat: Add -h and --help flags" 2017-04-04 16:50:19 +00:00
Tom Cherry 554c1fa234 Merge "init: use read_file and write_file to implement do_copy builtin" 2017-04-04 16:42:50 +00:00
Mark Salyzyn a073c39616 logcatd: introduce logcatd executable
logcatd is the same as logcat, except that the -L flag, if supplied,
runs once, then the command re-runs itself without the -L flag with
the same argument set.  By introducing a logcatd daemon executable
we can solve the problem of the longish reads from pstore that
sometimes occur when the system is excessively busy, starving this
background cgroup daemon as we absorb the delay in a backgrounded
init "service", rather than in a forgrounded init "exec".  This would
not have been efficiently possible without the introduction of
liblogcat.

There are no doubt many flags that make no sense to run twice with,
and without, the -L flag.  In the general sense we expect the caller
to perform the correct set of operations and not pick these nonsense
operations.  logcatd is only supplied on engineering and debug builds
for logpersist, and is only an automated aid to triage.

Test: gTest logcat-unit-tests
Test: manual confirm logpersist functions as expected, required reboot
Bug: 28788401
Bug: 30041146
Bug: 30612424
Bug: 35326290
Change-Id: I53ba31970749daf37eef42636f039f485932416f
2017-04-04 08:01:50 -07:00
Mark Salyzyn e74e51ded7 logcat: Add -h and --help flags
If -h or --help argument was supplied, logcat would report the help
message but also return an error.  Officially add -h and --help as
recognized flags, report all help with a (zero) success error code.
Adding this, and the associated test, was split off as a stepping
stone to resolving an issue with logcat -L or --last flag operations.

Test: gTest logcat-unit-tests --gtest_filter=*.help
Bug: 28788401
Bug: 30041146
Bug: 30612424
Bug: 35326290
Change-Id: I948e7fa4e92bd23f52717758ffd96bbd068c53d4
2017-04-04 08:01:11 -07: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
Tom Cherry 5ff631620e Merge "init: Use std::string for write_file()"
am: 815578cef2

Change-Id: I58b3804b67967514d04a771da5a39efd9de9d218
2017-04-04 02:34:00 +00:00
Treehugger Robot 815578cef2 Merge "init: Use std::string for write_file()" 2017-04-04 02:21:55 +00:00
Christopher Ferris f447c8eb20 Add overflow checks in Memory objects.
Also change one of the reads to be explicitly ReadField instead of an
overloaded Read function.

Bug: 23762183

Test: Passes new unit tests.
Change-Id: Id848f7b632f67df0c5b7318d9e588942cfd2099a
2017-04-03 18:36:33 -07:00
Elliott Hughes 8aac990de2 Merge "Show install path in "adb --version" and "fastboot --version"."
am: d2d8b68f70

Change-Id: I3fac85f01f08c277bdc4ccc8ebbb22ddb9f3397f
2017-04-04 01:23:40 +00:00
Josh Gao 330b6fd878 Merge "debuggerd_test: add test for process/thread names."
am: ca8954f7b8

Change-Id: I13fe3d3715458c41630adc2a221881dd0a8a9ccb
2017-04-04 01:23:26 +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
Christopher Desjardins ec2fb683ff Merge "Make ueventd error messages indicate where the error is in ueventd script"
am: fd72bbe91f

Change-Id: I5a6637721475e5cc6cef6e1240b8ce753fc983f5
2017-04-03 23:56:49 +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
Vineeta Srivastava 5e3590e81e Merge "Add vbmeta image support for verified boot"
am: 8bc5c8521a

Change-Id: I7de333ee2b7502c0040c2f27f36c8059e188ec03
2017-04-03 20:23:15 +00:00