Commit Graph

47835 Commits

Author SHA1 Message Date
Tom Cherry 7f34035f08 Merge "Create android-base/format.h that includes fmtlib headers" 2019-06-17 14:42:32 +00:00
Tom Cherry 30f6f42c04 Merge "init: use Errorf() now that we have it" 2019-06-17 14:42:20 +00:00
Josh Gao a6f90ce599 Merge "Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" 2019-06-14 23:25:35 +00:00
Josh Gao 9dba0f5824 Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
We're only reading FUNCTIONFS_BIND on creation upon the first creation
of the control fd, which results in an abort when rebind happens (e.g.
when MTP is enabled) and we unexpectedly read FUNCTIONFS_BIND in the
second instantiation of the connection.

This reverts commit 2b668d3906.

Bug: http://b/135155652
Test: manually enabled MTP
2019-06-14 16:21:21 -07:00
Treehugger Robot 6860f68475 Merge "VtsKernelLiblpTest: use static test" 2019-06-14 23:00:48 +00:00
Tom Cherry f4db2aad57 init: use Errorf() now that we have it
Init had some pretty horrid Error() << StringPrintf(...) calls that
are all much better replaced by Errorf(...) now.

Test: build, check that keyword_map errors look correct
Change-Id: I572588c7541b928c72ae1bf140b814acdef1cd60
2019-06-14 22:07:32 +00:00
Tom Cherry b90dcc07d3 Create android-base/format.h that includes fmtlib headers
We're already including fmtlib statically in libbase, so let's also
expose its functionality directly.

Also create a small benchmark of the most common operations for
format() and StringPrintf(): int, float, and string arguments.  Note
that fmt::format is faster than StringPrintf() in all of these cases.

Test: build, run benchmark
Change-Id: I1e18f13673dd89ea936ea5c51418fad723495b08
2019-06-14 14:55:27 -07:00
Jaegeuk Kim c47618662f Merge "fs_mgr_fstab: translate reserve_root to reserved_size in fsmgr" 2019-06-14 21:49:18 +00:00
Steve Muckle 83019575ac VtsKernelLiblpTest: use static test
To avoid introducing dependencies on target libraries, use a statically
compiled test instead.

