Commit Graph

37 Commits

Author SHA1 Message Date
Nicolas Geoffray
a83cad6ac5 Print the fd that isn't whitelisted.
Helps diagnosing issues.

Test: boots
Change-Id: I6fb4d40b28233a07e679dda91978a4bdec6c2a24
2019-06-11 17:47:16 +01:00
TreeHugger Robot
b0815b80e8 Merge "Add support for /oem/overlay" into qt-dev 2019-04-24 08:33:38 +00:00
Chris Wailes
87c89eb057 Removed log spam from the Zygote.
This patch removes several debugging log messages.  These messages were
useful when the `FDs to ignore` list was usually empty, but with the
addition of USAPs this has become spammy.

(cherry picked from commit da0a9cd05c)

Test: Build
Bug: 130172109
Change-Id: Id166990a63f20efb3bf6ffd5b697efd436d50921
Merged-In: Id166990a63f20efb3bf6ffd5b697efd436d50921
2019-04-09 17:25:43 +00:00
Mårten Kongstad
eb8a5c0b91 Add support for /oem/overlay
Add support for runtime resource overlay (RRO) APKs in /oem/overlay.

Bug: 121033532
Test: manual (adb push apk to /oem/overlay, reboot, cmd overlay list)
Change-Id: I70b23b11831d57b3241e6057c745aa4ce9f795ef
2019-04-09 06:37:33 -07:00
Mårten Kongstad
48c24cf149 Add support for /odm/overlay
Add support for runtime resource overlay (RRO) APKs in /odm/overlay.

Bug: 121033532
Test: manual (adb push apk to /odm/overlay, reboot, cmd overlay list)
Change-Id: I0918d276dfa6a43054068d3f84ecd0d1639f1d0b
2019-04-02 11:07:10 -07:00
Chris Wailes
7e797b6f26 Renamed blastula to unspecialized app process (usap)
Bug: 123017829
Test: make & boot & launch apps
Change-Id: Icfb9f8f4ebabacece817735d60d232cf3afb4e08
2019-03-01 13:18:48 -08:00
Nick Kralevich
831cf61d80 Merge "more O_CLOEXEC" am: 350f48328b am: 51aec2267c
am: 8d26cdbd34

Change-Id: I2624180a9284beced0677de070b600c21fa24ae6
2019-01-25 18:10:33 -08:00
Nick Kralevich
0361ce1fdd more O_CLOEXEC
Bug: 120983106
Test: device boots and no obvious problems.
Change-Id: Ia7a426304a8e7fc41d7d8388dbb858b790d98cf1
2019-01-25 10:08:58 -08:00
Nicolas Geoffray
574c6134dd Merge "Add jar files from the runtime APEX in the whitelist." am: 4d3a2f95c6 am: b5a3c59d3a
am: 319db3e9f7

Change-Id: I08b7c53b7676966fa2f4cb6cea03b8f6dc7d9c4a
2019-01-24 07:18:08 -08:00
Nicolas Geoffray
fca69e95a9 Add jar files from the runtime APEX in the whitelist.
Those files moved from /system to the APEX.

Test: m && boots
Change-Id: I68c4c8243dae3eab321da4b0923c1a422d300c10
2019-01-24 09:41:32 +00:00
Chris Wailes
8b35ba25a9 Implemented native functions and types for blastula management.
This patch adds native support for spawning and managing blastula pools,
as well as several code cleanups and modernizations.

Changes includes:
* A function to fork blastulas
* A table for managing blastula-related data
* Functions for adding and removing blastula data from the
aforementioned table
* Switching from NULL to nullptr
* Replacing string-passing error handling with a curried failure
function
* Utility functions for handling managed objects
* JNI functions for blastula pool management

Topic: zygot-prefork
Test: make & flash & launch apps & check log for messages
Bug: 68253328
Change-Id: I12cd9f2c87a2e3c00d64b683edf3631e29a51551
Merged-In: I12cd9f2c87a2e3c00d64b683edf3631e29a51551
2019-01-23 13:34:40 -08:00
Chris Wailes
c0db63f6ac Add the blastula pool sockets to the Zygote whitelist.
This adds the blastula pool sockets from aosp/843736 to the Zygote FD
white list in fd_utils.cpp.

Bug: 68253328
Test: m & flash image & boot
Change-Id: I1ff4bea0a2ea163bf9c1ccc0d80ffd5d04c49191
Merged-In: I1ff4bea0a2ea163bf9c1ccc0d80ffd5d04c49191
2019-01-23 13:34:30 -08:00
Chris Wailes
aa1c962ded Implemented native functions and types for blastula management.
This patch adds native support for spawning and managing blastula pools,
as well as several code cleanups and modernizations.

