Move adbd to an apex.

Test: adb shell "su 0 readlink /proc/\`pidof adbd\`/exe"
Change-Id: I84dfe4d1b28b619f98c03a2c8eeef2c783d30af2
This commit is contained in:
Josh Gao 2019-08-15 14:05:12 -07:00
parent 275232667d
commit 594f70ffb8
11 changed files with 203 additions and 55 deletions

View file

@ -89,3 +89,4 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/product_services)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/product_services)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/debug_ramdisk/product_services)
$(call add-clean-step, find $(PRODUCT_OUT) -type l -name "charger" -print0 | xargs -0 rm -f)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/bin/adbd)

View file

@ -356,11 +356,11 @@ cc_library_static {
generated_headers: ["platform_tools_version"],
static_libs: [
"libadbconnection_server",
"libdiagnose_usb",
],
shared_libs: [
"libadbconnection_server",
"libadbd_auth",
"libasyncio",
"libbase",
@ -409,12 +409,12 @@ cc_library {
],
static_libs: [
"libadbconnection_server",
"libadbd_core",
"libdiagnose_usb",
],
shared_libs: [
"libadbconnection_server",
"libadbd_auth",
"libasyncio",
"libbase",
@ -462,6 +462,7 @@ cc_library {
],
shared_libs: [
"libadbconnection_server",
"libadbd_auth",
"libadbd_services",
"libasyncio",
@ -495,18 +496,27 @@ cc_binary {
keep_symbols: true,
},
shared_libs: [
stl: "libc++_static",
static_libs: [
"libadbd",
"libadbd_auth",
"libadbd_services",
"libasyncio",
"libbase",
"libcap",
"libcrypto",
"libcrypto_utils",
"libcutils",
"libdiagnose_usb",
"liblog",
"libmdnssd",
"libminijail",
"libselinux",
],
shared_libs: [
"libadbconnection_server",
"libcrypto",
],
}
phony {
@ -526,53 +536,6 @@ phony {
],
}
cc_binary {
name: "static_adbd",
defaults: ["adbd_defaults", "host_adbd_supported"],
recovery_available: false,
static_executable: true,
host_supported: false,
srcs: [
"daemon/main.cpp",
],
cflags: [
"-D_GNU_SOURCE",
"-Wno-deprecated-declarations",
],
strip: {
keep_symbols: true,
},
static_libs: [
"libadbconnection_server",
"libadbd",
"libadbd_services",
"libasyncio",
"libavb_user",
"libbase",
"libbootloader_message",
"libcap",
"libcrypto_static",
"libcrypto_utils",
"libcutils",
"libdiagnose_usb",
"libext4_utils",
"libfec",
"libfec_rs",
"libfs_mgr",
"liblog",
"liblp",
"libmdnssd",
"libminijail",
"libselinux",
"libsquashfs_utils",
],
}
cc_binary {
name: "abb",
@ -765,3 +728,39 @@ cc_test_host {
"fastdeploy/testdata/sample.cd",
],
}
prebuilt_etc {
name: "com.android.adbd.ld.config.txt",
src: "apex/ld.config.txt",
filename: "ld.config.txt",
installable: false,
}
apex {
name: "com.android.adbd",
manifest: "apex/apex_manifest.json",
binaries: ["adbd"],
prebuilts: ["com.android.adbd.init.rc", "com.android.adbd.ld.config.txt"],
key: "com.android.adbd.key",
certificate: ":com.android.adbd.certificate",
}
apex_key {
name: "com.android.adbd.key",
public_key: "apex/com.android.adbd.avbpubkey",
private_key: "apex/com.android.adbd.pem",
}
android_app_certificate {
name: "com.android.adbd.certificate",
certificate: "apex/com.android.adbd",
}
prebuilt_etc {
name: "com.android.adbd.init.rc",
src: "apex/adbd.rc",
filename: "init.rc",
installable: false,
}

6
adb/apex/adbd.rc Normal file
View file

@ -0,0 +1,6 @@
service adbd /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd seqpacket 660 system system
disabled
override
seclabel u:r:adbd:s0

View file

@ -0,0 +1,4 @@
{
"name": "com.android.adbd",
"version": 1
}

Binary file not shown.

View file

@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEAwUmO4l/ZdLhmBcBtpwDjih6z6bC7iZDPAVgnFVnYuYDRlVDA
9OCDwv02Wwc/YCNzON7vt7JBk3o9wyJZpqY9HR1PUjk2DJa/wHtxbskmLcqsvcoh
wZxmMkgx1mFyni/vQ0tCjjxYmDcnpoVmSntoPG4LBTZRwbgE2roY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8LNYVgpInnylX4ALzae+QPvgOX84laFwP
kcXFRBcNDExt2uLDHuAnXYbhJYVqYN8rnDPhlbC4OdlYxfTZ/UtMrD769wwP2SER
ED9jagirmHQx7Ko3b4GTJ/FINtUiyqqx7wXloLtwjMtq6IZPJfcTWXloI6qCBGAG
ncYinuECggEAfZeiF8BEm3RpTz3QL3HxdHFkTqOhctnhSNuq+n2C8nBCLwhN21ic
DkkB84txTFnmboBdWYsEYzQKDL5yflIUGeup00L3VKH3Jm2OuM0f7qLm8TCE04kW
rKhKAO2JYmNVB7QZjsgzp6QXre1ZdLfNy7mD8Dg584vPtGecvCUMULR1YsBvTV3T
n2vPyaan+dLmoTzN6/XzrwxLVLWFt0HYYoctEkk/RSn17PwXDm5jfbya7YoSg1Vb
tFV+Oflul8FHMV35I0hcHYhbR/8LZz0nRBH8EsyIGUdZVB76BKDdfqEJgm2ntHEP
dvytPAo4s2m9tFkvkZOYgOCTq5GdVDK2OQKCAQAsz+y9rDcqFciCESu4IHzmtckT
0kwP2W5ds5hzUjbY0Y2AKTx2oHNOFak6WW5vxN0+OIn37SNK3RBStPWJiigut4R4
rGrZM4pijm53s3cWzd0h8XyLGisl2zORu8gD2IQLkQf79F3lEZHGA+J0mkSHB85N
IuqReFzL6cfOToNd+8WYjMgJcXmVuKiCV1FRK3jrqNpXO2cLtnhFvQMxRUAYU4j+
2MIdBFVeMq5ftMMOBS21hM9cNLlOzoSN2HmK+ZkmrlTCK0G9lmF427/lqXTmWLed
sspOUbOLfBOwxdCCc9JUxz5KggKWcDcTqX25M0mv09rpuCxIEg8lez1Ax0if
-----END RSA PRIVATE KEY-----

Binary file not shown.

View file

@ -0,0 +1,35 @@
-----BEGIN CERTIFICATE-----
MIIGHzCCBAegAwIBAgIUW8npFHXBP+wsEAesGMBxaV7TScAwDQYJKoZIhvcNAQEL
BQAwgZ0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQH
DA1Nb3VudGFpbiB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BpHRyi2lhe0laupOpmN44
LzfjFM18bi2GashIi2OQuYDyAeT5mGtR2g8mC7g44H6dH+wTfQIDAQABo1MwUTAd
BgNVHQ4EFgQU7lyyxPO5SOOh9a5O0l4+RjckcgcwHwYDVR0jBBgwFoAU7lyyxPO5
SOOh9a5O0l4+RjckcgcwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
AgEAStsOy8bkbZg/Ygx47bPkLSz0cJIvATxTChUGOabkz+brLis88ABVWVP0IXps
tlLlZR5cjXBJguE7GJXzKPWzQZuB8+YwcGHG6QDFpfdMeGrxPDhwNfGy236ArVnx
K0v1IIxoZRZ0P7aubk3xwUAPgsmT5ayZCKu+dqlEy5B6ioKEsr7Y2RRT/8ifERNm
cjS9AhcyWrp4R3cjy2iA/RpdsPFwE5ac3I+GtUB4D2up5aDMsy85i9t2/1kuTUaA
9UHwGXCpcqP8f8BqeLzuxDzYkAvkntlNxbXn1cbn+dTRIOCBoDbtSeqtxhWooOUH
RQROeRsB7iicdYJJRge0+WyR+216AKUSQPE6/rT0Ifr06ZRwi22/YyySpwuO3SNA
+yWffh+f4h31Dz+p6pu8wjbMDkq4LnCWyjLwfF/yhvWhwwm5+KPAEhvJABeHQc+3
cslOC9dlXJm9sPoUC7ghmUiFsCmN2hIzQrr2QoK0Obh0AGexOvOAw9cqtOdZQncB
bqC8c4sVYScVxwDWkg0lNfRMC5boPjBsl7+M2CC1ukgVpXTyDOEjMWILrBXfYCDX
unBH3kbKQOfL5RT0nE1Lkt1rn5qAWMJg4mvS4QuIurbRtEoj3QYQadF9md4qJXs0
TvqvY8iEC4xrWU2SQn1K3PutXgaLP9/b6Cy1SBrhBX+AC5s=
-----END CERTIFICATE-----

51
adb/apex/ld.config.txt Normal file
View file

@ -0,0 +1,51 @@
# Copyright (C) 2019 The Android Open Source Project
#
# Bionic loader config file for the adbd APEX.
dir.adbd = /apex/com.android.adbd/bin/
[adbd]
additional.namespaces = platform,art,adbd
namespace.default.isolated = true
namespace.default.links = art,adbd,platform
namespace.default.link.art.shared_libs = libadbconnection_server.so
namespace.default.link.platform.allow_all_shared_libs = true
namespace.default.link.adbd.allow_all_shared_libs = true
###############################################################################
# "adbd" APEX namespace
###############################################################################
namespace.adbd.isolated = true
namespace.adbd.search.paths = /apex/com.android.adbd/${LIB}
namespace.adbd.asan.search.paths = /apex/com.android.adbd/${LIB}
namespace.adbd.links = platform
namespace.adbd.link.platform.allow_all_shared_libs = true
###############################################################################
# "art" APEX namespace: used for libadbdconnection_server
###############################################################################
namespace.art.isolated = true
namespace.art.search.paths = /apex/com.android.art/${LIB}
namespace.art.asan.search.paths = /apex/com.android.art/${LIB}
namespace.art.links = platform
namespace.art.link.platform.allow_all_shared_libs = true
###############################################################################
# "platform" namespace: used for NDK libraries, and libadbd_auth
###############################################################################
namespace.platform.isolated = true
namespace.platform.search.paths = /system/${LIB}
namespace.platform.asan.search.paths = /data/asan/system/${LIB}
# /system/lib/libc.so, etc are symlinks to
# /apex/com.android.runtime/lib/bionic/libc.so, etc. Add the path to the
# permitted paths because linker uses realpath(3) to check the accessibility
# of the lib. We could add this to search.paths instead but that makes the
# resolution of bionic libs be dependent on the order of /system/lib and
# /apex/.../lib/bionic in search.paths. If the latter is after the former,
# then the latter is never tried because libc.so is always found in
# /system/lib but fails to pass the accessibility test because of its realpath.
# It's better to not depend on the ordering if possible.
namespace.platform.permitted.paths = /apex/com.android.runtime/${LIB}/bionic
namespace.platform.asan.permitted.paths = /apex/com.android.runtime/${LIB}/bionic

View file

@ -51,7 +51,7 @@ LIBLOG_M {
LIBLOG_O {
global:
__android_log_is_loggable_len;
__android_log_is_debuggable; # vndk
__android_log_is_debuggable; # apex vndk
};
LIBLOG_Q {
@ -61,15 +61,15 @@ LIBLOG_Q {
__android_log_bwrite; # apex
__android_log_close; # apex
__android_log_security; # apex
android_log_reset; #vndk
android_log_parser_reset; #vndk
__android_log_security_bswrite; # apex
android_log_reset; # vndk
android_log_parser_reset; # vndk
};
LIBLOG_PRIVATE {
global:
__android_log_pmsg_file_read;
__android_log_pmsg_file_write;
__android_log_security_bswrite;
__android_logger_get_buffer_size;
__android_logger_property_get_bool;
android_openEventTagMap;

View file

@ -16,6 +16,7 @@ service adbd /system/bin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd seqpacket 660 system system
disabled
updatable
seclabel u:r:adbd:s0
on boot