Commit graph

47941 commits

Author SHA1 Message Date
Tom Cherry
bbcbc2ffb3 init: replace Result<Success> with Result<void>
Now that Result<T> is actually expected<T, ...>, and the expected
proposal states expected<void, ...> as the way to indicate an expected
object that returns either successfully with no object or an error,
let's move init's Result<Success> to the preferred Result<void>.

Bug: 132145659
Test: boot, init unit tests
Change-Id: Ib2f98396d8e6e274f95a496fcdfd8341f77585ee
2019-06-10 12:39:18 -07:00
David Anderson
7a6ce0623f Merge "liblp: Replace some |const char*| inputs with std::string." 2019-06-10 19:09:56 +00:00
Jaegeuk Kim
5ffa970489 fs_mgr: support -o sync
Bug: 134172577
Change-Id: I1ad8811b07657727d8227d3668f58b0fbc7e7609
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-06-10 10:57:52 -07:00
Neil Fuller
e59703319f Merge "Switch tzdatacheck to comparing tzdata module file" 2019-06-10 17:40:51 +00:00
Tom Cherry
caa95d551d Merge "logd: handle uidToName() directly" 2019-06-10 15:27:13 +00:00
Tom Cherry
727762ef07 Merge "base: Add MmapFile as a synonym for MappedFile" 2019-06-10 15:26:13 +00:00
Neil Fuller
09bdb325a7 Switch tzdatacheck to comparing tzdata module file
The old "time zone updates via APK" feature installs time zone data
files in /data. tzdatacheck is run during boot to guard against an
OTA leaving the data in /data older, or in a different format, than the
files that exist elsewhere on device. If such files existed the system
could use old versions of tzdb (and related) data or even end up
unstable.

Soon, the time zone data mainline module will be made "functionally
mandatory" by the removal of most time zone data files from the
runtime module APEX, i.e. the time zone data module cannot be absent,
and the runtime module won't have files to compare against.

This change modifies the command line args for tzdatacheck to reference
the contents of time zone data module instead of the runtime module.

Bug: 132168458
Test: Build / boot / inspect logcat
Change-Id: Iac8023b7cbb72213df344d603c121caa867a196f
2019-06-10 11:02:44 +00:00
Jiyong Park
d2217b5167 Read *.rc files from flattened APEX
This change fixes a bug that *.rc files in APEXes are not read when the
APEXes are flattened. This was because init used "/apex/*@*/etc/*.rc"
glob pattern to find the files, which gives 0 result with flattened
APEXes; with flattend APEXes /system/apex is just bind-mounted to /apex,
and therefore, the name@version directories don't exist.

