Commit Graph

53966 Commits

Author SHA1 Message Date
Tianjie Xu b6d7ea15b7 Handle the reboot in the recovery user mode
We have switched to "/system/bin/reboot" to perform the reboot. But
accessing the shell for user build under recovery is not allowed by
sepolicy. So adding a special routine to handle this reboot case.

Bug: 141247819
Test: run `adb reboot` in user mode recovery
Change-Id: Ia37438e52c67fd2bd54e923a0fea5817a1455a08
2019-11-13 14:23:09 -08:00
Treehugger Robot a8f3081663 Merge "libcutils: remove unused socket_set_receive_timeout()." 2019-11-11 17:03:37 +00:00
Haibo Huang 01a3f13452 Merge "Fix build with new googletest" 2019-11-10 04:08:34 +00:00
Haibo Huang cf8a5b0e0e Fix build with new googletest
The new googletest requires prefix to be non-empty.

Exempt-From-Owner-Approval: fix test
Change-Id: Ic039cb657b455919e429a3ec2107893b1734e8a1
2019-11-10 04:08:25 +00:00
Elliott Hughes d91984a890 libcutils: remove unused socket_set_receive_timeout().
Test: treehugger
Change-Id: I834762fd83bdaa3b714c7531439bf9115a82e342
2019-11-08 15:21:39 -08:00
Treehugger Robot eb8cccf772 Merge "Replace -Weverything with -Wextra" 2019-11-08 22:24:28 +00:00
Elliott Hughes ef6d913027 Merge "fastdeploy: fix tests." 2019-11-08 21:11:45 +00:00
Colin Cross b1ea33b64c Replace -Weverything with -Wextra
-Weverything is not recommended, use -Wextra.

Bug: 143713277
Test: mma
Change-Id: Ic242983ce984ae87d4b6937af8c106abe8e38364
2019-11-08 13:09:00 -08:00
Treehugger Robot 0bc3f6b124 Merge "configs for jailed procs to dump code coverage data" 2019-11-08 17:51:16 +00:00
Nikita Ioffe 838f5ccf9b Merge "userspace reboot: don't re-install keyring when remounting userdata" 2019-11-08 17:38:00 +00:00
Suren Baghdasaryan 8106c8e09f Merge changes from topic "native process registration"
* changes:
  init: Add support for native service registration with lmkd
  lmkd: Support process types when registering a process
  lmkd: Add library function to unregister a process
  lmkd: Prepare lmkd to support connection from init process
  lmkd: Restrict process record modifications to the client that created it
2019-11-08 17:25:10 +00:00
Treehugger Robot be49555bca Merge "Do not run init CTS test on secondary ABI" 2019-11-08 16:29:44 +00:00
Treehugger Robot 16366e36d5 Merge "ziparchive: add a corpus for the fuzzer." 2019-11-08 16:22:41 +00:00
Ray Essick 36e6f6d128 configs for jailed procs to dump code coverage data
list system calls used for dumping code coverage information; empty on
non code coverage builds. Mini-jail configurations can include this file
instead of trying to manage the list themselves.

Bug: 139313557
Test: arm32/arm64/x86 media svcs w/native coverage on, kill -37 to dump stats.
Change-Id: I7323a9739803756a76f54e4a98e995522cab71ef
2019-11-08 08:20:29 -08:00
Nikita Ioffe 63898aa2b2 userspace reboot: don't re-install keyring when remounting userdata
From the implementation of FscryptInstallKeyring it looks like it will
install a new keyring on each call.

