Commit graph

47740 commits

Author SHA1 Message Date
Tao Bao
599eee1f37 adb: Allow adb rescue getprop.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
2019-06-04 14:59:58 -07:00
Treehugger Robot
0c615194f4 Merge "fs_mgr: overlayfs: pre-emptive filesystem setup" 2019-06-03 14:18:45 +00:00
Treehugger Robot
90ca86ba22 Merge "Close /dev/fuse FD before calling onClosed" 2019-06-03 11:26:25 +00:00
Mark Salyzyn
e0c581fec3 fs_mgr: overlayfs: pre-emptive filesystem setup
If we just disabled verity, take the step to setup the backing
storage for overlayfs.

Test: adb-remount-test.sh
Bug: 130131892
Change-Id: Ic56569eaf363e4417a0ce5df11ee5480a07b8b03
2019-05-31 11:23:01 -07:00
Anton Hansson
03e31332a3 Close /dev/fuse FD before calling onClosed
This works around a deadlock when a bridge that is about to be closed
is reused for a new call to openFile. The call to open() ends up holding
the vold lock, waiting for appfuse to respond. The appfuse event loop
calls onClosed(), which ends up calling vold.unmountAppFuse(), which
cannot get the lock.

Closing this file descriptor causes any current calls to open() on its
mount path to fail with either ECONNABORTED or ENOTCONN, allowing the
event loop to make progress, call onClosed() and unmount the path.

Note that the failed call to open() will result in a retry, which
will create a new appfuse bridge. This is not ideal but not a new
problem -- the common case here is that that each call to
openProxyFileDescriptor creates a new bridge. This should ideally
be improved.

Bug: 132344997
Test: flick through info of photos with location info attached
Change-Id: I878e5cf86f18c5233f8505f52eb9db076bd72d01
Merged-In: I878e5cf86f18c5233f8505f52eb9db076bd72d01
2019-05-31 17:06:52 +01:00
Treehugger Robot
fac0bb7a92 Merge "fastboot: windows: fix Read function" 2019-05-31 15:45:21 +00:00
Fernando Lugo
b7eac2d084 fastboot: windows: fix Read function
Read function exits before reading all requested bytes. Fix that by
looping until the len requested is completed.

This will fix the issue execting get_staged command for a staged image
bigger than 1MB

Test: fastboot get_staged file.txt
Change-Id: Ic70ab48f3a8c8d78c225db638892501d4dc20b13
Signed-off-by: Fernando Lugo <flugo@google.com>
2019-05-30 17:47:49 -07:00
Treehugger Robot
3cb66ad34f Merge "init: Refactor service.h/cpp" 2019-05-31 00:32:34 +00:00
Vic Yang
e01ca4da2d init: Refactor service.h/cpp
Factors out utility functions into service_utils.h/cpp, so that they
can be reused by the upcoming native zygote.

Bug: 133443795
Test: Build and boot cuttlefish.
Change-Id: I0531b6f17561119c8cc33dd9ba375b351747fcfe
2019-05-30 14:24:03 -07:00
Tom Cherry
c76078e4b6 Merge "init: Refactor selinux.h/cpp" 2019-05-30 15:30:49 +00:00
Mark Salyzyn
370aac75ea Merge changes I55d0e1a8,I4d9a8776
* changes:
  adb-remount-test: do not brick devices that support overlayfs but do not use it
  adb-remount-test: provide additional mount details
2019-05-30 00:19:55 +00:00
Treehugger Robot
842cac88e4 Merge "fs_mgr: remount reboot if overlayfs got setup" 2019-05-30 00:07:48 +00:00
Mark Salyzyn
d9b60303a0 fs_mgr: remount reboot if overlayfs got setup
Cosmetic fix.

If overlayfs gets setup by the remount command, ask user to reboot
since the device is not 100% in a state to run, and is merely only
in a state to take push and sync operations.

overlayfs is only truly ready for developing and running if the
overly mounts had occurred in first stage init, this happens when
the device is rebooted.

We did not completely remove overlapping dead ext4 dedupe code in a
previous change, complete the process.

Simplification for adb remount, the message:

    Now reboot your device for settings to take effect

will only occur on the pass that causes the overlays to be populated,
in the same boot session. If subsequent, and ineffectual in any case,
remount command occurs again, it will not request a reboot.

