Commit Graph

4649 Commits

Author SHA1 Message Date
Treehugger Robot
554cfd1f1d Merge "Add Zygote.startChildZygote() to fork a new process that itself is a zygote." 2018-02-17 01:39:54 +00:00
Robert Sesek
d0a190df8a Add Zygote.startChildZygote() to fork a new process that itself is a zygote.
This adds a new --start-child-zygote argument that instructs the main
zygote to create a new child process that will also be a zygote. The
system_server generates a random name in the abstract socket namespace
for it and the child-zygote to communicate over, and that is passed as
an argument to the new process.

A child-zygote bypasses the normal post-fork-child of the zygote process
in order to preserve itself as a zygote. This means not starting the
Binder threadpool nor launching into ActivityThread. Instead, a
child-zygote calls into its own main function. The main function runs a
ZygoteServer select loop, listening on the socket name specified by the
system_server when it was forked.

Unlike the system zygotes, a child-zygote can be killed without bringing
down the system. Killing a child-zygote will not terminate its child
processes, which will be reparented to init for reaping when they
eventually exit.

Bug: 63749735
Test: m (with multi-project commits landed)
Change-Id: I3e7ebbdba498f8fec1d84cdf927dc43a92be4b68
2018-02-16 14:17:41 -05:00
Calin Juravle
ea6c0ffb4a [framework] Extend profile operations to take the profile name
Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name based on their
split name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

Also, move dumpProfiles and clearProfiles functionality to the
ArtManagerService so that we can re-use profileName computations easier.

(cherry picked from commit 6ae39fc2e5)

Test: manual (dexopt apps, merge profiles, clear profiles)
      gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496

Merged-In: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
Change-Id: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
2018-02-14 08:19:42 -08:00
Calin Juravle
369fbd2983 Implement ArtManager#snapshotProfile API
Complete the implementation of ArtManager#snapshotProfile. The snapshot is
performed by calling the installer and then return to the caller via the
specified callback.

(cherry picked from commit fd9f8ae973)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases
Merged-In: I87131487846d91d79a56041445420376b61ca8e7
Change-Id: I87131487846d91d79a56041445420376b61ca8e7
2018-02-14 08:00:56 -08:00
Robert Sesek
5ac8abf9ca Refactor ZygoteProcess to deal in LocalSocketAddress.
Currently ZygoteProcess only uses String names in the RESERVED socket
namespace. This CL reworks the class to use LocalSocketAddress, so that
other socket namespaces can be used to communicate with zygotes.

Bug: 63749735
Test: m (no functional change)
Merged-In: I4146f684bfcd78b16500829d02ff54590a8b48f5
Change-Id: I0113a7189530c2e57c48058df542057e855bae42
2018-02-13 14:23:30 -05:00
Treehugger Robot
5a748e5ee2 Merge "VintfObject: add getTargetFcmVersion" 2018-02-08 20:12:02 +00:00
Yifan Hong
0e5e472b4b VintfObject: add getTargetFcmVersion
Add getTargetFrameworkCompatibilityMatrixVersion that returns
target FCM version in device manifest.

Test: VintfDeviceInfo
Bug: 70993015
Change-Id: Ia6354f85e7fae898444067977fb594febb0112fa
2018-02-07 14:30:43 -08:00
Ruchi Kandoi
dcf4c6dc26 Add UID and Service for Secure Element Application
Bug: 64994044
Test: Boot; Check Service loaded.
Merged-In: I2f48ff204acd29b1a9f6819910aba5f8f3762977
Change-Id: I2f48ff204acd29b1a9f6819910aba5f8f3762977
(cherry picked from commit dfaf4bdd1e7e12caf9bb69c8facc38e879861baf)
2018-01-26 11:11:52 -08:00
Treehugger Robot
572f65fb58 Merge "Use the correct value for Process.WEBVIEW_ZYGOTE_UID." 2018-01-23 18:14:00 +00:00
Robert Sesek
bceb382572 Use the correct value for Process.WEBVIEW_ZYGOTE_UID.
When the libcutils constant was added there a merge conflict, which
caused the AID_WEBVIEW_ZYGOTE value to land with a different value than
the Java-side Process value. Nothing yet uses the Process constant, so
there were no ill effects.

