Commit graph

47941 commits

Author SHA1 Message Date
Yifan Hong
f0dd120793 MetadataBuilder::IsABDevice: make static / use std::optional
Align with hat sRetrofitDap does.

Test: liblp_test_static
Change-Id: Ifc4c45404369a4eb18c02fc6a0ede938da5809b8
2019-07-24 17:19:06 -07:00
Yifan Hong
9d0e6cdfef MetadataBuilder::NewForUpdate: check sysprop instead
Check the value of ro.boot.dynamic_partitions_retrofit instead of
checking the name of the super partition being 'super' is a more
reliable way of determining retrofit DAP devices.

Some devices launch with DAP (e.g. cuttlefish) doesn't have "super"
as the super partition name. When Virtual A/B is implemented on
cuttlefish, update_engine calls NewForUpdate for the current super
partition metadata. Hence, this code needs to check the retrofit
sysprop instead.

Also, renamed IsRetrofitDevice to IsRetrofitMetadata to avoid the
confusion.

Test: OTA on retrofit DAP device
Test: OTA on launch DAP device
Test: liblp_test_static
Change-Id: I4636de854734df1bb61779d9a955217e89fdb2fd
2019-07-24 17:19:06 -07:00
Steven Moreland
4e6275ddaf Merge "Remove utf32 functions." 2019-07-08 17:02:10 +00:00
Steven Moreland
0e19f3b4cc Remove utf32 functions.
These don't appear to be used by anything.

Bug: N/A
Test: binary inspection + code inspection
Change-Id: I6c12db26c320a66bcf6e28618c6e9f61b40d985e
2019-07-02 18:15:03 -07:00
Tom Cherry
c538656d7d Merge "Add android::base::GetPids() function to return all pids" 2019-07-02 17:04:08 +00:00
David Anderson
e5815ca19a Merge "fastboot: add a wipe-super command." 2019-07-02 00:54:17 +00:00
Tom Cherry
ab80b02493 Merge "Revert "Modularize logd."" 2019-07-01 23:28:29 +00:00
Daniel Norman
e33e1a8242 Merge "Checks each interface in an init_rc file is a known hidl_interface." 2019-07-01 21:15:38 +00:00
Tom Cherry
13b1f34279 Add android::base::GetPids() function to return all pids
We loop over /proc to iterate through pids in a lot of code, so let's
consolidate this into a single function in libbase.

Test: new unit test
Change-Id: I908fab90b603546d0e3e8b8acdc8dadfc3552d62
2019-07-01 13:55:46 -07:00
Tom Cherry
c3c598134f Merge "Revert "logd: validate and fill in socket credentials"" 2019-07-01 17:30:28 +00:00
Sandeep Patil
581f45892c Merge "dmabuf_dump: Change the default view to per-process stats" 2019-07-01 15:36:02 +00:00
Tom Cherry
3096818c8e Revert "Modularize logd."
logd isn't meant to be modularized.  The previous user was using a
small subset of LogListener.cpp, which is now copied into their
project.

Test: liblog, logd unit tests

This reverts commit fafea32468.

Change-Id: I05ec764db2d9395f2d5b69a1a610c9c55240ab3a
2019-06-28 14:16:13 -07:00
Tom Cherry
40da03b742 Revert "logd: validate and fill in socket credentials"
We don't want to fake socket credentials if they were not provided by
the kernel.  If there is a bug preventing us from reading the
credentials then it must be solved directly.

Test: logd, liblog unit tests
Test: boot and ensure overflow uid doesn't show up

This reverts commit c4e4823b00.

Change-Id: I683129a8a214637635f163ae25c39bb8a47cd50f
2019-06-28 14:16:00 -07:00
David Anderson
7c84b9fea2 fastboot: add a wipe-super command.
Usage: fastboot wipe-super [super_empty.img]

This command will read the given super_empty.img (using the default one
in ANDROID_PRODUCT_OUT if not specified), and flash by generating a
temporary super.img with no partition data. This command will even work
on retrofit devices.