Test: adb-remount-test.sh
Bug: 130131892
Change-Id: I7c4f408546687c49249883e2641b9bc63f68afd0
2019-05-29 16:44:52 -07:00
Treehugger Robot
719790f560 Merge "Minor fixes on android::base::expected" 2019-05-29 23:36:51 +00:00
Treehugger Robot
f777694081 Merge "Fix non-aio USB read issue for fastbootd" 2019-05-29 23:12:42 +00:00
chihhao.chen
8c544b6fd8 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
Vic Yang
92c236e41b init: Refactor selinux.h/cpp
This change factors out functions that handle selabels from
selinux.h/cpp into selabel.h/cpp.  This allows util.cpp to be used by
the upcoming native zygote without a bunch of define flags that are
required for selinux.cpp.

Bug: 133443795
Test: Build and boot cuttlefish.
Change-Id: Ie238a96c6407c6698a605dd8803c1727abfaae7b
2019-05-29 15:09:39 -07:00
Tom Cherry
e20f357f4f Merge changes I16ea9e32,Ib53b5d3e
* changes:
  init: make fatal reboot target configurable
  init: dump stack when aborting
2019-05-29 21:40:12 +00:00
Tom Cherry
75e13baf32 init: make fatal reboot target configurable
Currently, if init encounters a fatal issues it reboots to fastboot
but this may be not desirable in all cases, especially the case of
critical services crashing.  Therefore this change adds the ability
for vendors to customize the reboot target via the
androidboot.init_fatal_reboot_target= kernel command line.

This applies to all LOG(FATAL) messages as well as fatal signals in
userdebug/eng builds, except for signals before logging is enabled in
first stage init.

Bug: 121006328
Test: device reboots to configurable target with LOG(FATAL)
Test: device reboots to configurable target after a segfault in the
      various stages of init
Test: device reboots to fastboot without a configured target
Change-Id: I16ea9e32e2fee08dece3d33b697d7a08191d607b
2019-05-29 09:14:17 -07:00
Jiyong Park
68f5fb2971 Merge "Don't use apexd when TARGET_FLATTEN_APEX == true" 2019-05-29 16:12:05 +00:00
Tom Cherry
59656fb377 init: dump stack when aborting
Dump init stacks when aborting either due to LOG(FATAL) or in
userdebug/eng builds due to signals, including signals from
sanitizers.

Doesn't work for static first stage init yet, b/133450393 tracks
that.

Also, ensure that LOG(FATAL) in child processes calls abort() in all
stages of init, not just 2nd stage init.

Bug: 131747478
Test: abort init in various ways and see stacks
Test: hang or crash in backtrace handler and see child reboot
Change-Id: Ib53b5d3e7e814244203f875de016ada9900dfce8
2019-05-29 08:58:29 -07:00
Mark Salyzyn
b1d78402f9 Merge changes I89826fc2,Ica0c14da,Icfbb799f,I233bbc7b,I30569a7c, ...
* changes:
  adb-remount-test: check devt and inode
  adb-remount-test: add an avc check
  adb-remount-test: parameterize fastboot_wait & adb_wait, increase timeout
  adb-remount-test: report wait duration
  adb-remount-test: check vendor image signature before using
  adb-remount-test: report usb user on unexpected connection
  adb-remount-test: wait-for-screen
2019-05-29 14:25:15 +00:00
Jiyong Park
5c06e6e17b Minor fixes on android::base::expected
This is a follow-up change of 7d89fb164b.

- Some of the missing conditions for SFNAIE were added
- Fixed indentation
- The assignment operator became "= default"

Bug: 132145659
Test: libbase_test

Change-Id: Ib5232a6e5e1d3df67e185d6e8c03374105c1ce94
2019-05-29 08:37:32 +09:00
Tom Cherry
79b0682ec9 Merge "Logcatd: Add new properties control logcat file size and file count." 2019-05-28 22:26:43 +00:00
Jiyong Park
d7f7c208da Don't use apexd when TARGET_FLATTEN_APEX == true
When TARGET_FLATTEN_APEX is true (= ro.apex.updatable is unset or set to
false), apexd is not used to activate the built-in flattened APEXes.
Init simply bind-mounts /system/apex to /apex.

However, there is a special case here. The runtime APEX is installed as
either /system/apex/com.android.runtime.debug or
/system/apex/com.android.runtime.release, whereas it should be activated
on /apex/com.android.runtime - without the .debug or .release suffix.
To handle that case, the build system creates an empty directory
/system/apex/com.android.runtime and the .debug or .release directory
is bind-mounted to the empty directory by init at runtime.