Test: m
Change-Id: I8cc87bce1ddbdcdaf79d85c828d86837e96cce21
2018-01-22 12:29:21 -05:00
Andreas Gampe
571b700fb6 Debug: Add attachJvmtiAgent with classloader
Add classloader support to android.os.Debug.attachJvmtiAgent. For
the original version without a given classloader, look up the
application's main classloader.

Bug: 65016018
Bug: 70901841
Test: m
Test: cts-tradefed run commandAndExit cts-dev
Change-Id: I649b6883e05dc2f75073fe1f978423f6a7b880df
2018-01-18 22:02:53 -08:00
Victor Hsieh
c8176efe2e Reland: Move zygote's seccomp setup to post-fork
Before this change, seccomp filter setup is as early as in zygote's main
function.  To make it possible to split app and system server's filter,
this postpone the setup to after fork.  It also starts to call app
specific and system server specific setup function.

The filter setup is done in Zygote's ForkAndSpecializeCommon.  This is
because adding a seccomp filter must be done when either the caller has
CAP_SYS_ADMIN or after the PR_SET_NO_NEW_PRIVS bit is set.  Given that
setting PR_SET_NO_NEW_PRIVS breaks SELinux domain transition
(b/71859146), this must be done after Zygote forks but before
CAP_SYS_ADMIN is droppped.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Test: no selinux denial flood in dmesg with selinux enforced
Test: debuggerd -b `pidof com.android.phone`  # logcat shows tombstoned
      received crash request
Bug: 63944145
Bug: 71859146

Change-Id: I8215c8530d3d0de504a270488f8e29635805e8b0
2018-01-17 09:30:44 -08:00
Treehugger Robot
eac8c121fe Merge "android.os.VintfObject: update for VNDK version format change." 2018-01-12 22:12:39 +00:00
Yifan Hong
8da8798ca3 android.os.VintfObject: update for VNDK version format change.
Test: CTS device info collect
Bug: 36400653

Change-Id: I7b22f82ddd9ddc3b0930b5c1564435c42be2a6fa
2018-01-11 15:05:19 -08:00
Erik Kline
1742fe1309 Extract DNS setting logic into DnsManager class
In future, managing DNS-over-TLS hostname lookup and netd programming
can be encapsulated here.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 64133961
Change-Id: I47ccfa99c30c780524c45c4af605e720ccba34a0
2018-01-11 18:16:50 +09:00
Treehugger Robot
54da93b981 Merge "Revert "Move zygote's seccomp setup to post-fork"" 2018-01-10 18:46:36 +00:00
Victor Hsieh
fe6a51fcb5 Revert "Move zygote's seccomp setup to post-fork"
This reverts commit 6a4a339832.

Reason for revert: caused some SELinux error

Bug: 71768585
Change-Id: I0ef270ec6fed1d5d96b4257ec1a2dd6a55a816ed
Merged-In: Ic1b81e146b52b68445ba634de39657f199107da3
2018-01-10 17:22:55 +00:00
Treehugger Robot
5d33c10a96 Merge "Move zygote's seccomp setup to post-fork" 2018-01-09 21:41:19 +00:00
Victor Hsieh
6a4a339832 Move zygote's seccomp setup to post-fork
Before this change, seccomp filter setup is as early as in zygote's main
function.  To make it possible to split app and system server's filter,
this postpone the setup to after fork.  It also starts to call app
specific and system server specific setup function.

In terms of performance since this happens at fork, the measure shows
the overhead is negligible.  Assuming 130 instruction in the BPF, on
walleye, even when running on little core with fixed low frequency, each
setup took about 60.9us on average.  When it runs on big core with
higher frequency, it took about 39.3us.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Bug: 63944145

