Commit graph

43937 commits

Author SHA1 Message Date
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
David Sehr
8f5f643c57 Merge "Enable building ATRACE stubs on Windows" 2019-01-07 21:38:45 +00:00
Treehugger Robot
e7bb1b3e39 Merge "Adding Android Binder Bridge (abb) utility launched from adbd." 2019-01-07 19:34:32 +00:00
Zimuzo
c55a8c6afb Set system property if 'updatable' process crashes too frequently
Critical processes currently cause the device to reboot into recovery when they
crash 4 times in 4mins.

We extend this feature to a new 'updatable' class of init services.
If these services crash 4 times in 4mins, instead of rebooting into bootloader,
we set ro.init.updatable_crashing to '1'. apexd and update_verifier will
listen to that property and try to abort and rollback updates, staged apex
modules and new slots respectively.

Test: Tested manually by marking zygote as updatable and killing zygote
frequently, verified that property is set.
Bug: 120598832
Change-Id: I7d47ea1223f7792a834981c729694242ab3f28c9
2019-01-07 19:26:10 +00:00
Narayan Kamath
8464d79877 Allow the system user to read apex_data_file.
For consistency with APKs, signature verification is performed
in the system_server. This includes checking that the signature of
an updated install matches the signature of the active package that
it updates. For this, it requires search access to /data/apex and
read access to the files under that directory.

Test: m
Change-Id: I8795b26b9a40ba7126c2a548fbec82ff322a1453
2019-01-07 19:15:10 +00:00
Yifan Hong
789d905b50 Merge "Add none to supported fs type" 2019-01-07 18:26:19 +00:00
Sandeep Patil
fa2d8d5541 libmeminfo: Add SmapsRollup
This adds the tests and SmapsRollup() parsing function in
ProcMemInfo. Adds tests to check the return value as well as
the correctness.

Bug: 111694435
Test: libmeminfo_test 1 --gtest_filter=TestProcMemInfo.*
Test: libmeminfo_benchmark --benchmark_filter=BM_SmapsRollup_
Result:
----------------------------------------------------------
Benchmark                   Time           CPU Iterations
----------------------------------------------------------
BM_SmapsRollup_old       4751 ns       4730 ns     149458
BM_SmapsRollup_new       4858 ns       4837 ns     144636
----------------------------------------------------------

Change-Id: Ia051fe53a7622e3091502ff7166efafae35e7935
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-07 09:43:37 -08:00
Sandeep Patil
c24f1e3c63 meminfo: Add ReadVmallocInfo()
This is to replace occurrences of get_allocated_vmalloc_memory().
Splitting into libmeminfo already found a bug with current code which
failed to account for memory allocated by modules due to addition of
the extra [%module_name%] in __builtin_return_address().

  See: https://elixir.bootlin.com/linux/latest/source/kernel/kallsyms.c#L373

Also improves the performance a bit in the process.

Bug: 119639955
Bug: 111694435
Test: libmeminfo_test 1 --gtest_filter=SysMemInfoParser.TestVmallocInfo
Test: libmeminfo_benchmark --benchmark_filter=BM_VmallocInfo_*
Result:
----------------------------------------------------------------
Benchmark                         Time           CPU Iterations
----------------------------------------------------------------
BM_VmallocInfo_old_fixed     459239 ns     457268 ns       1532
BM_VmallocInfo_new           386032 ns     384353 ns       1821
----------------------------------------------------------------

Change-Id: I1b6606ac73b5cc2dac31d24487b462ec9abfb2ef
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-07 09:41:55 -08:00
Alex Buynytskyy
640407d632 Adding Android Binder Bridge (abb) utility launched from adbd.
Once launched, abb will listen for incoming Binder cli requests.
Executing in-process provides 6x latency improvement (125ms vs 25ms on
PixelXL) for commands like 'package path'

Intended usage by Android Studio for fast deployment and patching of APKs.

Test: manual
BUG: 111621042

Change-Id: Ica84eb2ec9628efa441ecd627b119f3361feaf9f
2019-01-07 15:45:11 +00:00
Mark Salyzyn
3009be5cb6 Merge "llkd: handle 'adbd shell setsid' to preserve adbd" 2019-01-07 15:37:46 +00:00
Logan Chien
c2aad281fc Merge "Fix runtime namespace links for vendor processes" 2019-01-07 05:19:49 +00:00
Logan Chien
c0bb441b15 Fix runtime namespace links for vendor processes
This commit removes the soname filter from the namespace fallback link
from `runtime` to `system` in the vendor process.  This fixes the
problem that vendor process might fail to load `libnetd_client.so`,
`libc_malloc_debug.so`, `libc_malloc_debug_leak.so`, and other libc
dependencies.

This commit also removes the namespace fallback link from `runtime` to
`default` in the vendor process.  According to the comments in [1], the
original intention was to allow the access to `/system/${LIB}` not
`/vendor/${LIB}`.  Furthermore, `com.android.runtime` suppose to work
without libraries from `/vendor/${LIB}`.

[1] https://android-review.googlesource.com/c/858456

Bug: 119867084
Bug: 122025516  # Motivation of this commit
Test: Executables under vendor partition are not blocked by
`libnetd_client.so` not found error.