Bug: 134912860
Test: run vts-kernel -m VtsKernelLiblpTest
Change-Id: Ie24cc8532c7821cb225c024c240c4d485557bfa7
2019-06-14 11:37:09 -07:00
Tom Cherry ebbe9e7391 Merge "Add Errorf and ErrnoErrorf" 2019-06-14 18:12:00 +00:00
Jaegeuk Kim f07d07bf47 fs_mgr_fstab: translate reserve_root to reserved_size in fsmgr
Without this patch, fstab should decribe reserve_root=[# of 4KB blocks] in
f2fs mount option as well as reserved_size=[KB] in fsmgr flag to notify it
to framework.
With this patch, it should be just fine to use reserve_root=[# of 4KB blocks]
in fstab.

Bug: 135003600
Test: checked vold.has_reserved
Change-Id: Iab75f7da9792ad205a6c4d2d0f1eba8c16a5266a
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-06-14 17:38:33 +00:00
Treehugger Robot 2d620c00f3 Merge "Link the sanitizer runtime libraries to the default unrestricted namespace." 2019-06-14 06:37:38 +00:00
Jiyong Park 20524ed6a2 Add Errorf and ErrnoErrorf
String formatting for error message can be done by using Errorf and
ErrnoErrorf. e.g. `return Errorf("{} failures", num_failure);`

The string format follows that of fmtlib, not printf.

Bug: 132145659
Test: libbase_test
Change-Id: I65f45d5f12ed23e2c14d6eb442278f467cc42e83
2019-06-14 14:29:36 +09:00
Peter Collingbourne 563ca38154 Link the sanitizer runtime libraries to the default unrestricted namespace.
Without this, binaries can't be run out of /data/local/tmp on a HWASANified
device.

Test: Chromium's /data/local/tmp/md5sum/md5sum_bin works on walleye_hwasan-userdebug
Change-Id: Ieceaab8aae0024864022ca42b38aa36e6212cf31
2019-06-13 18:50:46 -07:00
Treehugger Robot 69880e1a39 Merge "Support importing property file with expanded name" 2019-06-13 23:40:48 +00:00
Dongcheol Shin a87c0f99ad Support importing property file with expanded name
This change is to support importing property file with its path
variations.

By substitute its filename with another, it can be used to handle
runtime varying filename within single binary.

Here's an example of usage in property defined file.
    import /odm/build_${ro.boot.product.hardware.sku}.prop

Bug: 132592551
Test: boot a device and checks above example import statement in
    "/odm/build.prop" loading expanded filename correctly

Change-Id: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
2019-06-13 23:40:23 +00:00
Elliott Hughes bc420c4748 Merge "ziparchive: add a std::string_view overload to Next." 2019-06-13 14:13:02 +00:00
David Anderson 5482189612 Merge "fastbootd: Don't include all of the fs_mgr namespace in commands.cpp." 2019-06-12 21:10:33 +00:00
David Anderson 43d9ced663 Merge "libfiemap_writer: Handle dm stacking more accurately." 2019-06-12 21:09:59 +00:00
Elliott Hughes 1e40c30b0c ziparchive: add a std::string_view overload to Next.
Recovery wanted this, and frameworks/base/ wants it too.

Bug: http://b/129068177
Test: treehugger
Change-Id: I8ee3f7c058fc9c1cde829da613ed15be5ce7b41e
2019-06-12 12:12:47 -07:00
Christopher Ferris 5fb660930c Merge "Internalize subclasses of Memory" 2019-06-12 16:10:10 +00:00
Jiyong Park 210b56e9a8 Merge "Add libcgrouprc to ld.config.txt." 2019-06-12 15:15:51 +00:00
Treehugger Robot cb2352a75d Merge "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND." 2019-06-12 14:34:14 +00:00
Suren Baghdasaryan aba081c119 Merge "race condition in libprocessgroup" 2019-06-12 13:55:33 +00:00
Josh Gao 2b668d3906 adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.
Rework the functionfs logic to avoid rebinding the USB interface
repeatedly.

Bug: http://b/133132986
Test: treehugger
Change-Id: I7f75874efd197764d40b66800a117ff4726d793b
2019-06-11 20:33:16 -07:00
Min Yun d695733df9 Add libcgrouprc to ld.config.txt.
- In GSI, media.extractor has follow dependency.
media.extractor -> libmpeg2extractor (media ns) ->
libprocessgroup (media ns) -> libcgrouprc (default ns).
If libcgroupsrc can't link from libmpeg2extractor, media.extractor is crashed.

Test: media.extractor didn't die.
Bug: 134981805
Change-Id: I7d3e7e6477708a505b87a884e05cd719f5a3d496
2019-06-12 11:19:59 +09:00
Treehugger Robot 3fcd831a6d Merge "fix: passing ResultError to Error thru operator<<" 2019-06-11 21:12:32 +00:00
David Anderson 2747532f96 fastbootd: Don't include all of the fs_mgr namespace in commands.cpp.
Bug: N/A
Test: m fastbootd
Change-Id: Iea67a27a2d3637df5dfd55982bda1465b7ef7de8
2019-06-11 14:05:02 -07:00
David Anderson d5fa799f76 libfiemap_writer: Handle dm stacking more accurately.
Right now we completely unwind a device-mapper stacking, but this will
produce incorrect results if the stack doesn't have a 1:1 block mapping.
For example, extents against a dynamic partition will be invalid if used
against the underlying block device (super). In this case, abort the
device-mapper unwinding early, and leave it to the caller to decide if
the device is valid.

In addition to fixing a potentially serious bug, this will allow us to
test gsid by simulating various device types (FBE vs FDE, for example).

Bug: 134536978
Test: fiemap_writer_test gtest
Change-Id: I8164e2b71c4868f5494e17e08d209b65fa0ed4ef
2019-06-11 14:04:46 -07:00
David Anderson e53417a8ee Merge "liblp: Add helpers for finding partitions and partition sizes." 2019-06-11 20:27:53 +00:00
Casey Dahlin 6b95a0e999 Internalize subclasses of Memory
There are many subclasses of the Memory class and the overwhelming
majority of them don't need to be exposed externally. We move all of
them to internal headers except MemoryOfflineBuffer, which moves to a
separate header. This dramatically reduces the exposed API surface and
makes the code more modular.

Also, remove the Offline code from libbacktrace. It's not used any where.

Test: Unit tests pass, clean tree still builds
Change-Id: I55dacdf080daba0bfe65c1ad53a4b326bb482e83
2019-06-11 12:09:18 -07:00
mtk16036 53f79e6861 race condition in libprocessgroup
while enable fdsan (file descriptor sanitizer),
fdsan report use-after-close error after boot complete (sedom).

Because, in SetCgroupAction::EnableResourceCaching() currently has a data race against all the
use fd_ functions like SetCgroupAction::ExecuteForProcess(uid_t uid, pid_t pid) etc.

ThreadA                                     | ThreadB
-------------------------------------------------------------------------------------------------
in SetCgroupAction::EnableResourceCaching() | in SetCgroupAction::ExecuteForProcess(...)
-------------------------------------------------------------------------------------------------
                                            | in SetCgroupAction::AddTidToCgroup(int tid, int fd)
-------------------------------------------------------------------------------------------------
fd_ = std::move(fd); /*modified fd_ value*/ |
-------------------------------------------------------------------------------------------------
                                            | write(fd)  /* crash here, fd is closed by ThreadA*/
-------------------------------------------------------------------------------------------------

So, add mutex lock to protect fd_ data race.

Bug: 134120826
Test: auto test, run the adb reboot test 100 times and no fdsan error report on libprocessgroup
Change-Id: Iccf2f705e030f79324f1164509e715dc5be825de
2019-06-11 10:52:25 -07:00
Jaegeuk Kim 1d7f3b4f4e Merge "fs_mgr: run fsck.f2fs with -f option when full mount fails" 2019-06-11 16:59:48 +00:00
Christopher Ferris 45a88faa7a Merge "Set elf_start_offset for invalid elf maps." 2019-06-11 16:17:59 +00:00
Treehugger Robot b3093ff21a Merge "Read *.rc files from flattened APEX" 2019-06-11 12:11:11 +00:00
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
Christopher Ferris d49499d5c9 Set elf_start_offset for invalid elf maps.
Add new unit tests to cover this case.

Bug: 133495043

Test: New unit tests pass.
Change-Id: I9ded5732c3c40197ebfddee3dcacc4aa07541ac0
2019-06-10 18:39:38 -07:00
Sahitya Tummala 5928e4f8d3 fs_mgr: run fsck.f2fs with -f option when full mount fails
There are cases where fsck.f2fs -f helps to recover from
corruption and thus helps to mount f2fs successfully.

CRs-Fixed: 2458080
Change-Id: I8d91835e464ef86e6ad4f96b7ac83f9f3d57c14f
2019-06-11 01:36:21 +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