Commit Graph

45100 Commits

Author SHA1 Message Date
Treehugger Robot f09ef56056 Merge "Init: Load fsverity keys earlier" 2019-03-16 02:05:33 +00:00
Treehugger Robot f2dadd019d Merge "init: add MountHandler property handler" 2019-03-16 01:15:18 +00:00
Dongwon Kang a013e3d53d List stable libraries media apex relies on.
With allow_all_shared_libs, the libs under /system/lib may be used
instead of libs included in the apex. This change adds stable libraries
the media apex relies on to prevent this case.

Test: dumpsys media.extractor, atest MediaPlayer2Test
Bug: 127791685

Change-Id: I6a0419e6da9e9f48a394257b1e8f977ec2dfa9a1
2019-03-15 17:23:03 -07:00
Yifan Hong e8e2756f93 libprocessgroup: Add VTS tests for vendor JSON files
Test: vts_processgroup_validate_test
Bug: 123664216
Change-Id: I5518e34cde6fc30195fc99133f86cb23ae3be92f
2019-03-15 16:28:42 -07:00
Victor Hsieh 327037f063 mini-keyctl: support printing security label
Test: mini-keyctl security <key_id>
Bug: 128607724
Change-Id: If92b41d0aa96d626933546391b964ca2a8a48703
2019-03-15 16:01:01 -07:00
Andreas Gampe e8565ac94a Init: Load fsverity keys earlier
Keys may be required for apex updates (post-installs), so load them
before starting apexd.

Bug: 125474642
Test: m
Test: manual
Change-Id: I32ddb6ae6854334e8ee7e195173ecfaed565d783
2019-03-15 15:14:35 -07:00
Josh Gao 1e1ae45a8c adb: avoid sign extension of shell return code.
Windows has int32_t return codes, which results in return codes 128-255
being sign extended into a negative number. Manually truncate the return
codes we get to preserve their values.

Test: test_device.py on windows
Change-Id: If41d6d469350301704f6ecff72ad17b412db3e04
2019-03-15 14:54:32 -07:00
Josh Gao eecd5cc532 Merge "adb: attempt to exec newer adb servers on Linux." 2019-03-15 21:54:10 +00:00
Yifan Hong 28a44eb6f6 libprocessgroup_proto_test split into multiple files
... so that they can be reused later.

Also, removed test to strull and inline static constexpr variable.

Bug: 123664216
Test: libprocessgroup_proto_test
Change-Id: Ia6b93c6689d7531e6f597d1387434aed1b3efb0a
2019-03-15 12:34:42 -07:00
Neil Fuller 3b0da85b22 Address syntax / error case nits
Observe some best practices in the APEX symlink
shell commands. No functional changes intended except with error
handling.

Bug: 128687472
Bug: 124106384
Bug: 122985829
Bug: 128249030
Test: make installclean / make droid / inspect one symlink
Change-Id: I099fed5ac8f25cc3911ce0e7ea2b9f74c2172193
2019-03-15 19:05:05 +00:00
Mark Salyzyn a73ed22cb7 init: add MountHandler property handler
Set properties dev.mnt.blk.<mount_point>=<device_block_class> for mount
and umount operations by setting up an Epoll handler to catch
EPOLLERR or EPOLLPRI signals when /proc/mounts is changed.  Only
update properties associated with block devices.  For the mount
point of /, use the designation of /root instead.

Can use the properties in init rc expansion like:

on property dev.mnt.blk.root=*
    write /sys/block/${dev.mnt.blk.root}/queue/read_ahead_kb ${boot_read_ahead_kb:-2048}

on property dev.mnt.blk.data=*
    write /sys/block/${dev.mnt.blk.data}/queue/read_ahead_kb ${boot_read_ahead_kb:-2048}

on late-fs
    setprop boot_read_ahead_kb 128
    write /sys/block/${dev.mnt.blk.root}/queue/read_ahead_kb ${boot_read_ahead_kb}
    write /sys/block/${dev.mnt.blk.data}/queue/read_ahead_kb ${boot_read_ahead_kb}

Test: boot and inspect getprop results.
Bug: 124072565
Change-Id: I1b8aff44f922ba372cd926de2919c215c40ee874
2019-03-15 11:54:38 -07:00
Elliott Hughes 0e5b74deff Merge "libprocessgroup: PLOG already includes strerror(errno)." 2019-03-15 15:19:22 +00:00
Treehugger Robot 4cd0914048 Merge changes from topic "apex_earlymount_no_bionic_bindmount"
* changes:
  /bionic path is gone
  Revert "Handle adb sync with Bionic under /bionic"
  Don't bind-mount bionic files