This command is intended to be used either during device bringup or with
scripts that will manually flash individual dynamic partitions, in place
of using "fastboot flashall".

Bug: 136282057
Test: fastboot wipe-super on retrofit and non-retrofit device
Change-Id: Icab368a63ff36fcce9ac9304eb3966dd38bd78c4
2019-06-28 21:09:03 +00:00
Daniel Norman
3df8dc58b2 Checks each interface in an init_rc file is a known hidl_interface.
Test: Adding a misspelling to an init_rc's interface line and observing
build failure.
Bug: 77646540
Change-Id: I58f66d73f0bd9b4203e8259161843b56ad428d73
2019-06-28 13:31:54 -07:00
Josh Gao
d194013097 Merge "adbd: move jdwp listening logic into ART." 2019-06-28 19:01:38 +00:00
Sandeep Patil
725e0a048b dmabuf_dump: Change the default view to per-process stats
Add '-a' commandline option to show the old complete table that shows
dmabuf x process grid.

Bug: 135668399
Test: dmabuf_dump
Test: dmabuf_dump -h
Test: dmabuf_dump -a
Test: dmabuf_dump -a 123
Test: dmabuf_dump 123 456
Test: dmabuf_dump <pid>

Change-Id: If228c97baa375c515d94baf3b5be674cfcc09919
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-06-28 14:05:42 +08:00
Janis Danisevskis
e180ec52a2 Merge changes from topic "gatekeeper_maintenance"
* changes:
  Replace legacy trusty gatekeeper HAL with HIDLized version
  Gatekeeperd maintenance
2019-06-28 00:43:10 +00:00
Tom Cherry
c4117afdc9 Merge "init: switch host_init_verifier to getopt()" 2019-06-27 21:09:07 +00:00
Treehugger Robot
99ae1d943b Merge "Make ext4 userdata checkpoints work with metadata encryption" 2019-06-27 17:29:03 +00:00
Tom Cherry
3f1bce870b init: switch host_init_verifier to getopt()
Test: host init verifier works

Change-Id: Ia0fe5994079e6e182a64b14a15fdb36328080168
2019-06-27 10:09:12 -07:00
Tom Cherry
52f617176e Merge "init: clean up host_init_stubs a bit" 2019-06-27 15:55:44 +00:00
Tom Cherry
90381baf2b Merge "init: remove last init.cpp global" 2019-06-27 15:41:01 +00:00
Tom Cherry
21d98807bd Merge changes I9248fbaf,Ifd795776,I201109b5
* changes:
  init: remove console_init_action
  Move actual parsing from Service to ServiceParser
  Split out ServiceList and ServiceParser from service.cpp/.h
2019-06-27 15:40:41 +00:00
Tiger Huang
91913677c3 Merge "dmabuf_dump: Fix aosp_x86-eng builds" 2019-06-27 08:37:08 +00:00
Sandeep Patil
3dc456ee57 dmabuf_dump: Fix aosp_x86-eng builds
Test: lunch aosp_x86-eng; mma -j
Test: lunch aosp_blueline-eng; mma -j
Bug: 136136199

Change-Id: Ie6f90c967b356a55db09acee7b3596661e001166
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-06-27 01:21:11 -07:00
Christopher Ferris
037d025aa5 Merge "Cache only a small portion of page map data." 2019-06-27 06:46:54 +00:00
Treehugger Robot
bb56ba8b34 Merge "dmabuf_dump: Make output more readable and debug friendly" 2019-06-27 06:21:57 +00:00
Sandeep Patil
6347749ae9 dmabuf_dump: Make output more readable and debug friendly
- Get rid of the PSS number that didn't make sense.
- Fix double counting in per-process size when buffers had file
  descriptors and mmap'ed
- Make the output much more readable
- Print totals where they make sense.
- Dont print per-process fd and map refs separately, total ref count per
  process is sufficient.

