Commit graph

43968 commits

Author SHA1 Message Date
David Anderson
c6c6e66813 liblp: Add helpers for modifying groups.
These are needed for non-A/B OTAs.

Bug: 122473283
Test: liblp_test gtest
Change-Id: Ib30614f1691dbea0a56c5a98aadc84fc26d1e639
2019-01-10 11:49:15 -08:00
Yifan Hong
ccdba57545 fs_mgr: overlayfs clears readonly on scratch devices
Fixes adb-remount-test and flashstation because the scratch device
was set to readonly before.

Test: adb-remount-test

Change-Id: I12551d1ed99fb7cfd04f84fcc2b77d3cb94275b2
Fixes: 122454600
Fixes: 122602260
2019-01-10 10:49:05 -08:00
Tom Cherry
2f171cc69e Merge "init: remove the restriction of arguments" 2019-01-10 18:47:53 +00:00
Tom Cherry
d1febd3316 liblog: remove LOGGER_LOCAL
No users ever signed up to use this, so remove it to ease the
refactoring of liblog/libbase.

Bug: 119867234
Test: liblog unit tests
Change-Id: I37b99644112bae7b4a2e3f4d06749db08de4ea14
2019-01-10 10:39:35 -08:00
Treehugger Robot
b9d6cef75e Merge "liblog: convert README to markdown" 2019-01-10 18:34:23 +00:00
Treehugger Robot
29c44f5710 Merge "Use the existing .clang-format-2 for liblog" 2019-01-10 18:30:39 +00:00
Tri Vo
b5b7d0a777 Merge "init: don't restorecon root sepolicy files" 2019-01-10 17:38:15 +00:00
Andreas Gampe
468ffaeecf Libbase: NOLINT legacy unique_fd operator int
The use in implicit conversion is intentional.

Test: m
Change-Id: I6c756e772b274e8a525ba2ad792cc4a8e1fc0176
2019-01-10 08:54:45 -08:00
LongPing Wei
01cf85bd8e Support mounting same mount points with different fstab config
This commits allows multiple lines in a fstab have the same mount
point for first-stage mount, where the first successful mount will be
used.

This allows us to specify a common/shared fstab, with different
settings (e.g., ext4, squashfs) per line, to mount different types
of images on the same mount point. e.g., allows the device to mount
GSI (ext4) while support mounting the original squashfs system.img.

Sample fstab:
fstab in dt:
android {
    fstab {
        odm_ext4 {
            dev = "/dev/block/by-name/odm";
            mnt_point = "/odm";
            type = ext4;
            mnt_flags = "ro";
            fs_mgr_flags = "slotselect";
        };
        odm_f2fs {
            dev = "/dev/block/by-name/odm";
            mnt_point = "/odm";
            type = f2fs;
            mnt_flags = "ro";
            fs_mgr_flags = "slotselect";
        };
    };
}

fstab in file:
/dev/block/by-name/odm /odm ext4 ro slotselect
/dev/block/by-name/odm /odm f2fs ro slotselect

Test: make & boot & check /proc/mounts
Change-Id: I64892e3007b0cfd7d06dad1cfc664c45305197ee
2019-01-10 22:58:18 +08:00
Bowgo Tsai
7bf0479bb9 libfs_avb: Switch to range-for for GetHashtreeDescriptor
Bug: None
Test: boot a device
Change-Id: I9d0bdced5fa08cd4bf125c478504c45e5cfbcd4e
2019-01-10 18:12:17 +08:00
Bowgo Tsai
d79dd84479 libfs_avb: refactoring
This commit has the following changes:

    1. Builds libfs_avb via "fs_mgr/libfs_avb/Android.bp" instead of
       "fs_mgr/Android.bp", and removes the libfs_avb source
       dependencies on "fs_mgr/fs_mgr_priv.h".

    2. Moves static functions in fs_avb.cpp into util.cpp or
       avb_util.cpp, depending on whether the function is related to
       AVB or not.

    3. Introduces two host unit tests: libfs_avb_test and
       libfs_avb_internal_test, the former is to test public
       <fs_avb/fs_avb.h> APIs, while the latter is to test libfs_avb
       internal functions.

    4. Splits fs_avb_unittest_util.* into:
       - fs_avb_test_util.* (host static lib: libfs_avb_test_util),
       - basic_test.cpp (host executable: libfs_avb_test)