Change-Id: I748735b478405098beac1e200d911c13ea60e380
Merged-In: I748735b478405098beac1e200d911c13ea60e380
2018-01-09 20:16:01 +00:00
Hans Boehm
d2fb7df2c1 Only count uncleared ProxyMap refs when deciding to crash
Add a method to compute the size of a ProxyMap without cleared
references. Use it in the crash decision. Report both counts, as
well as the count after a forced GC before actually crashing.

Rename the histogram generating function after a small refactoring
to make that easier.

When we crash, we now generate a message like the following
(generated here with reduced thresholds):

01-03 01:40:52.273  4793  4947 E JavaBinder: java.lang.AssertionError:
Binder ProxyMap has too many entries: 277 (total), 275 (uncleared),
257 (after GC). BinderProxy leak?

after the histogram. Unfortunately, the intervening GC may take some
time, and other intervening messages may sneak into the log between
them.

Experiments so far suggest that none of this greatly affects the
decision when to die. But this eliminates uncertainty as to whether
there was really a problem.

Bug: 71353150

Test: Tested with reduced thresholds, and then booted AOSP.
Change-Id: I53f24bae23eedcdb78a1c32296c65692b7bb2c42
2018-01-08 14:30:42 -08:00
Steven Moreland
4bfa2ebb89 Generic Mutable class for HIDL code.
In general, using Mutable inside of structures
or as API arguments is a code smell. However, it
is the most syntactically clean way of fetching
something out of a lambda or inner class.

Using this, one can do:
Mutable<Result> res = new Mutable<>();
hidlObject.foo((...) -> {
    res.value = ...;
});

There is an alternative:
Result a[] = new Result[1];
hidlObject.foo((...) -> {
    a[0] = ...;
});

However, this alternative syntax is relatively messy.

Bug: N/A
Test: boot, use w/ wifi
Change-Id: Ibff13c653cc17bd25ddbb0534ba21ef485bff7aa
2018-01-05 19:13:06 +00:00
Treehugger Robot
1c876b73b3 Merge "Modify getting of primary storage size" 2018-01-03 01:10:49 +00:00
Andreas Gampe
3fc030f083 Binder: Log a histogram of binder proxies to logcat on death
To help investigate potential BinderProxy leaks, attempt to log a
histogram of BinderProxy descriptors to the logcat before asserting.

Bug: 71353150
Test: m
Change-Id: I47313814160678369b15e7dc5851d8096c286b9d
2017-12-27 09:30:45 -08:00
hj.seo
e82e89ef90 Modify getting of primary storage size
Settings application shows internal storage size using API getTotalBytes in StorageStatsManager.
This API calls getPrimaryStorageSize() in StorageManager.
getPrimaryStorageSize() returns /data parition size calculated API roundStorageSize() in FileUtils.
Using this API, total primary storage size returns 8GB if 16GB emmc size device has /data partition size below 8GB.
So we should modify getting of primary storage size close to real emmc size.
getPrimaryStorageSize() will be calculated sum of /data and /system partition size.

Test: Check primary storage size in Settings application

Change-Id: I3ad33534b1c55d09afbb0e9be1c408c02c442842
Signed-off-by: hj.seo <hj.seo@lge.com>
2017-12-26 09:24:53 +09:00
Treehugger Robot
86c9951383 Merge "Disable AVB check in runtime vintf" 2017-12-07 08:15:35 +00:00
Hans Boehm
4fc1bb0e37 Merge "Ensure that debug builds crash again if there is a BinderProxy leak."
am: db122f90d9

Change-Id: Ibc470d844139fd2f74434a26d01903c67eb51f86
2017-12-01 15:46:09 +00:00
Hans Boehm
db122f90d9 Merge "Ensure that debug builds crash again if there is a BinderProxy leak." 2017-12-01 15:34:29 +00:00
Bowgo Tsai
78934c9b8b Disable AVB check in runtime vintf
GSI disables AVB by overriding vbmeta partition.
When a device can run runtime vintf checking, it should already
pass AVB, so we don't need to check AVB in runtime vintf.