Fixing the issue by globing /apex/*/etc/*.rc and filter-out the paths
with @ to avoid double parsing the *.rc files in case of non-flattend
APEXes.

Bug: 134067086
Test: revert I75ec6b69cca1cef071b50fac9a4cf8b8ceddb142
build sdk_gphone_x86_64 and record a video in the camera app.
The recording works. `ps -A | grep media.swcodec` shows media.swcodec process.
`atest CtsStatsdHostTestCases:android.cts.statsd.atom.UidAtomTests#testAudioState` passes
Test: build sdk_phone_x86_64 and do the same.

Change-Id: I00af1910a8e8a330addc4c6903e5f3695aeb6865
2019-06-10 13:06:39 +09:00
Tom Cherry
383e1418ff base: Add MmapFile as a synonym for MappedFile
I was looking for 'MmapFile' earlier and couldn't find it.  After
being pointed to it, we thought that adding this synonym would help
others trying to find this file.

Test: n/a
Change-Id: I7fbfd8e090f21183a5de3603a76f884562b99c4a
2019-06-07 13:05:22 -07:00
Treehugger Robot
8958d7a127 Merge "liblog: fix benchmark build after google-benchmark upgrade." 2019-06-07 18:45:29 +00:00
Tom Cherry
36f5399341 logd: handle uidToName() directly
uidToName() originally used a separate worker thread with additional
group permissions.  Threads are not security boundaries however, so
these group permissions are removed in a previous change.

This change handles the lookup for uidToName() directly without using
a separate thread.

Test: boot CF, logd unit tests
Change-Id: If245388bc221bc77102a0bbcee82c8f42b140760
2019-06-07 11:39:24 -07:00
David Anderson
196d2ba7b9 liblp: Add helpers for finding partitions and partition sizes.
These tend to get manually, so let's promote to actual helpers.

Bug: 134536978
Test: liblp_test gtest
Change-Id: Ifb79c8d6f247cc3f9635bf6adfd1c99907340002
2019-06-07 11:09:28 -07:00
David Anderson
1e05e55820 liblp: Replace some |const char*| inputs with std::string.
Bug: 134536978
Test: builds
Change-Id: I23dba6747be334f42506f969d6d52b293c69f0bd
2019-06-07 11:09:26 -07:00
Tom Cherry
acf19e8031 Merge "init.rc: move rlimit setting earlier" 2019-06-07 15:59:40 +00:00
Tom Cherry
b7a25ef1ec Merge "logd: don't drop user/groups/capabilities/priority in drop_privs()" 2019-06-07 15:56:04 +00:00
Tom Cherry
0b2a011cc4 logd: don't drop user/groups/capabilities/priority in drop_privs()
On Android, unlike POSIX, groups and capabilities are able to be set
per thread.  This is useless however, since threads are not a security
boundary.  This change drops the logic to set groups and capabilities
per thread and instead leaves all threads running with the initial
user and groups.

This does still drop some capabilities if they're unneeded due to
features being disabled.

This also moves the setpriority() call from code into the init script.

Test: logd runs with the expected user/groups and with the expected
      capabilities and priority without any errors

Change-Id: Ibb0e529ea1574a2b8ec391a2678504ca9fbe19be
2019-06-07 15:52:27 +00:00
Tom Cherry
d949bf8df3 Merge "toolbox: add setprop, start, and stop" 2019-06-07 15:47:45 +00:00
Elliott Hughes
fdde7ee1f2 liblog: fix benchmark build after google-benchmark upgrade.
Test: treehugger
Change-Id: Id5a67680c23c22355d7ff2eb5cf66a8ef799b83e
2019-06-07 08:38:37 -07:00
Bo Hu
f17902b392 Merge "fs_mgr: Don't report 'Skip mounting partitions'" 2019-06-07 13:07:54 +00:00
Treehugger Robot
bb1b83e325 Merge "Add expected<void,E>" 2019-06-07 07:17:47 +00:00
Haibo Huang
a850fb2d1e Merge "Fix format string for new google benchmark" 2019-06-07 04:31:15 +00:00
Haibo Huang
9d47360c7e Fix format string for new google benchmark
Exempt-From-Owner-Approval: Fix build..
Test: build
Change-Id: I5b7dc76a6e8a9ee42cb9200b95db3ef5f335692a
2019-06-07 04:31:00 +00:00
Treehugger Robot
b78de85272 Merge "Update TODOs for ICU library links." 2019-06-07 02:12:04 +00:00
Treehugger Robot
2ba59c5b81 Merge "Move result.h from init to libbase" 2019-06-06 23:27:29 +00:00
Jiyong Park
b2a85c4333 Add expected<void,E>
Result<void> could be used instead of Result<Success>.

Bug: 132145659
Test: libbase_test
Change-Id: I7f079a94d06c5ecb8b0303ced981f0995253dc40
2019-06-07 08:10:32 +09:00
Tom Cherry
65a1ee83a8 toolbox: add setprop, start, and stop
Move these from toybox as they're Android specific and more easily
maintained here.

A few changes during the conversion:
* Report error in setprop if value is not a UTF8 string; this would
  previously fail only after attempting to set the property
* Inform users to check dmesg for further failure messages for all
  three programs
* Only start/stop zygote_secondary if the device is not single arch

Bug: 117321744
Bug: 133901248
Test: setprop works, start and stop work on single and multi-arch.

Change-Id: Id2194cf2b65221bde38aff91f0e86b33edb37f42
2019-06-06 11:20:29 -07:00
Tom Cherry
fdeca99c4b init.rc: move rlimit setting earlier
There is no reason that rlimits cannot be set earlier than they are,
and apexd-bootstrap may want to set the priority service option, which
would require that these rlimits have been set, so we move these to
the beginning of early-init.

Bug: 134668377
Test: apexd-bootstrap can set the priorty service option
Change-Id: I8040190cd4dc5e141784496ae65cfab80d9cad53
2019-06-06 18:18:14 +00:00
Martin Stjernholm
0d28abc5b1 Update TODOs for ICU library links.
Test: Presubmit boot test
Bug: 120786417
Bug: 134659294
Change-Id: I362e0e67c5adfd510dda12bed52629af92bfcc3d
2019-06-06 14:11:04 +01:00
Jiyong Park
8fd64c8af1 Move result.h from init to libbase
The Result, Error, ErrnoError are quite generic. Moving them from init
to libbase so that they can be used from other places.

Bug: 132145659
Test: libbase_test
Change-Id: Id774a587f74380fadd7a0fc88c0aa892c3d9a489
2019-06-06 08:58:55 +09:00
Treehugger Robot
44cabca1ef Merge "base: fix out of date documentation with PropertySet()" 2019-06-05 21:24:23 +00:00
Tao Bao
8eea2cae86 Merge "adb: Allow adb rescue getprop." 2019-06-05 20:43:55 +00:00
Mark Salyzyn
291b5caa46 Merge "fs_mgr: overlayfs: test: spelling mistake" 2019-06-05 20:29:53 +00:00
bohu
42b28b09b0 fs_mgr: Don't report 'Skip mounting partitions'
when the skip mount partition is not in the fstab

BUG: 133854834
Change-Id: I51de91f34525560c008fbe8648fa2cd6f56dcf8e
2019-06-05 18:24:50 +00:00
Mark Salyzyn
bc79fea7a1 fs_mgr: overlayfs: test: spelling mistake
Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I7bc68c15f53f94d1c14e2da91157ade362bc72f8
2019-06-05 11:12:05 -07:00
Tom Cherry
ef2469e547 base: fix out of date documentation with PropertySet()
As of Android-P, __system_property_set() is synchronous and only will
return '0' if the property was successfully set.

Test: n/a
Change-Id: Icbc0a6d8be1ae683565f378c534ea8e5c5f25357
2019-06-05 10:31:33 -07:00
Christopher Ferris
659f61e0f2 Merge "Display offsets for dex frames." 2019-06-04 22:28:56 +00:00
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
Josh Gao
2683d0a2ca Merge changes I2d005e17,If2eec162,Icfd642e6
* changes:
  adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
  adbd: respond to device-to-host control transfers.
  adbd: read, print, and ignore USB control transfers.
2019-06-04 19:22:08 +00:00
Josh Gao
a891ffddd3 Merge "adbd: provide MS OS descriptors for WinUSB." 2019-06-04 19:22:00 +00:00
Christopher Ferris
a4bdb984f9 Display offsets for dex frames.
When adding a dex frame, no offset is ever printed even if the dex data
is coming from a non-zero offset map. Fixed so an offset is printed
in this case.

Previous the line looked like this:

  #17 pc 0000000000500d7a  /product/app/GoogleCamera/GoogleCamera.apk (com.google.android.libraries.camera.async.AndroidPriorityThread.run+10)

Now looks like:

  #17 pc 0000000000500d7a  /product/app/GoogleCamera/GoogleCamera.apk (offset 0x11d0000) (com.google.android.libraries.camera.async.AndroidPriorityThread.run+10)

Add new unit test for this case.

Bug: 134420076

Test: Wrote new unit test, and verified a non-zero offset for dex file
Test: data results in a frame with a non-zero offset.
Change-Id: I58c134fda4fad5456ca0f1723192667a1ca5d509
2019-06-04 12:07:05 -07:00
Treehugger Robot
41f690ba2a Merge "Fix leak of mapped zip central directories" 2019-06-04 12:36:52 +00:00
Treehugger Robot
f74ff74475 Merge "fastboot: windows: Minor printf format fixes" 2019-06-04 00:20:24 +00:00
Treehugger Robot
d877a96656 Merge "Allow adb to handle single paramter with install-multi-package flag" 2019-06-03 22:49:48 +00:00
Mark Salyzyn
b5db741383 Merge "fs_mgr: overlayfs: test: triage data missing after failure flash scratch" 2019-06-03 21:22:28 +00:00
Greg Kaiser
8acf8c2da7 fastboot: windows: Minor printf format fixes
We recently changed 'xfer' to a size_t, so update the DBG format
accordingly.  We also fix a long standing issue with format for
the unsigned 'read'.

Test: TreeHugger
Change-Id: I3dc5f26a033fea64119016802bc9cdb54bbb7b52
2019-06-03 14:12:42 -07:00
Mark Salyzyn
4d702e8dea fs_mgr: overlayfs: test: triage data missing after failure flash scratch
After flashing empty image to scratch device, the device did not
return after 3 minutes.  It also did not collect any triage data
reporting only:

[  FAILED  ] did not reboot after flash

Add triage data, increase timeout to 4 minutes.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: Ic607abb5b2575d630bf6c27817a38a90820d24e1
2019-06-03 12:53:07 -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