2019-03-15 09:02:18 +00:00
Treehugger Robot da1251d6a5 Merge changes from topic "adb_root_in_user"
* changes:
  Allow overriding ro.debuggable to 1 on USER builds
  adbd: allowing adb root when the device is unlocked
2019-03-15 04:40:43 +00:00
Elliott Hughes 08b4d32139 libprocessgroup: PLOG already includes strerror(errno).
Test: builds
Change-Id: Ic1fe6b46144f7dbeb7ffba5534d94b4dae192d5c
2019-03-14 20:06:36 -07:00
Josh Gao d10b7c4e02 adb: attempt to exec newer adb servers on Linux.
Test: manual
Change-Id: Iebdfa292f21b2871e6010ab6cc964134fec447e9
2019-03-14 15:41:41 -07:00
Bowgo Tsai 1dacd42ae1 Allow overriding ro.debuggable to 1 on USER builds
When init found "/force_debuggable" in the first-stage ramdisk, it will
do the following if the device is unlocked:
  1. load /system/etc/adb_debug.prop (with ro.debuggable=1)
  2 .load userdebug_plat_sepolicy.cil instead of original plat_sepolicy.cil from
    /system/etc/selinux/.

This make it possible to run VTS on a USER build GSI, by using a special
ramdisk containing "/force_debuggable".

Bug: 126493225
Test: unlock a USER build device, check 'adb root' can work
Change-Id: I9b4317bac1ce92f2c0baa67c83d4b12deba62c92
2019-03-15 06:12:00 +08:00
David Anderson 71fc3f358b liblp: Reclaim wasted space from unaligned partitions, v2.
When allocating a partition with a size that is unaligned (to the
optimal alignment), the remaining sectors are wasted since they are
never reallocated. This is because the free list is guaranteed to only
contain optimally-aligned regions. Unfortunately this means when a
partition is resized, we are wasting a small amount of space each time.
On a non-A/B device, this could wind up being significant.

For example, with an alignment of 512KiB, a 4KiB partition at offset 0
will waste 508KiB of space. The next extent to be allocated by any
partition will start at the next 512KiB.

To address this, we check if the last extent for a partition can be
extended to cover the difference between its last sector and the next
optimally aligned sector. We also verify that this region was not
allocated to any other partition, and does not appear in the free list,
to make sure we're not stealing space that will be used somewhere else.

Bug: 120434950
Test: liblp_test gtest
Change-Id: I88689889d44a4d2c51e659241918aaf2c064e049
2019-03-14 12:09:09 -07:00
Bowgo Tsai 9b30c0a7e6 adbd: allowing adb root when the device is unlocked
As there is no security guarantee when the device is unlocked,
allowing adb root gives us more rooms to debug a USER build images.

Also, this makes it possible to run VTS on a USER build GSI, with
setting ro.debuggable=1 and unlocking the device.

This basically re-lands a reverted change:
https://android-review.googlesource.com/c/platform/system/core/+/437815

Which isn't needed after we moved /sbin/adbd to /system/bin/adbd in
USERDEBUG GSI. But it's still needed for USER build GSI.

Bug: 126493225
Test: unlock a USER build device, check 'adb root' can work
Change-Id: I93f12c8a3fe65c96c947e4602795eadfe591c521
2019-03-15 03:04:46 +08:00
David Anderson 9d3310c019 Merge "libfiemap_writer: Calculate FIBMAP blocks correctly." 2019-03-14 17:08:19 +00:00
Tao Bao 74cece70bc Merge changes from topic "charger-shared-libs"
* changes:
  healthd: Add charger.recovery module.
  healthd: charger uses shared libraries.