Bug: 135668399
Test: dmabuf_dump (on AOSP blueline)

Change-Id: I10dc0a332d49110dd68f0eaa94a326679361deea
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-06-26 18:50:45 -07:00
Christopher Ferris
a484817fc8 Merge "Increase timeout to avoid flaky tests." 2019-06-27 01:33:57 +00:00
Suren Baghdasaryan
7e473e262d Merge "Fix IsUsable to check for each controller separately" 2019-06-27 00:52:15 +00:00
Tom Cherry
f1a044bac4 init: clean up host_init_stubs a bit
In retrospect, these always should have been header only.  We don't
need setgroups() anymore either, since we have the right symbols now.

Test: build
Change-Id: If6fbf6f8ee288ed261576207d90a7ec5674853f9
2019-06-26 15:38:47 -07:00
Paul Lawrence
323959ea27 Make ext4 userdata checkpoints work with metadata encryption
When both ext4 user data checkpoints and metadata encryption are
enabled, we are creating two stacked dm devices. This had not been
properly thought through or debugged.

Test: Enable metadata encryption on taimen (add
keydirectory=/metadata/vold/metadata_encryption to flags for userdata in
fstab.hardware)
    Unfortunately metadata is not wiped by fastboot -w, so it is
    necessary to rm metadata/vold -rf whenever you wipe data.
    fastboot flashall -w works
    fastboot reboot -w works
    A normal boot works
    Disable checkpoint commits with
    setprop persist.vold.dont_commit_checkpoint 1
    vdc checkpoint startCheckpoint 10
    adb reboot
    wait for device to fully boot then
    adb reboot
    Wait for device to fully boot then
    adb logcat -d | grep Checkpoint shows the rollback in the logs

    This tests encryption on top of checkpoints with commit, encryption
    without checkpoints, and rollback, which seems to be the key cases.

Bug: 135905679
Change-Id: I24387a2943dce28b918c34894f24911b20429be7
2019-06-26 15:09:07 -07:00
Christopher Ferris
afc0ff7fe0 Increase timeout to avoid flaky tests.
Also, print extra information when an error occurs.

Test: Ran unit tests.
Change-Id: I3404549db0ac18a4a82a99b2620556db96376bca
2019-06-26 15:08:51 -07:00
Tom Cherry
172c83f972 init: remove last init.cpp global
By moving it into builtins.cpp..., but that's less bad than it is
now, especially since this is defunct in code targeting Q+.  Remove
the guards that init.h isn't being included by other files too as it's
not useful anymore.

Test: build
Change-Id: Ic564fcff9e8716ec924098b07a8c9d94ca25f960
2019-06-26 14:46:58 -07:00
Tom Cherry
ff88e30126 init: remove console_init_action
There's no fundamental reason to store this aside.  That property can
only be written by init, so it's not likely that we're going to
corrupt it.

Test: boot and use serial console
Change-Id: I9248fbaf959ea913d09add829d4cb509af99d570
2019-06-26 14:20:53 -07:00
Tom Cherry
b1ffb1ded5 Move actual parsing from Service to ServiceParser
This is how this should have been done since the beginning.

Test: build, boot
Change-Id: Ifd795776c71a2e666da7fab90cbb3f356af93d4f
2019-06-26 14:03:16 -07:00
Tom Cherry
2aeb1addee Split out ServiceList and ServiceParser from service.cpp/.h
These always should have been in their own files.

Test: build
Change-Id: I201109b5ee63016e78901bbfd404846d45e1d4e6
2019-06-26 13:45:07 -07:00
Suren Baghdasaryan
25eb1bfadf Fix IsUsable to check for each controller separately
CgroupController::IsUsable is using a global static variable to store the
existence of the controller. That means the first controller existence
check would affect all other controllers. Fix this by making this variable
to be a member of CgroupController class so that each controller can check
for its existence independently of other controllers.