We cannot change the original VintfObject.verify() because AVB check is
still needed for android.os.RecoverySystem to verify a newly downloaded
OTA package.

Bug: 68016134
Test: Boot with GSI and there is no Android System dialog
Change-Id: Ie1efa6f1abd8fa8f495aededd145c0ab2c0c1fae
Merged-In: Ie1efa6f1abd8fa8f495aededd145c0ab2c0c1fae
2017-12-01 12:09:50 +08:00
Hans Boehm
c79595fefa Ensure that debug builds crash again if there is a BinderProxy leak.
This fails when trying to run the AOSP mailer with CRASH_AT_SIZE = 500,
when the check interval is reduced sufficiently so that the test is
actually executed. System server has been observed to use more than
1000 BinderProxies. Thus 5000 seems like roughly the lowest safe limit.

Note that the test is executed somewhat rarely, so we may exceed
this number by quite a few before we actually crash.

Bug: 65760710
Test: Builds, AOSP boots & works for a few tasks. Fails as expected
with reduced limit.

Change-Id: I1c999b85e1ba1bd1d166a9ffba4f0b3992ffee45
2017-11-30 15:29:11 -08:00
Yifan Hong
8cf7761747 Merge "android.os.HidlSupport: add getPidIfSharable() for HALs"
am: e72b6f0d31

Change-Id: I7ea5895cdfd09786732b597be600329a334c1cb4
2017-11-22 23:06:33 +00:00
Yifan Hong
e72b6f0d31 Merge "android.os.HidlSupport: add getPidIfSharable() for HALs" 2017-11-22 22:51:19 +00:00
Yifan Hong
bb0bd00b00 android.os.HidlSupport: add getPidIfSharable() for HALs
... that returns PID of the process for debuggable builds.
This calls into the C++ equivalent of the function.

Test: lshal
Bug: 68992575

Change-Id: Ia177c709c6930510035cff33dc2389441a76351d
2017-11-20 11:51:07 -08:00
Calin Juravle
af657ae978 Merge "Workaround to get passed the broken install flow"
am: b0e6508a5b

Change-Id: Icbad0d985b4d8d3e206ee5e426cdd1f58955aec1
2017-11-17 02:46:57 +00:00
Calin Juravle
b0e6508a5b Merge "Workaround to get passed the broken install flow" 2017-11-17 02:36:29 +00:00
Jakub Pawlowski
b6946d8563 Merge "Add getProfileParentId (1/2)"
am: 7a2c66359a

Change-Id: Iea965e42bb79f939381971e8dd9466b824606ee0
2017-11-17 01:40:05 +00:00
Jeff Sharkey
5f44aa798b Workaround to get passed the broken install flow
For fresh installs the PM does not set the app uid before invoking
dexopt; so we would always get a bogus GID.

This is a temporary workaround which fixes the GID of newly
installed apps to an arbitrary UNKNOWN gid.

Test: adb install
Bug: 64548938
Bug: 69331247

(cherry picked from commit a73e165c2e)

Change-Id: I6438ec8cfca88df813e166f9ef5821e62faf524a
2017-11-17 00:17:21 +00:00
Jakub Pawlowski
0f1f5b7953 Add getProfileParentId (1/2)
Bluetooth service needs to natively access id of parent profile. Add
method exposing it.

Test: cts-tradefed run cts-dev -m DevicePolicyManager --test
com.android.cts.devicepolicy.ManagedProfileTest#testBluetooth
Bug: 69284968
Change-Id: I697906f2959b0736c1d3cc6af7560c27d77ce11b
2017-11-15 15:37:53 -08:00
Koji Fukui
8d36beec24 Merge "Remove AutofillManagerClient after AutofillManager is finalized"
am: dd5384a4fe