This change also fixes a minor bug that native watchdog is triggered
for all post-apexd processes regardless of whether ro.apex.updatable
is true or not. Since apexd is expected to shutdown itself when ro.apex
.updatable is false, we don't trigger the watchdog in that case.

Bug: 132413565
Bug: 133305381
Test: marlin and sdk_gphone are bootable
Merged-In: I219465b8b81decb960e2c5f46bab6e0768b31317
Change-Id: I219465b8b81decb960e2c5f46bab6e0768b31317
(cherry picked from commit f93088ba2b)
2019-05-29 07:04:27 +09:00
Treehugger Robot
2dca188503 Merge "adb-remount-test: adb_reboot stdin issue" 2019-05-28 21:10:01 +00:00
Treehugger Robot
5f7314b7e1 Merge "recovery: report compliant reboot reason (Part Deux)" 2019-05-28 15:57:24 +00:00
Mark Salyzyn
cfe658a04e adb-remount-test: do not brick devices that support overlayfs but do not use it
restore() should not run adb enable-verity if device does not
use overlayfs even though it supports it.

Test: adb-remount-test
Bug: 132070014
Change-Id: I55d0e1a87eca9c5f258a1587c844f2a6e4b13b29
2019-05-28 08:11:54 -07:00
Mark Salyzyn
67788ef8a1 adb-remount-test: check devt and inode
Check to make sure st_dev and st_ino for the uploaded content
is as expected.

Test: adb-remount-test
Bug: 129319403
Bug: 132395411
Change-Id: I89826fc2740dfd2ead4bcd8988cfbbc315b77b09
2019-05-28 08:08:49 -07:00
Mark Salyzyn
277e413ac4 adb-remount-test: adb_reboot stdin issue
adb reboot can pull stdin content, block it.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I36f0bb7486cec2a18cd2b5550650a19f05c904b5
2019-05-28 08:08:49 -07:00
Mark Salyzyn
d07ab7e544 adb-remount-test: provide additional mount details
For the wipe and remount vendor test, report the df and
mount states to help triage.

Test: adb-remount-test.sh
Bug: 129319403
Change-Id: I4d9a87766d9857a974e601324ab77f69681bfd28
2019-05-28 08:08:49 -07:00
Mark Salyzyn
d5f89343b1 adb-remount-test: add an avc check
Check if adb remount resulted in any unlabeled references just before
rebooting the device.

Test: adb-remount-test.sh
Bug: 129319403
Bug: 132395411
Change-Id: Ica0c14da39773f615d9b5e4cfc4602bd50c70e4e
2019-05-28 08:08:49 -07:00
Mark Salyzyn
53ec0a4649 adb-remount-test: parameterize fastboot_wait & adb_wait, increase timeout
Increase adb_wait time to 3 minutes since blueline device takes
maximum 2:38 (ten samples) to perform a ramdump should an
inopportune kernel panic occur.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: Icfbb799f9420035a755090c9fc5fc2ee05dd68d3
2019-05-28 08:08:49 -07:00
Mark Salyzyn
359c56493c adb-remount-test: report wait duration
Report any unusual durations for how long it took to wait for the
device to come back if --print-time flag.  Also report the boot
reason if unexpected.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I233bbc7b01b025739d7d63191cb62952fa4b7b2a
2019-05-28 08:08:49 -07:00
Mark Salyzyn
00dd058a15 adb-remount-test: check vendor image signature before using
When developing and using the adb remount test, if device under test
is flashed from another source than the current visible tree, make
sure that the vendor image as-built and visible in a sandbox build
is not used indiscriminantly.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I30569a7c871f4c4038b0f7f9c05f5f1a5d12c766
2019-05-28 08:08:49 -07:00
Mark Salyzyn
dbd99f0d2b adb-remount-test: report usb user on unexpected connection
Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I1bc4009b71cac4ac4e06df38cc4da77f2819b88b
2019-05-28 08:08:49 -07:00
Mark Salyzyn
93bb1d0d6d adb-remount-test: wait-for-screen
If we reboot too agressively after a fresh flash either just before
test is run, or after vendor is flashed, we run the risk the device
will consider it a bad boot and head towards recovery or revert to
previous system.

Add checks to wait for the screen.

This can result in the test reporting issues with boot complete,
which will not fail the test currently, but can be used to determine
if the device under test is in a boot loop or fragile state.

