075ad800c5
Implement a new method of sideloading over ADB that does not require the entire package to be held in RAM (useful for low-RAM devices and devices using block OTA where we'd rather have more RAM available for binary patching). We communicate with the host using a new adb service called "sideload-host", which makes the host act as a server, sending us different parts of the package file on request. We create a FUSE filesystem that creates a virtual file "/sideload/package.zip" that is backed by the ADB connection -- users see a normal file, but when they read from the file we're actually fetching the data from the adb host. This file is then passed to the verification and installation systems like any other. To prevent a malicious adb host implementation from serving different data to the verification and installation phases of sideloading, the FUSE filesystem verifies that the contents of the file don't change between reads -- every time we fetch a block from the host we compare its hash to the previous hash for that block (if it was read before) and cause the read to fail if it changes. One necessary change is that the minadbd started by recovery in sideload mode no longer drops its root privileges (they're needed to mount the FUSE filesystem). We rely on SELinux enforcement to restrict the set of things that can be accessed. Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114 |
||
---|---|---|
.. | ||
adb.c | ||
adb.h | ||
Android.mk | ||
fdevent.c | ||
fdevent.h | ||
fuse_sideload.c | ||
fuse_sideload.h | ||
mutex_list.h | ||
README.txt | ||
services.c | ||
sockets.c | ||
sysdeps.h | ||
transport.c | ||
transport.h | ||
transport_usb.c | ||
usb_linux_client.c | ||
utils.c | ||
utils.h |
The contents of this directory are copied from system/core/adb, with the following changes: adb.c - much support for host mode and non-linux OS's stripped out; this version only runs as adbd on the device. - always setuid/setgid's itself to the shell user - only uses USB transport - references to JDWP removed - main() removed - all ADB_HOST and win32 code removed - removed listeners, logging code, background server (for host) adb.h - minor changes to match adb.c changes sockets.c - references to JDWP removed - ADB_HOST code removed services.c - all services except echo_service (which is commented out) removed - all host mode support removed - sideload_service() added; this is the only service supported. It receives a single blob of data, writes it to a fixed filename, and makes the process exit. Android.mk - only builds in adbd mode; builds as static library instead of a standalone executable. sysdeps.h - changes adb_creat() to use O_NOFOLLOW transport.c - removed ADB_HOST code transport_usb.c - removed ADB_HOST code