2019-03-14 16:56:29 +00:00
Hans Boehm bca89d7bbc Merge "Revert "Revert "Fix wp and sp comparison bugs""" 2019-03-14 16:55:49 +00:00
Neil Fuller cb7ac9d752 Merge "Move the logic for creating APEX-related symlinks" 2019-03-14 16:06:08 +00:00
Christopher Ferris 4886a5bd59 Merge "Add support for displaying soname in an apk." 2019-03-14 15:40:59 +00:00
Gavin Corkery ff3c13f52f Merge "Rename data/pkg_staging to data/app-staging." 2019-03-14 14:14:38 +00:00
Mark Salyzyn 873ee642f2 Merge "init: epoll: add events argument to RegisterHandler" 2019-03-14 14:11:27 +00:00
Roland Levillain e61d5ccf47 Merge "Remove Valgrind entries from fs_config." 2019-03-14 13:22:15 +00:00
Neil Fuller 16e5ae3b39 Move the logic for creating APEX-related symlinks
The existing location of logic for creating symlinks to files that have
moved into APEX does not get executed for -user builds, only
-userdebug and -eng. The new location is equally arbitrary but appears
to be invoked for -user, -userdebug and -eng targets.

Tested with:
make cleaninstall && lunch taimen-[user|userdebug|eng] && make droid

Inspected:
ls -l out/target/product/taimen/system/usr/icu

Bug: 128249030
Bug: 122985829
Bug: 124106384
Test: see above
Merged-In: I92a52d0b5ef97e8cb4f780691f8594e40f2fa6b3
Change-Id: I92a52d0b5ef97e8cb4f780691f8594e40f2fa6b3
(cherry picked from commit 0ed52b789d)
2019-03-14 10:38:54 +00:00
David Anderson 483ce1d496 libfiemap_writer: Calculate FIBMAP blocks correctly.
FIBMAP blocks are returned in FIGETBSZ units, which means the number of
blocks also needs to be determined by FIGETBSZ. Using the stat blocksize
is incorrect. On VFAT, FIGETBSZ returns 512 whereas st_blksize is 32768.

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: Id0a667936ff9c0b60b1e8f72920cf62ceece1657
2019-03-13 19:01:13 -07:00
David Anderson ed5d1ca252 Merge "libfiemap_writer: Fix the progress bar on VFAT partitions." 2019-03-14 01:51:27 +00:00
Elliott Hughes e5de6db1dd Merge "run-as: improve diagnostics on failure." 2019-03-14 00:26:32 +00:00
Christopher Ferris 02a6c448c3 Add support for displaying soname in an apk.
Changes:
- Change GetSoname to always returns a std::string.
- Added new unit tests for the soname printing.
- Modify the GetElf() function to save the same elf when we see rosegment
  linkers that split the read-only and read-write across a map. This
  avoids creating multiple elf objects for each map.
- Fixed a few offline unwind tests.

Bug: 29218999

Test: Unit tests pass.
Change-Id: Iad7c38b5c2957a8c5fd4ba94ebec335bafcad57d
2019-03-13 17:07:46 -07:00
Mark Salyzyn 37bbf800fa init: epoll: add events argument to RegisterHandler
Allow caller to specify events other than EPOLLIN default.

Test: boot
Bug: 124072565
Change-Id: Id4e582a6abc74c5fdb26fea7dcbd3ba2150dadd6
2019-03-13 16:51:31 -07:00
Tim Murray 92dcfb3187 Merge "lmkd: set PSI_POLL_PERIOD to 40ms" 2019-03-13 23:27:13 +00:00
Jiyong Park 192fdeb495 /bionic path is gone
The path no longer exists, and thus the path doesn't need to be
unmounted upon remounting.

Bug: 125549215
Test: system/core/fs_mgr/tests/adb-remount-test.sh
Change-Id: I7b263c755ad7eeaa63a00ad9795a134707698625
2019-03-14 07:35:54 +09:00
Jiyong Park fc97d2a116 Revert "Handle adb sync with Bionic under /bionic"
This reverts commit 7c7189c469.

