Commit Graph

47945 Commits

Author SHA1 Message Date
Treehugger Robot 716ba5d91d Merge "libprocessgroup: move native_bridge_support" 2019-06-17 23:33:46 +00:00
David Anderson bc53c842e9 Merge "liblp: Remove the slot-suffix requirement in MetadataBuilder." 2019-06-17 22:58:20 +00:00
Tom Cherry 55fe01db69 Remove fs_config_generate()
We replaced creating the binary fs_config files with a python script
(/build/make/tools/fs_config/fs_config_generator.py), so there are no
more users of this function, nor do we plan for there to be.

Test: build
Change-Id: I49ec7e3d22c206bc250cbda6f66a4a59e47030e9
2019-06-17 13:40:31 -07:00
Steven Moreland b495b0d403 libprocessgroup: move native_bridge_support
To avoid merge conflict.

Bug: 135293492
Bug: 135298384
Test: N/A
Change-Id: I034b989c7e0f8a477b29ef7ca40bba8f2dc929e5
2019-06-17 12:48:06 -07:00
Suren Baghdasaryan 338260a467 Remove ACgroupController_getFlags to fix API breakage
Since ACgroupController_getFlags was introduced after LLNDK freeze it
causes media crashes due to missing symbol. Remove the new function and
re-implement cgroup controller detection to not require flags field but
instead check for its existence on the first access.

Bug: 135049992
Test: libcutils_test with and without CONFIG_CPUSETS enabled
Change-Id: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-06-17 16:46:23 +00:00
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
Jooyung Han baa7c13c31 init: Create /data/apex/hashtree folder at boot
/data/apex/hashtree is internal to apexd, hence 0700

Bug: 120058143
Test: m && boot device
Change-Id: I3637a3cbedf871e982e02d50c21e0fe53e6b4824
2019-06-14 15:35:49 +09: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
David Anderson 935420f968 liblp: Remove the slot-suffix requirement in MetadataBuilder.
Normally MetadataBuilder will refuse to create non-suffixed partitions
on A/B devices. There are some scenarios where this doesn't make sense,
like when gsid needs to build metadata files for
system_gsi/userdata_gsi. It also doesn't make sense for the "scratch"
partition, so we added exceptions.

It turns out that metadata created by gsid cannot be re-imported by
MetadataBuilder, because there's no opportunity to set the "ignore" flag
in MetadataBuilder's constructor. Rather than plumbing a flag through, I
think we should just remove this error. It has too many exceptions
already and it doesn't really protect against anything. The motivation was
to avoid confusion in fastbootd on retrofit devices (where there are two
super partitions), but it's a pretty minor concern.

Bug: 134536978
Test: liblp_test gtest
Change-Id: I4629a3c46070c35bcce1017096338e72aa234371
2019-06-13 16:43:26 -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
Josh Gao fc0f80ae49 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
2019-06-13 13:16:57 -07: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
Hridya Valsaraju 4952ef7494 Remove system/core/mkbootimg
Bug: 133171083
Test: make
Change-Id: Iaee7edbfe91c732806bac1a7998d3db1a2e3bff2
2019-06-12 19:54:01 +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 39fafedc5a init: use a property instead of file to communicate cold boot done
Ueventd can't set properties currently, but this is an artificial
limitation, since ueventd communicates to init that it has finished
cold boot via a file, and init polls this file instead of returning to
the epoll loop, where properties are handled.

This change replaces that file with a property and thus frees ueventd
to be able to set properties.

Bug: 62301678
Test: boot, check that properties are set
Change-Id: I985688e9299456efcb2dfeef9b92668991aa9c05
2019-06-10 18:08:01 -07:00
Tom Cherry bc1ccde87c Merge "Remove Result<Success> in favor of Result<void>" 2019-06-11 00:38:30 +00:00