Another approach would be change FscryptInstallKeyring to first call
request_key[0] (http://man7.org/linux/man-pages/man2/request_key.2.html),
and don't add keyring in case request_key succeeded, but it looks like
that libkeyutils doesn't provide such functionality.

Since I was there, I've also added checks that we are not trying to
remount userdata on FDE devices.

Test: adb reboot userspace
Bug: 135984674
Change-Id: I2e063d7d87a3c2c26810e913a33e3a5c0364332b
2019-11-08 16:11:04 +00:00
Elliott Hughes 74f0fc6b18 fastdeploy: fix tests.
Actually log results of adb commands, so we can see why this fails.

Fix the asan-detected use of a value from a reused part of the stack.

Test: atest FastDeployTest on Linux (with an asan adb)
Change-Id: I4d2bbae62a301e16065d604a2c9918077489cafb
2019-11-08 15:39:50 +00:00
Treehugger Robot 7e5fb6b322 Merge "migrate *.libraries.txt from Make to Soong" 2019-11-08 04:04:14 +00:00
Tom Cherry a4eeeadcd3 Do not run init CTS test on secondary ABI
Init unit tests refer to libraries that do not exist for the
secondary ABI, and we'd rather test the libraries on the device than
statically link them, so only test the primary ABI.

Init will only run on the primary ABI in any case, and doesn't have
much arch specific code in it.

Bug: 143560509
Test: build
Change-Id: I3c1883b3b55e5a06391d2885242f38c74eab621d
2019-11-07 16:06:38 -08:00
Treehugger Robot 71ed80a229 Merge "Add require_root for libcutils tests" 2019-11-07 23:34:24 +00:00
Elliott Hughes 9e63ba787d ziparchive: add a corpus for the fuzzer.
Reuse the existing test data.

Test: ran fuzzer on host, saw a lot more log spam
Change-Id: If57e4b8708832d7296b118e6926d41951d4a3ca9
2019-11-07 14:24:04 -08:00
Tom Cherry e41aded12d Add require_root for libcutils tests
7 of these tests require root

Test: these tests pass as root
Change-Id: Ife4d1ae0c8fe8a2ace288c584ac044a37bae0b3e
2019-11-07 14:06:21 -08:00
Treehugger Robot ec56c59dbb Merge "healthd: Fix incorrect return check" 2019-11-07 21:18:59 +00:00
Paul Crowley 449282c021 Merge "Make encryption action an argument to mkdir" 2019-11-07 20:06:47 +00:00
Suren Baghdasaryan c29c2baa69 init: Add support for native service registration with lmkd
init should be able to register native services with lmkd so that they
can be killed when needed. Only processes with oom_score_adjust not
equal to the default -1000 will be registered with lmkd because with the
score that low the process is unkillable anyway.
Inform lmkd when a registered process is killed so that the record can be
removed.
Change init.rc to start lmkd during init phase so that it is there to
register other services.
Replace hardcoded oom_score_adj values with appropriate definitions.

Bug: 129011369
Test: boot and verify native service registration
Change-Id: Ie5ed62203395120d86dc1c8250fae01aa0b3c511
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 18:19:31 +00:00
Suren Baghdasaryan e353d8642c lmkd: Support process types when registering a process
Add an optional process type field into lmkd registration protocol so that
applications can be distinguished from services.

Bug: 129011369
Test: boot and verify native service registration
Change-Id: Ie610b5d07cbe247a55ab31bc079ee5c5923bea11
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 18:19:15 +00:00
Suren Baghdasaryan 4c6d3d737f lmkd: Add library function to unregister a process
Introduce lmkd_unregister_proc helper function. Fix a bug where
lmkd_pack_set_procremove used a wrong structure as a parameter.

Bug: 129011369
Test: verify process record removal when it is manually killed
Change-Id: I7ab5a499f6b1c6eecfdba4d0a5ec916053e2726a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 18:18:54 +00:00
Suren Baghdasaryan adb54f81bf lmkd: Prepare lmkd to support connection from init process
In order to register native services init needs ability to communicate with
lmkd. Make liblmkd_utils library available in recovery mode so that init
can link to it and add a data socket in lmkd to support additional
connection from init. Ensure SOCK_CLOEXEC type for lmkd socket to prevent
init children from inheriting it.

Bug: 129011369
Test: boot and verify native service registration
Change-Id: Iaa4f59282fb10f838f6811571e97d55754b1bd41
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 18:18:46 +00:00
Suren Baghdasaryan 12ab187885 lmkd: Restrict process record modifications to the client that created it
Associate each registered process with the PID of the lmkd client that
registered it to prevent one client from updating records of another
client.

Bug: 129011369
Test: boot and verify native service registration
Change-Id: Id8ca7bb6314df225d04da6469b523d2cdc237eaa
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 18:15:04 +00:00
Suren Baghdasaryan 7f44a83d8f Merge "Add libcutils_test into TEST_MAPPING" 2019-11-07 16:43:54 +00:00
Treehugger Robot ad3069eb72 Merge "Turn on executable bit on system_ext/bin" 2019-11-07 15:13:56 +00:00
Nikita Ioffe 7051bb3d74 Merge "userspace reboot: unmount apexes and switch to bootstrap namespace" 2019-11-07 12:09:46 +00:00
Jeongik Cha 4e467e71e9 Turn on executable bit on system_ext/bin
Setting executable bit on system_ext/bin is missing, so add them into
list.

Bug: 144066307
Test: m && check if system_ext/bin/* have execute permission.
Change-Id: I89c9e0d2d54f965ecd058bb9e77ba77b7ed164c1
2019-11-07 16:51:49 +09:00
Nikita Ioffe ab91ee986b userspace reboot: unmount apexes and switch to bootstrap namespace
This will bring device to the state closer to the one during normal boot

Bug: 135984674
Test: adb install system/apex/shim/com.android.apex.cts.shim.v1.apex
Test: adb reboot userspace
Test: verified install succeeded
Change-Id: I6ef73bde2ca817c8a62bf19b8f1895dd0d6d2829
2019-11-07 02:13:38 +00:00
Nikita Ioffe dbee3618be Merge "Make remount into checkpointing for ext4 userdata a no-op" 2019-11-07 02:12:57 +00:00
Suren Baghdasaryan 36973153fa Add libcutils_test into TEST_MAPPING
libcutils_test is fixed for all architectures and handles cases when
schedtune and/or cpuset cgroup controllers are not enabled. Include it
into presubmit test list.

Test: ran tests
Change-Id: I294220e18aae5e5760e7e6bdee7a2fe4d9c6d6a4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-11-07 01:04:25 +00:00
Treehugger Robot af7999097e Merge "BatteryMonitor: init health info properly." 2019-11-07 00:52:55 +00:00
Treehugger Robot e4cb2c49e3 Merge "Move comments into selinux.h and fix" 2019-11-07 00:52:42 +00:00
Treehugger Robot a8854d3460 Merge "Trace.h: explicitly use global namespace" 2019-11-07 00:18:29 +00:00
Treehugger Robot 0a4fcfb9cf Merge "libcutils: update fs_config tests for current behavior" 2019-11-06 23:23:07 +00:00
Elliott Hughes 56b266686a Merge "libbase: add a README.md covering the most frequent question." 2019-11-06 22:01:41 +00:00
Nikita Ioffe 42697d3f18 Make remount into checkpointing for ext4 userdata a no-op
We are going to teamfood userspace reboot soon, and in order to gather
as much data as possible we are fine with ignoring checkpointing for the
devices with ext4 (teamfood will be a very limited set of people that
are aware what they've signed for).

As result of this, we don't need to reset vold and kill zram backing
device. Added a TODO to restore that functionality if needed.

Since I was there, fixed yet another typo in userspace-reboot-resume -_-

Bug: 135984674
Test: adb reboot userspace
Change-Id: I2b7a93aaf738fe9bec9d606d7e11aefb325550b1
2019-11-06 20:12:08 +00:00
Tom Cherry f8baa897ec libcutils: update fs_config tests for current behavior
Update fs_config tests for the new behavior in
a8eb00720c.

Before the above CL, fs_config_cmp() would match any partition prefix
to any path, even if there is not a logical relationship between them.
For example, these two lines in the test the demonstrate the changed
behavior:

{ true,  "vendor/lib",             "system/vendor/lib/hw",    true },
{ true,  "system/vendor/lib",      "vendor/lib/hw",           true },

The first line should match and does; it is testing that files located
at system/vendor/lib/hw are matched by an fs_path_config entry
specified as vendor/lib.  This is to allow for applying the policy we
have for the vendor partition to files in /system/vendor in the case
that there is no vendor partition.

The second line should not match.  This is testing that a file
that's located at vendor/lib/hw is matched by an fs_path_config entry
specified as system/vendor/lib.  This is backwards; we do not want to
have policy specified for system/vendor to impact policy for the
vendor partition.

Also, we never have any relationships from /system/oem to /oem or
/system/odm to /odm, so these are logically unrelated and should fail
to match.  We do however have a relationship from /vendor/odm to /odm,
so this test is added.

Test: libcutils unit tests pass on CF
Change-Id: I026f0233e00bbd0aad9bc0fb701aef000d2a037c
2019-11-06 09:40:33 -08:00
Elliott Hughes 10dc4ca3cd libbase: add a README.md covering the most frequent question.
Test: N/A
Change-Id: Iebea3e74bb7d59778fa0d2342e51bb4ffc5450a3
2019-11-06 09:38:21 -08:00
Jooyung Han c2b56dc10e migrate *.libraries.txt from Make to Soong
Migrating these files to soong modules and those modules are defined
under /packages/modules/vndk since they are highly coupled with vndk.

Bug: 141450808
Test: m llndk.libraries.txt
Change-Id: Id33366f604e3e6696a9be95dc50f40d143325697
2019-11-06 16:55:32 +09:00
Steven Moreland 5f46923634 Trace.h: explicitly use global namespace
Imagine an AIDL file:
  package android.foo;
  interface IFoo {}

The AIDL C++ backend will generate classes like "::android::foo::IFoo".
In order to avoid ODR conflict, the NDK (Stable C) backend linking
against libbinder_ndk puts everything under the "::aidl" namespace. So,
we have "::aidl::android::foo::IFoo". When using ScopedTrace in a class
implementing a class from this backend, there is this problem.

Bug: 141828236
Test: works
Change-Id: Iafadea11788d4c011229657b4f53063bcf65f8d8
2019-11-05 17:59:46 -08:00
John Stultz 47a6bf014d healthd: Fix incorrect return check
In commit 1d4368b494 ("[REFACTOR] healthd: BatteryMonitor
use health 2.1 types"), the mapSysfsString() function was
changed to return NULL instead of -1 on error.

Everywher else that function is used commit 1d4368b494
tweaked the return value check from (ret < 0) to (!ret),
but one spot was missed.

This patch corrects the one missed check so that we compare
against null rather then negative value, since the return
value can no longer be negative.

This issue was found by inspection, and I've not seen an actual
problem with it, but thought it should be corrected.

Change-Id: I0a6564274d01276352a5dc0660b8ffbe748b5fde
Signed-off-by: John Stultz <john.stultz@linaro.org>
2019-11-06 01:40:18 +00:00
Yifan Hong 6cabe9bbc7 BatteryMonitor: init health info properly.
HIDL enum values are zero initialized, not the first value
of the enum. They need to be initialized properly.

Test: pass
Change-Id: I2adb8b851e6ac607ac4f547a6a6600604d07816f
2019-11-06 01:37:01 +00:00
Paul Crowley 68258e8444 Make encryption action an argument to mkdir
FscryptSetDirectoryPolicy no longer tries to infer the action from the
filename. Well mostly; it still assumes top-level directories in /data
should be encrypted unless the mkdir arguments say otherwise, but
it warns.

Bug: 26641735
Test: boot, check log messages
Change-Id: Id6d2cea7fb856f17323897d85cf6190c981b443c
2019-11-05 16:26:43 -08:00
Daniel Colascione 2aabeed1fd Merge "Properly finish daemon init when initial USB scan complete" 2019-11-05 23:44:25 +00:00
Josh Gao e24a4b37b4 Merge changes from topic "adbd_apex"
* changes:
  Move adbd to an apex.
  adbd: use libadbd_auth for authentication.
2019-11-05 23:36:39 +00:00