Bug: 112103720
Bug: 117960205
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Test: boot a device
Change-Id: I11d6c9e9019e20b594d9321b9a28118d4806e5a7
2019-01-10 18:11:48 +08:00
Treehugger Robot
3ffb4ab82a Merge "Build init with the bootstrap bionic libs" 2019-01-10 07:50:22 +00:00
Haoyu Tang
f32bc7cd29 init: remove the restriction of arguments
X86 Kernel could pass CPU capablity to init as argument. This will cause init
can't start first-stage because unknown argument. Need remove this restriction
of arguments to start init successfully.

Fixes: 122435289
Test: Android init can start successfully

Change-Id: I1d432e25553589dd7f618e42ad238b9372dbe34f
Signed-off-by: Haoyu Tang <haoyu.tang@intel.com>
Signed-off-by: Xihua Chen <xihua.chen@intel.com>
2019-01-10 01:02:29 +00:00
Tri Vo
05f96a2561 init: don't restorecon root sepolicy files
Removing restorecon on root sepolicy files because:
1. Under normal boot the files are properly labeled when creating the
image. Restorecon'ing them successfully would require "adb remount".
2. These restorecon's are not required for recovery to function.

Fixes: 122535196
Test: boot blueline
Change-Id: I20b127e950b16535d4bfa9fd4e626e11228925e7
2019-01-10 00:50:43 +00:00
Treehugger Robot
d184eb1fd9 Merge "Exclude mount entries for vendor overlay" 2019-01-10 00:41:10 +00:00
Justin Yun
d3e2a78a99 Exclude mount entries for vendor overlay
When testing adb-remount with overlayfs, vendor overlay may fail the
test because there are unexpected overlayfs uses by vendor overlay.
By excluding mount entries for vendor overlay, the test runs
regardless of vendor overlay mount.

Bug: 122231184
Test: run adb-remount-test.sh with vendor overlay mount
Change-Id: I795774b27d5e5f973792337813b67487a5d72e29
2019-01-10 00:40:33 +00:00
Yifan Hong
e7f492dc61 liblp: BLKROSET 0 prior to FlashPartitionTable
Test: OTA after cppreopt
Change-Id: I0c611588fac73fbd8d1502cb57481f3363e0cbe8
Fixes: 122487294
2019-01-09 16:20:33 -08:00
Yifan Hong
acf859a891 fs_mgr: system_other does not want overlayfs.
system wants overlayfs, and system_other is a valid candidate;
but system_other does not want overlayfs.

Addresses these denials:
avc: denied { read write } for comm="tune2fs" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
avc: denied { read } for comm="e2fsck" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
avc: denied { read write } for comm="e2fsck" name="sda6" dev="tmpfs" ino=15114
  scontext=u:r:fsck:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0

Fixes: 122454600
Test: boot, no tune2fs and e2fsck denials

Change-Id: Icce20f1463cfde034a56f25590cba9f8fe5f41a4
2019-01-09 16:20:33 -08:00
Treehugger Robot
1c018862a0 Merge "Add systrace tag for RRO" 2019-01-09 23:50:11 +00:00
Martin Stjernholm
b49289b43a Some minor updates in the libdexfile external API.
Test: m
Test: mmma system/core/{libunwindstack,libbacktrace} and run host gtests
Bug: 119632407
Bug: 120978655
Change-Id: I919586ab503be3617e8a0604dfe48db331e7af94
2019-01-09 23:25:25 +00:00
Daniel Rosenberg
ca00b0edeb Add conditional class starting
This adds the ability to prevent a class from starting
if a certain persistent property has been set to
disallow it.

A class will only load if there is not a property named
persist.init.dont_start_class.[class name] set to 1.

Test: Set a property called persist.dont_start_class.[class]
      to 1. Verify that the given class does not start
Change-Id: I51c70ad635762ed77855d0509e630adb0aec0eb1
2019-01-09 15:18:01 -08:00
Tom Cherry
afd483c645 liblog: convert README to markdown
Android uses markdown for its readmes, not man pages, so update
appropriately.

Test: n/a

Change-Id: I674a9da5af56aeebfaca852764eb6c1ca0b166ff
2019-01-09 14:04:05 -08:00
Tom Cherry
ff4e07076d Use the existing .clang-format-2 for liblog
Test: n/a
Change-Id: Iadbb88d99aecbc2f7485a5dfa91f5b54846a5b67
2019-01-09 13:08:10 -08:00
Josh Gao
afd3dfeeff Merge "Only set mdns_registered on success" 2019-01-09 20:41:17 +00:00
David Anderson
22a8462336 Merge "adbd: Automatically disable verity in adb remount." 2019-01-09 19:48:47 +00:00
Jiyong Park
93318d496c Build init with the bootstrap bionic libs
As bionic libs are moved from /system to the runtime APEX, anything that
is outside of the runtime APEX cannot use private symbols from the
bionic libs.