Change-Id: If0b092c5e18005fb4b8c1fd8405f4d666c98de5a
2017-11-15 02:35:18 +00:00
Treehugger Robot
dd5384a4fe Merge "Remove AutofillManagerClient after AutofillManager is finalized" 2017-11-15 02:23:27 +00:00
Xin Li
220871a697 Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-11-14 12:31:11 -08:00
Jeff Sharkey
7e875df695 Merge "Better, consistent definition of AID_SHARED_GID." 2017-11-14 16:49:30 +00:00
Jeff Sharkey
77a34500fe Better, consistent definition of AID_SHARED_GID.
AID_SHARED_GID is a GID shared by a specific app across all users on
the same device.  Bring the UserHandle and multiuser.c implementations
into agreement, and copy/paste the unit tests that verify that both
behave identically.

Since we might now return "-1" when a GID is invalid, have
ActivityManager handle these cases by quickly swapping in the
always-valid getUserGid().

Test: bit FrameworksCoreTests:android.os.UserHandleTest
Bug: 34151068, 64548938
Change-Id: I0463aba923ae5ce1942666359a394ae6cdb7c1f8
2017-11-09 17:42:29 -07:00
Koji Fukui
ccec6a6ae8 Remove AutofillManagerClient after AutofillManager is finalized
Symptom:
Global reference table overflow happens on system_server.

Root cause:
If a process repeatedly create a context and get AutofillManager
from the context, each BinderProxy of AutofillManagerClient are
registered to AutofillManagerServiceImpl. They aren't removed until
the process is died. BinderProxy consumes global reference and finally
causes crash on system_server.

Solution:
Remove AutofillManagerClient from AutofillManagerServiceImpl after
AutofillManager is finalized.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

Bug: 68747744
Change-Id: I8b76c5368b54317b8696cac470cc390b36e910e7
2017-11-09 15:44:12 -08:00
Jakub Pawlowski
db62b26ba0 Make ParcelUuid and ParcelFileDescriptor accesible to native Binder (2/2)
Bug: 68359837
Test: compile
Change-Id: I3cec0b5b20dde33be09a5bbc451cd79273c67961
2017-11-09 19:40:03 +00:00
Treehugger Robot
faffb072a4 Merge "Allow to attach jvmti agents from inside of process" 2017-11-06 20:34:34 +00:00
Philip P. Moltmann
fd8ed85adb Allow to attach jvmti agents from inside of process
Test: cts-tradefed run singleCommand cts-dev -m CtsJvmtiAttachingTestCases
Bug: 65016018
Change-Id: I6d445afa288c6fec1d860150159fa05ed63cf517
2017-11-03 10:33:21 -07:00
Charles He
dfe472ecae Merge "TokenWatcher: fix bug in repeated calls to acquire()." 2017-11-02 10:36:01 +00:00
Treehugger Robot
762f27c6a2 Merge "Allow equality checking and hash for HIDL interface proxies." 2017-11-02 03:39:42 +00:00
Yifan Hong
73b6c27a6b Allow equality checking and hash for HIDL interface proxies.
IFoo.Proxy.equals() -> HidlSupport.equals() ->
IHwInterface.asBinder().equals() -> HwRemoteBinder.equals().
IFoo.Stub.equals() -> default Object.equals()

Notice that IHwInterface.asBinder() returns mRemote(of type
HwRemoteBinder) for proxies and itself (of type HwBinder) for stubs.
If IFoo.Stub.asBinder() had not return "this", its equals()
should also be overridden.

Bug: 68727931
Test: hidl_test_java

Change-Id: I916983d7bc739747145e2ebb6830226310fd4980
2017-11-01 18:30:04 -07:00
Narayan Kamath
19541e84b1 Debug: Remove obsolete InstructionCount code.
Support for instruction counting has been removed from ART
and the VMDebug APIs in question throw UnsupportedOperationException
unconditionally.

Test: make

Change-Id: Ibcaa160f755a5708bc6fbef3a783acfc26f0ba90
2017-11-01 13:24:47 +00:00