Changes includes:
* A function to fork blastulas
* A table for managing blastula-related data
* Functions for adding and removing blastula data from the
aforementioned table
* Switching from NULL to nullptr
* Replacing string-passing error handling with a curried failure
function
* Utility functions for handling managed objects
* JNI functions for blastula pool management

Change-Id: I12cd9f2c87a2e3c00d64b683edf3631e29a51551
Topic: zygot-prefork
Test: make & flash & launch apps & check log for messages
Bug: 68253328
2019-01-22 16:07:27 -08:00
Christian Wailes
afad518955 Merge "Add the blastula pool sockets to the Zygote whitelist." 2019-01-22 22:58:18 +00:00
Chris Wailes
032293a197 Add the blastula pool sockets to the Zygote whitelist.
This adds the blastula pool sockets from aosp/843736 to the Zygote FD
white list in fd_utils.cpp.

Bug: 68253328
Test: m & flash image & boot
Change-Id: I1ff4bea0a2ea163bf9c1ccc0d80ffd5d04c49191
2019-01-18 18:14:05 -08:00
Dongwon Kang
0d035539c2 Include updatable-media.jar in bootclasspath & apex
Test: build & boot & MediaPlayer2Test
Bug: 112766913
Change-Id: I66e0b5f9e12f14b1758c0281caac0dfdfe0b5729
2019-01-17 13:35:03 -08:00
Adam Vartanian
ca8cfacc4c Merge "Add APEX conscrypt.jar to Zygote whitelist" am: c586cdd9a9 am: ee87b785a9
am: 244cc0c9c7

Change-Id: I5f5d81ee77a19be699dcb46f3aaa4a4a060095ab
2019-01-15 08:32:34 -08:00
Adam Vartanian
2509575739 Add APEX conscrypt.jar to Zygote whitelist
We are going to use the APEX copy of Conscrypt rather than the
/system/framework copy, so allow the zygote to keep it open.

Test: system boots
Bug: 110404540
Change-Id: I052b31223fa9220d0c67f579d230f06adf8800ba
2019-01-08 11:00:40 +00:00
Chih-Hung Hsieh
90bfeeef5e Merge "Fix/suppress core/jni google-explicit-constructor warnings" am: ddeab2c144 am: e053f576b1
am: a13a9ee327

Change-Id: I48005e97647a95843bd0fd14701493717fa798bb
2018-12-20 17:58:18 -08:00
Chih-Hung Hsieh
0727be1706 Fix/suppress core/jni google-explicit-constructor warnings
* Add explicit to conversion constructors/operators

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I15ac3511154b652402c5a21a22ff0c306d806d84
2018-12-20 13:43:46 -08:00
Nick Kralevich
ba43dba34c Merge "fd_utils: carry over O_CLOEXEC on duplicated FDs" am: a4d036e98b am: ac9d96a03c
am: bb67b501f9

Change-Id: I72708593cf1038a5723ab5492d7087a6936c02e6
2018-12-17 00:39:17 -08:00
Nick Kralevich
d9765a4cc0 fd_utils: carry over O_CLOEXEC on duplicated FDs
Due to b/30963384, every time zygote creates a new child, zygote reopens
all existing file descriptors, taking careful measures to preserve the
file status flags, file descriptor flags, and seek offset. However, dup2
resets the sole file descriptor flag (FD_CLOEXEC) on duplication,
defeating the hard work done to preserve the flag.

From "man dup"

  NAME
    dup, dup2, dup3 - duplicate a file descriptor

  DESCRIPTION
    The dup() system call creates a copy ...
    ...
    The two file descriptors do not share file descriptor flags
    (the  close-on-exec flag).  The close-on-exec flag
    (FD_CLOEXEC; see fcntl(2)) for the duplicate descriptor is off.
    ...
    The  dup2() system call performs the same task as dup() ...

Use dup3 instead to allow us to preserve the FD_CLOEXEC status.

Bug: 120983106
Test: Android compiles and boots
Change-Id: Idbb27c83092f30d8394c254cfbdf33406f74eb94
2018-12-14 21:34:44 -08:00
Mårten Kongstad
06a1ac8229 Prepare for switch to idmap2
Prepare the idmap and asset managers for interfacing with idmap2 instead
of today's installd + idmap pipeline, but don't make the switch just
yet.

Instead, idmap2 runs as its own native daemon with an AIDL interface.
This removes the need for installd to fork and exec on each idmap call,
saving about 50 ms per call.

Bug: 78815803
Test: atest OverlayDeviceTests OverlayHostTests
Change-Id: I60852e15d99329896ff9de6559d1e7cd1c67e33d
2018-11-12 13:24:33 -08:00
Florian Mayer
cb397475de Merge "Allow zygote to keep socket to heapprofd." am: 4db6cb15de am: ce9b090733
am: f644eaaaa6

Change-Id: I07b1d821f34c427364260d843d6326305aec19c3
2018-10-31 15:27:35 -07:00
Florian Mayer
6ce2d9966d Allow zygote to keep socket to heapprofd.
This allows users to target zygote for heap profiling without
causing it to crash on ForkCommon.

