Commit graph

47796 commits

Author SHA1 Message Date
Jooyung Han
df7d32753e fix: passing ResultError to Error thru operator<<
It is typical to pass error to callers like following;

    if (!result) {
      return Error() << result.error();
    }

To transfer errno(or ResultError#code()), Error defines a specialization
operator<<(const ResultError&).

This change fixes so that ResultError is properly handled

Bug: 132145659
Test: atest libbase_test
Change-Id: Ib35457da2d4b923d8e652c54ac510a75546cf918
2019-06-11 13:38:01 +09:00
Josh Gao
5b63cff411 Merge "adb: avoid freeing argv entries on Windows." 2019-06-11 01:43:52 +00:00
Tom Cherry
bc1ccde87c Merge "Remove Result<Success> in favor of Result<void>" 2019-06-11 00:38:30 +00:00
Tom Cherry
31a0ab8fe1 Merge "init: replace Result<Success> with Result<void>" 2019-06-11 00:27:22 +00:00
Treehugger Robot
2184ecb8ad Merge "fs_mgr: support -o sync" 2019-06-10 21:40:23 +00:00
Josh Gao
e72c44b24a adb: avoid freeing argv entries on Windows.
We assign string literals directly to argv[0], which leads to fun
explosions when we attempt to free  when the runtime can detect that
a bad free happened, which seems to happen reliably with lld.

Bug: http://b/110800681
Test: `adb shell true` on windows
Change-Id: Ica81e472c31686d80b58c41ff6d2b825baef06fb
2019-06-10 12:54:14 -07:00
Tom Cherry
91e6f888d7 Remove Result<Success> in favor of Result<void>
Result<void> is the correct way to do this.

Bug: 132145659
Test: libbase and init unit tests
Change-Id: I9c2e16cee6657a1895f215016df41a8b290383c7
2019-06-10 12:53:15 -07:00
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
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
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