Test: fastboot flashall ; adb-remount-test.sh
Bug: 132070014
Change-Id: Ia1b3800c44222cb8fbd9b00e897b32a256996ebc
2019-05-28 08:08:49 -07:00
Treehugger Robot
7d1f11759a Merge "init: replace Result<> with expected<>" 2019-05-27 04:35:26 +00:00
Treehugger Robot
1c144d5a51 Merge "ueventd: add more logging when firmware loading fails" 2019-05-27 03:06:26 +00:00
Treehugger Robot
f261f518ea Merge "memunreachable_test: don't use write to escape addresses" 2019-05-25 00:20:24 +00:00
Mark Salyzyn
7baa970d31 Merge changes I4bee37e1,I801dcec7
* changes:
  adb-remount-test: try to fixup device after reboot (recovery)
  adb-remount-test: try to fixup device after reboot (fastboot)
2019-05-24 21:22:32 +00:00
George Burgess IV
373cb301ad memunreachable_test: don't use write to escape addresses
A recent change
(https://android-review.googlesource.com/c/platform/bionic/+/961601)
caused this test to fail. This change allowed LLVM to optimize what was
previously `__write_chk` into a standard call to `write`.

LLVM knows things about `write`. In particular, it knows that `write`
doesn't capture its buffer param, which `Ref` assumes isn't possible.

LLVM can't reason much about `volatile` operations; storing this to a
`volatile` ptr should be good enough. If not, there are a few other
tricks we can play here.

Bug: 133479661
Test: `atest
memunreachable_test:memunreachable_test.MemunreachableTest#stack --
--abi x86` on internal-master

Change-Id: I905e510210cafdf83fa1b50f2f090d4f8b9653da
2019-05-24 13:51:12 -07:00
Tian, Baofeng
00813a585a Logcatd: Add new properties control logcat file size and file count.
Logcatd has capability to output logs to filesystem with certain size
and certain file count, however file size is not configurable, fixed
as 1024 kbytes, file count is configurable, but original property
name didn't match the logcat parameter well.
This patch add interface rotate_kbytes and count into logcatd.rc.
rotate_kbytes used to control each logcat file size.
count is another alias for logd.logpersistd.size to control file number.

Bug: 133362078
Test: Can use logcat -r -n with configures

Change-Id: I9954c9c125a4ab4e49310986f81c734bf8ee96b3
Signed-off-by: Tian, Baofeng <baofeng.tian@intel.com>
Signed-off-by: Duan, YayongX <yayongx.duan@intel.com>
2019-05-24 07:23:22 +00:00
Tom Cherry
d38aafd20b ueventd: add more logging when firmware loading fails
Bug: 130131892
Test: boots
Change-Id: I82ce0f72341bb44590177cedaa2e3a7990456c1d
2019-05-23 16:27:33 -07:00
Treehugger Robot
9252d31361 Merge "init: add error handling in control message" 2019-05-23 23:08:51 +00:00
Mark Salyzyn
65d8b9be99 recovery: report compliant reboot reason (Part Deux)
shutdown and reboot should have a corresponding sub-reason.

Updating:
    "reboot,userrequested,fastboot"
    "reboot,userrequested,recovery"
    "reboot,userrequested,recovery,ui"
    "shutdown,userrequested,fastboot"
    "shutdown,userrequested,recovery"
    "reboot,unknown#" (Can't happen, debug)

Test: none
Bug: 133326470
Change-Id: Icf1ab0d462ec2de2272914a36994a095998d6186
2019-05-23 13:53:03 -07:00
Mark Salyzyn
b42af0eb5b Merge changes I784bea3a,Id3b2dfdc
* changes:
  adb-remount-test: report lsusb for broken connection
  adb-remount-test: stderr cleanup
2019-05-23 20:03:49 +00:00
Wei Wang
5f01d3af77 init: add error handling in control message
Bug: 133432022
Test: boot
Test: setprop ctl.interface_restart android.hardware.power@1.0::IPower/default success
Test: setprop ctl.interface_restart android.hardware.power@1.0::IPower/abc fail
Change-Id: I66342b2723eb01022fb4e0d98f0b6ffc2752bcac
2019-05-23 12:43:09 -07:00
Tom Cherry
cbe0876f8b Merge "init: don't import rc files during mount_all after Q" 2019-05-23 18:46:51 +00:00
Elliott Hughes
f530dbf671 Merge "Add a std::string overload to Next." 2019-05-23 17:55:27 +00:00