This also allows us to profile zygote in benchmark runs where we want to
profile as many processes as possible.

Bug: 117821125

Test: m
Test: flashed walleye

Change-Id: I3f41b64e0a64e362eafd02cd4e86cb77e434d94c
2018-10-31 10:32:14 +00:00
Dario Freni
4ce4679309 androidfw changes to support /product-services.
See CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da for a more detailed
description of the change.

Test: see CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da description
Bug: 80741439
Change-Id: I6cc9d713c07c319fc2ee1c531af41243bd1d4aee
2018-08-17 16:34:18 +00:00
Andreas Gampe
811f10c645 Merge changes I14df050f,I55c30f78,I269eae0f am: ad7415f11e
am: 3dd16b1eaf

Change-Id: I82179683643a71298d71dd3cbf6916141ba2b2a7
2018-03-14 18:30:51 +00:00
Andreas Gampe
183a5d3cfa Frameworks: Refactor FileDescriptorTable errors
Surface error messages to the caller.

Bug: 74531335
Test: m
Test: Device boots
Change-Id: I14df050feb7f5417bb08d190492c3050cdbb1c1d
2018-03-13 08:18:55 -07:00
Robert Sesek
c0276a54ec Merge "Add Zygote.startChildZygote() to fork a new process that itself is a zygote." am: 554cfd1f1d am: 5b9410c74b
am: 4523bf284a

Change-Id: Ib714e447f06323d38c98de683f5547e66749856e
2018-02-17 04:08:15 +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
Jaekyun Seok
1713d9e97a Support /product partition
This CL will support the followings.
- installing a RRO package for framework from /product/overlay
- installing apps from /product/app
- installing priv-apps from /product/priv-app
- installing permissions from
  /product/etc/[default-permissions|permissions|sysconfig]

Bug: 64195575
Test: `mm` under frameworks/base/tests/[libs|privapp]-permissions
adb sync && adb reboot
adb shell cmd package list libraries
  => confirmed com.android.test.libs.product library
adb shell cmd package dump \
  com.android.framework.permission.privapp.tests.product
  => confirmed that the package is a priv-app

And I moved vendor/overlay/framework-res__auto_generated_rro.apk into
system/product/overlay/ on sailfish, and I confirmed that the RRO was
installed properly.

Change-Id: I16175933cebd9ec665d190cc5d564b5414a91827
2018-01-25 12:44:45 +09:00
Narayan Kamath
3879ecc891 fd_utils: address a couple of TODOs.
Drink the android::base koolaid.

Test: make, boots
Change-Id: Ib24b9b59fa3490e80ba78be0199eafa676225b73
2017-03-17 09:43:53 +00:00
Narayan Kamath
84b5511535 fd_utils: switch to libbase logging.
Test: make, boots
Change-Id: I4976508f489ca15af0484f75a9ef02ed575beff5
2017-03-02 17:11:00 +00:00
Narayan Kamath
a352d2473a fd_utils: add missing logging for a couple of failure cases.
Also start using libbase style logging. Other log statements will
be converted in a follow up.

Test: make
Bug: 33579623
Change-Id: I34bb2ccab57e5bdd22aa35be8f8dcb68fdc4e097
2017-03-02 17:11:00 +00:00
Andreas Gampe
8dfa178efb Zygote: Add fdsToIgnore
Add file descriptors that should be ignored in the file descriptor
table check.

Use this to ignore the pipe file descriptors when starting an app
with invoke-with (wrapper).

Bug: 32607405
Test: m
Test: Device boots
Test: Apps start
Test: adb root && adb shell setprop wrap.com.android.calculator2 logwrapper && adb shell am start -S -n com.android.calculator2/.Calculator
Change-Id: I4a30dfc9382d3172cc815bd41b17a123799354f6
2017-01-10 16:55:34 -08:00
Robert Sesek
54e387ddbe Dynamically add the webview_zygote's preloaded APK to the zygote FD whitelist.
This refactors the whitelist to be a class, rather than just a static C array.
The whitelist can then be augmented dynamically when the package path is known
in the webview_zygote.

Test: m
Test: sailfish boots
Test: Enable Multi-process WebView in developer options, perform a search in GSA.

Bug: 21643067
Change-Id: Ia1f2535c7275b42b309631b4fe7859c30cbf7309
(cherry picked from commit 061ee3088a)
2017-01-10 11:44:56 -08:00
Robert Sesek
8225b7c951 Split core/jni/fd_utils-inl.h into a .h/.cpp pair.
(cherry picked from commit 44afe8be8f)

Test: m
Test: sailfish boots

Change-Id: I9ca93f31f6c20b702b2207333a9d56f6592630b0
2017-01-10 11:41:01 -08:00