Change-Id: I682baada9d755910832474bb3d8307cd49c21ece
2019-01-07 11:14:34 +08:00
Treehugger Robot
32b695daa7 Merge changes from topic "fiemap-writer-1"
* changes:
  fiemap_writer: enforce filesystem optimal block size alignment
  fiemap_writer: Fix file pinning / pinning status check code.
2019-01-07 01:48:46 +00:00
Tri Vo
4f408746cf ueventd.rc: Move device-specific entries to /vendor/ueventd.rc.
Bug: 110962171
Test: boot sailfish, taimen, blueline
Change-Id: If740c2bd85409c9a057cff68f8bfd870cad35b37
2019-01-06 16:15:07 -08:00
Treehugger Robot
301b394a36 Merge "Skip building libfs_avb unittest for Mac" 2019-01-06 07:46:44 +00:00
Bowgo Tsai
a99a1f275c Skip building libfs_avb unittest for Mac
Bug: 117960205
Test: m libfs_avb_host_unittest
Change-Id: Ib53efe3e36a3f70134b2431c2c0bfed52fdd3df6
2019-01-06 13:41:45 +08:00
Sandeep Patil
eb28e0c44b fiemap_writer: enforce filesystem optimal block size alignment
... instead of using the block size from the underlying block device.

Bug: 121211685
Test: fiemap_writer_test /dev/block/sda21 (on blueline)

Change-Id: I6038d3f06505a397280b0482e33814b4883be9a2
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-05 17:38:31 -08:00
Sandeep Patil
d2b2e21f59 fiemap_writer: Fix file pinning / pinning status check code.
The IsFilePinned() function is still not being called because I am still
seeing # blocks moved when I run following test on
aosp_blueline-userdebug.

 $ fiemap_writer_test /dev/block/sda21 \
 --gtest_filter=FiemapWriterTest.CheckWriteError

Bug: 122138114
Test: fiemap_writer_test /dev/block/sda21

Change-Id: I08d74093a082674d621772d202143d2f32e7c665
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-05 15:29:54 -08:00
Treehugger Robot
0dd3725982 Merge "Adding libfs_avb unittest framework" 2019-01-05 10:57:13 +00:00
Treehugger Robot
aed2ee9664 Merge "fs_mgr_avb: introducing class VBMetaData" 2019-01-05 06:41:14 +00:00
Matthew Maurer
1f9461786e Merge "trusty: Add trusty unittest control utility" 2019-01-05 04:23:25 +00:00
Treehugger Robot
70718dba91 Merge "llkd: enhance list properties" 2019-01-05 03:11:50 +00:00
Tom Cherry
9a9a4ad84c Merge "ueventd: create a /dev/block/by-name/ symlink without a partition name" 2019-01-05 01:06:16 +00:00
Yifan Hong
ea1c779067 Add none to supported fs type
Test: mount sdcard in recovery on cuttlefish
Change-Id: I23b0ce418f8240cfdaa2d560678989067d746de6
2019-01-04 15:28:30 -08:00
David Anderson
dbce5856d5 Merge "liblp: Allow GSI metadata to bypass slot suffixing checks." 2019-01-04 23:03:37 +00:00
David Anderson
c80c6ac9dd Merge "liblp: Add API for adding predetermined linear extents to partitions" 2019-01-04 23:03:10 +00:00
Josh Gao
4175cee3cc debuggerd_client: resolve tid to tgid when dumping Java stacks.
Bug: http://b/121438213
Test: debuggerd_test32
Test: debuggerd_test64
Change-Id: I4d114c8b0c4586ba64de5b45b47b0ec5c10354f8
2019-01-04 13:57:09 -08:00
Treehugger Robot
b815e6ccd4 Merge "llkd: check stack for wait_on_page_bit_killable" 2019-01-04 21:55:15 +00:00
Treehugger Robot
3cd02e8908 Merge "llkd: report stack signature matched" 2019-01-04 21:54:53 +00:00
Mark Salyzyn
da2aeb0c42 llkd: handle 'adbd shell setsid' to preserve adbd
A zombie setsid process occurs when adb shell setsid <command> is
issued, however llkd can only detect if it is a result of a kernel
livelock by killing the associated parent, which would be adbd;
resulting in the adb connection(s) being terminated.  Will special
case this condition in order to preserve adbd for debugging purposes.

We parse <parent>&<child> in ro.llk.blacklist.parent as this
association, thus adbd&[setsid] covers this special case.
Ampersand was selected because it is never part of a process name,
however a setprop in the shell requires it to be escaped or quoted;
init rc file where this is normally specified does not have issue.

getComm() is effectively pure, so hold on to the return value for
sake of efficiency.

This also reverts commit 599958d114
which granted adbd blanket parent immunity from monitoring on
userdebug builds.  The new logic is a more refined means of
preserving the live lock checking associated with adbd and allows
the operation to be performed on user builds.

POC: date ; adb shell setsid sleep 900 ; date
Positive for bug, reports less than 15 minutes, otherwise solved.

Test: llkd_unit_test
Bug: 120983740
Change-Id: I6442463a48499d925a3a074423a24a1622905559
2019-01-04 13:49:48 -08:00