init is not included in the runtime APEX but is using private bionic
APIs: __system_property_[add|area_init|update|...]. So, it was required
to publicize the private symbols for init.

However, since init is started before the runtime APEX is activated, it
actually cannot use the bionic libs from the runtime APEX, but will use
the bootstrap bionic libs left in /system/bootstrap/lib[64]. Because
init and the bootstrap libs are in the same partition, init doesn't need
to link against the stubs of bionic libs. In order to make this
possible, the new property 'bootstrap' is set to true allow init to use
the bootstrap bionic.

Bug: 120266448
Test: m with https://android-review.googlesource.com/c/platform/bionic/+/849044

Change-Id: If61f25faf9aed4968bf2922859ceb94276ba03fb
2019-01-09 20:41:41 +09:00
Jim Blackler
34f55bd45a Merge "Add start time to LmkKillOccurred" 2019-01-09 08:44:35 +00:00
Gustav Svensson
965286cba8 Only set mdns_registered on success
In setup_mdns_thread mdns_registered should only be set to true
if DNSServiceRegister was successful.

Test: N/A

Change-Id: I8a2798cced91b05b7d8bf5f0df4d16719c581dee
Signed-off-by: Gustav Svensson <gustav.svensson@volvo.corp-partner.google.com>
2019-01-09 08:46:50 +01:00
Treehugger Robot
75e6ec7056 Merge changes from topic "libmeminfo"
* changes:
  meminfo: Add Smaps(), showmap and friends.
  libmeminfo: Add SmapsRollup
  meminfo: Add ReadVmallocInfo()
2019-01-09 04:38:45 +00:00
Treehugger Robot
55c083901d Merge "fs_mgr: overlayfs_mount_scratch don't write to system_other" 2019-01-09 01:33:37 +00:00
Sandeep Patil
82a48b160a meminfo: Add Smaps(), showmap and friends.
Needed by showmap and also android_s_Debug to classify each allocation
into multiple heaps.

The APIs added are:
ForEachVmaFromFile - Global API to parse a file expected to be in the
same format as /proc/<pid>/smaps and make a callback for each VMA found.
ProcMemInfo::ForEachVma - Same as 'ForEachVmaFromFile' but for a
ProcMemInfo object corresponding to a process(pid).
ProcMemInfo::Smaps - Wrapper to ProcMemInfo::ForEachVma, except the
function collects 'struct Vma' in a member vector and returns the
reference for the same.

Added showmap2 using the APIs and the corresponding tests the same time.

Bug: 111694435
Test: showmap_test.sh
Test: libmeminfo_test 1

Change-Id: I3065809cf94ecf3da88529809701035c47a8ce34
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-08 17:08:10 -08:00
Bowgo Tsai
cd0d77da33 Merge "Support host build for libdm and libfstab" 2019-01-09 00:32:43 +00:00
Treehugger Robot
09e3fe25b0 Merge "debuggerd: Fix return type in error case" 2019-01-08 23:46:13 +00:00
Yifan Hong
3be2c7a14b fs_mgr: overlayfs_mount_scratch don't write to system_other
This change removes this denial:
avc: denied { write } for comm="init" name="sda6" dev="tmpfs" \
    ino=25715 scontext=u:r:init:s0 tcontext=u:object_r:system_block_device:s0 \
    tclass=blk_file permissive=0

The reason is that during any mount_all in init,
fs_mgr_overlayfs_mount_all() will mount a list of candidates for
scratch, which includes system_other. However, in order to probe
if /overlay directory exist in the partition, it only needs read
access to the block device, and mount the partition as readonly.
If the block device is a true candidate (i.e. it does have /overlay),
re-mount it as writable.

Test: flash, wipe, boot, denial goes away, cppreopt is successful
Test: boot the second time, no denials (no cppreopt this time)

Fixes: 122454600

Change-Id: I465b363eac755d79711e4f82955cd98450527122
2019-01-08 15:01:32 -08:00
Mårten Kongstad
ee9534515e Add systrace tag for RRO
Introduce a new systrace tag, TRACE_TAG_RRO, for use with runtime
resource overlay.