Fixes: aa1d54f0cc ("Remove ACgroupController_getFlags to fix API breakage")
Bug: 136020193
Test: adb shell cat /proc/$pid/task/*/cgroup" prints "cpuset:/top-app"
Test: for new launched activity process
Change-Id: I4741a9126ea494122d5b2b1a0c4d7252bff6025c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-06-26 11:35:11 -07:00
Christopher Ferris
7f8915c76e Cache only a small portion of page map data.
The scudo memory allocator will allocate a large virtual memory address
that causes procrank to allocate a huge amount of data. Modify so it
caches the data a bit at a time.

Remove some allocations that are not necessary since the data is only used
in the first loop.

Fix a few pread64 checks against the actual bytes read, rather than the
read is < 0.

Fix sort by rss in procrank.

Bug: 135694447

Test: Ran unit tests (only one unit test actually runs the modified code).
Test: Ran the old version of procrank using a static libmeminfo and verified
Test: that the same data is found as the new version.

Change-Id: I8adc169b5607ec994ff13a9e161a479350d84c4d
2019-06-25 21:14:36 -07:00
Josh Gao
5f2c5bbd04 adbd: move jdwp listening logic into ART.
Test: manually use jdwp
Change-Id: Ia09a5c643cba9ec5f343c9767d43d72b077bc247
2019-06-25 12:37:20 -07:00
Treehugger Robot
c0349199db Merge "bootstat: add reboot,longkey sub-reason to known set" 2019-06-25 07:13:32 +00:00
Elliott Hughes
12794c039a Merge "Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""" 2019-06-25 05:56:53 +00:00
Elliott Hughes
fab9f30f6f Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""
This reverts commit b00e66f754.

Reason for revert: http://b/135753060

Change-Id: I30f472427f52076b64902420f9538b4a880a2cbe
2019-06-25 05:42:55 +00:00
Tom Cherry
84fc269b6e Merge "init: Handle properties in the background of calling fs_mgr" 2019-06-24 22:46:09 +00:00
Tom Cherry
20670249d0 Merge "Actually make fs_path_config / fs_path_config_from_file private" 2019-06-24 20:24:12 +00:00
Tom Cherry
71bdf2820e init: Handle properties in the background of calling fs_mgr
It's been a long standing problem that init calls fs_mgr functions
synchronously and therefore stops handling properties, which causes
deadlocks if either fs_mgr, or vdc, or vold attempt to set
properties.

Previous work, b/21904461, shows that there is a large performance
penalty for adding any amount of locking to properties, so moving
property service into its own thread generically is not a viable
option.  However, we can be sure that init is not setting properties
while the fs_mgr functions are running, so we can poll the property
socket in a thread while we call these functions.

The other alternative would have been to separate the fs_mgr functions
into smaller pieces and revisit the main init loop between each
piece.  Unfortunately, this would be difficult, since
fs_mgr_mount_all() calls out to different processes via logwrapper,
which synchronously polls on a logging FD from the child, among other
complexities that would make this strategy much more difficult than it
would be worth.

Bug: 21904461
Test: device boots, including when setting property in
      fs_mgr_mount_all()

Change-Id: Ib0b7123024035884f9d90f9b489c1e2f5a2e1707
2019-06-24 13:23:49 -07:00
Tom Cherry
3f6b16395d Merge "Avoid get same timestamps in log testcase" 2019-06-24 20:14:37 +00:00
Tom Cherry
af274fd086 Merge "init: use a property instead of file to communicate cold boot done" 2019-06-24 19:39:03 +00:00
Jone Chou
b9a8033037 bootstat: add reboot,longkey sub-reason to known set
regular expression:
- "reboot,longkey,.*" (184)

regex is dependent on:
- https://android-review.googlesource.com/947976

Test: none
Bug: 132955428
Bug: 133520088
Change-Id: I53d13d95ac11ac73273824156363378372a562ed
2019-06-24 06:29:49 +00:00