Bug: 125549215
Test: system/core/fs_mgr/tests/adb-remount-test.sh
Change-Id: I4ee40cda9c3b94b116dc822c7b9736cfe2c9c9f0
2019-03-14 07:35:54 +09:00
Jiyong Park 7b4801a921 Don't bind-mount bionic files
Bind-mounting of the bionic files on /bionic/* paths no longer required
as there are direct symlinks from bionic files in /system partition to
the corresponding bionic files in the runtime APEX. e.g.,

/system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so

Bug: 125549215
Test: m; devices boots
Change-Id: I4a43101c3e3e2e14a81001d6d65a8a4b727df385
2019-03-14 07:35:54 +09:00
David Anderson 5df0092353 libfiemap_writer: Fix the progress bar on VFAT partitions.
We allocate VFAT file space by seeking and writing a single byte. It
turns out this is not fast enough to avoid invoking the progress
callback, so instead, we should seek in increments.

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: I2b363af4ebde873411e8a3acd22ca68d175afe3f
2019-03-13 13:58:12 -07:00
Hans Boehm 6e75ad6e13 Revert "Revert "Fix wp and sp comparison bugs""
Fix wp and sp comparison bugs

Make clear() actually clear wp m_refs, so that nulls compare equal.

Make equality consistent with < and >, ensuring that a weak pointer
cannot be both equal to and greater than another.

Don't rely on the built-in < and > operators to correctly order
different objects. The standard does not guarantee that, and there is
a risk of compiler relying on that lack of guarantee.

Remove unnecessary comparison overloads, especially those
comparing a wp<> to an sp<>.

Change the remaining wp<> to sp<> comparisons to check for equivalence
of the mRefs pointer instead of the object address, thus eliminating
the dubious equal comparison result for a dead wp<> and an sp<> that
happen to point to the same object address.

Add comparison tests.

This reverts commit a2a2ad8057.

The original code, and my original CL, both failed to initialize m_refs
in various wp<> constructors. This now became more important, since
comparisons now rely more on m_refs. However I believe it was always
a bug, since some comparisons always relied on m_refs.

Test: Treehugger, boot AOSP, atest RefBase
Bug: 126922090
This reverts commit a2a2ad8057.

Reason for revert: Reapply after constructor fixes.

Change-Id: I2c8917416a2306e36d2b6bb7b397f653020e5688
2019-03-13 13:26:35 -07:00
David Anderson b8e1711980 Revert "liblp: Reclaim wasted space from unaligned partitions."
When this patch landed, it was thought that over-allocating partitions
had no undesired side effects. However there are cases where it is now
causing problems. When flashing a GSI for VTS, the vbmeta is appended to
the end of the partition. If libfs_avb cannot find this vbmeta by
looking at the end of the partition, verification will fail. Similar use
cases with verifying other dynamic partitions are expected to be
problematic, so for now we revert to block-size alignment.

This reverts commit dccfdca1e1.

Bug: 125113249
Test: liblp_test gtest
Change-Id: Ibfd66734b63265e9fbb2ccf6b670c168c36190bc
2019-03-13 12:58:21 -07:00
Christopher Ferris 9a00f596d3 Merge "Fix missing offset for apk." 2019-03-13 18:16:05 +00:00
Elliott Hughes 964932d7ce run-as: improve diagnostics on failure.
Bug: http://b/128523258
Test: manual
Change-Id: I4430a8d309c0e9b5315aaae3e7d223c05b7ea3e5
2019-03-13 11:16:03 -07:00
Tim Murray 0e5c00f375 lmkd: set PSI_POLL_PERIOD to 40ms
200ms was too lenient when under severe memory pressure.

Test: boots, works
Bug: 127765309

Change-Id: I8e047de6318574a107720c56473ed0f25582e182
Signed-off-by: Tim Murray <timmurray@google.com>
2019-03-13 10:13:19 -07:00
Roland Levillain 3f3e2c678e Remove Valgrind entries from fs_config.
Valgrind has been removed from the Android tree in 2018.

Test: n/a
Bug: 77856586
Change-Id: I3b51d9b2290a4276299725cdd5a53a5bba00166e
2019-03-13 17:12:00 +00:00
Valerie Hau e61e8c6b62 Merge "Revert "Fix wp and sp comparison bugs"" 2019-03-13 15:03:04 +00:00
Neil Fuller 822dbd8911 Merge "Add an env variable for the tzdata module root" 2019-03-13 08:49:30 +00:00
Martijn Coenen 13b5c3bee7 Merge "Create /metadata/apex/[sessions]." 2019-03-13 07:46:32 +00:00
Hans Boehm a2a2ad8057 Revert "Fix wp and sp comparison bugs"
This reverts commit 029b12ebde.

Reason for revert: There appear to be problems with null comparisons. Reported failure in HwcBufferCacheTest.

Change-Id: I19745bb281dabe8b05c2df3fe95e7be7a49dcd51
2019-03-13 03:24:12 +00:00
Xin Li 35c5cd9139 Merge "DO NOT MERGE - Merge PPRL.190305.001 into master" 2019-03-13 02:26:03 +00:00
Jayant Chowdhary 3dd9881ca7 Merge "Special case init for android_is_in_vendor_process." 2019-03-13 00:07:05 +00:00