Bug: 119761810
Test: builds
Merged-In: I7b883d107a9ae2b12bbda04b74001a68e2a904aa
Change-Id: I7b883d107a9ae2b12bbda04b74001a68e2a904aa
2019-01-08 14:17:47 -08:00
Treehugger Robot
6eec7f031e Merge "fs_mgr: Add a helper for creating one-off dynamic partitions." 2019-01-08 19:18:25 +00:00
Christopher Ferris
d76bd4c8d0 Merge "Remove CHECK in AdjustEncodedValue." 2019-01-08 16:47:06 +00:00
Greg Kaiser
3fa9a59ea3 debuggerd: Fix return type in error case
With our method returning 'bool', a "return -1" is interpretted
as 'true'.  We change this to an explicit 'false', as desired.

Test: TreeHugger
Change-Id: I222858b797bc4242a2dc6d4fe81df3d2586d055a
2019-01-08 06:29:22 -08:00
Narayan Kamath
6cc741ec9a Merge "Allow the system user to read apex_data_file." 2019-01-08 11:50:12 +00:00
Bowgo Tsai
fa416f9bec Support host build for libdm and libfstab
The host builds for both libs are needed for libfs_avb host unit test.
Also replaces strlcat()/strlcpy() with snprintf() because the former
doesn't have a glibc version. Or switch char* to std::string*.

Bug: 112103720
Bug: 117960205
Test: m libdm ARCH=x86_64
Test: m libfstab ARCH=x86_64
Test: atest libdm_test
Test: atest fs_mgr_unit_test
Test: boot a device

Change-Id: Id9b92b5286b8ed9ab0d80f18ab5802dcfeb83dfa
2019-01-08 17:56:56 +08:00
Treehugger Robot
2fc9f62607 Merge "debuggerd_client: resolve tid to tgid when dumping Java stacks." 2019-01-08 08:21:51 +00:00
Treehugger Robot
d0dec304c5 Merge "libutils: use libbase_headers instead of libbase." 2019-01-08 06:42:22 +00:00
David Anderson
908f07b0b8 fs_mgr: Add a helper for creating one-off dynamic partitions.
This will be used by gsid to invoke mkfs.ext4 on the userdata_gsi
partition. Since the extents are not located on the super partition, we
need a helper method that takes in an LpMetadata.

Bug: 121210348
Test: manual test
Change-Id: I00467ace8a745fb0c0d130babfda1a2d5d97c208
2019-01-07 18:31:54 -08:00
Treehugger Robot
97212d36da Merge "Set system property if 'updatable' process crashes too frequently" 2019-01-07 23:55:25 +00:00
Yifan Hong
f307efcf63 Merge "health: Add CAP_WAKE_ALARM to service via init" 2019-01-07 23:09:19 +00:00
Treehugger Robot
bc35f067ac Merge "fs_mgr: overlayfs: if existing scratch mountpoint is system_empty" 2019-01-07 22:41:46 +00:00
Mark Salyzyn
df8cf18804 fs_mgr: overlayfs: if existing scratch mountpoint is system_empty
On first mount check if overlays are setup, if not and there is
no space, then umount and make a filesystem and try again.

Test: adb_remount_test.sh
Bug: 119885423
Change-Id: I3a76ff5b53474976f72e9db326b26838f7df5ba8
2019-01-07 22:41:27 +00:00
Treehugger Robot
c08c8080ef Merge "fs_mgr: overlayfs test fix adb_sh" 2019-01-07 22:27:17 +00:00
Tri Vo
7061c88de1 Merge "ueventd.rc: Move device-specific entries to /vendor/ueventd.rc." 2019-01-07 22:09:44 +00:00
Mark Salyzyn
b3c0074917 fs_mgr: overlayfs test fix adb_sh
Some commands like 'adb_sh grep " rw," /proc/mounts' do not preserve
the embedded spaces when transferred to the device and thus do not
entirely behave as expected.  There are several commands issued this
way throughout the test that are similarly broken.  To add
consistency, pass any arguments that are not explicitly (double)
quoted and contain embedded spaces as quoted to preserve.

Also devices that report the kernel internal device /dev/root in
/proc/mounts should be suppressed when investigating whether
overlayfs is needed.  If /dev/root is reported, then we should assume
that the mount point / represents it for the following df command
when trying to determine if the partition is right-sized.

When there is only one device attached, and a serial number is not
specified, correctly determine this condition to progress to
the testing.

Test: adb_remount_test.sh
Bug: 122231184
Change-Id: I913e297dd272d6691110bb5d7a7c7f54321b6833
2019-01-07 21:39:56 +00:00