From be96809d181f587255176add2aa298adaaec69e4 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Fri, 13 Sep 2013 16:34:12 -0700 Subject: start healthd in recovery mode Change-Id: I431ece69b6856fd1ea6079c38cdeb593c15d7385 --- etc/init.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 175489066..9b2a99143 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -44,7 +44,7 @@ on property:sys.powerctl=* service ueventd /sbin/ueventd critical -service healthd /sbin/healthd -n +service healthd /sbin/healthd -r critical service recovery /sbin/recovery -- cgit v1.2.3 From 2c9d5b2839307987812db8a939d88272b865bacc Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Mon, 13 Jan 2014 09:44:42 -0500 Subject: Set SELinux security contexts correctly for init and services. Otherwise everything is left running in the kernel domain when booting recovery. Change-Id: Ie3d86547d5be0b68dd1875a97afe1e00fc3e4da1 Signed-off-by: Stephen Smalley --- etc/init.rc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 175489066..5f9ce80a2 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -1,6 +1,13 @@ import /init.recovery.${ro.hardware}.rc on early-init + # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. + write /sys/fs/selinux/checkreqprot 0 + + # Set the security context for the init process. + # This should occur before anything else (e.g. ueventd) is started. + setcon u:r:init:s0 + start ueventd start healthd @@ -43,15 +50,19 @@ on property:sys.powerctl=* service ueventd /sbin/ueventd critical + seclabel u:r:ueventd:s0 service healthd /sbin/healthd -n critical + seclabel u:r:healthd:s0 service recovery /sbin/recovery + seclabel u:r:recovery:s0 service adbd /sbin/adbd recovery disabled socket adbd stream 660 system system + seclabel u:r:adbd:s0 # Always start adbd on userdebug and eng builds on property:ro.debuggable=1 -- cgit v1.2.3 From 075ef327d494ea1ce07eb038fcc367fb78b14500 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 14 Jan 2014 09:50:35 -0800 Subject: correctly mount tmpfs as /tmp in recovery The syntax of init's mount command changed in April 2008 but recovery's init.rc was never updated, so recovery's /tmp has been on the root fs all this time. Fix. Also add /system/bin to the PATH in recovery, which is handy for debugging. Change-Id: I39f7ae435a8ce3bad691e4b7c307db0bd8de1302 --- etc/init.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 5f9ce80a2..8d49f24e6 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -12,7 +12,7 @@ on early-init start healthd on init - export PATH /sbin + export PATH /sbin:/system/bin export ANDROID_ROOT /system export ANDROID_DATA /data export EXTERNAL_STORAGE /sdcard @@ -23,7 +23,7 @@ on init mkdir /system mkdir /data mkdir /cache - mount /tmp /tmp tmpfs + mount tmpfs tmpfs /tmp chown root shell /tmp chmod 0775 /tmp -- cgit v1.2.3 From c52c5b8e3d690201b2ae009a2d396d1899033e3d Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Sat, 18 Jan 2014 09:22:50 -0800 Subject: adbd: switch to su domain when running as root When adbd runs as root, it should transition into the su domain. This is needed to run the adbd and shell domains in enforcing on userdebug / eng devices without breaking developer workflows. Use the new device_banner command line option. Change-Id: Ib33c0dd2dd6172035230514ac84fcaed2ecf44d6 --- etc/init.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 8d49f24e6..159747e2c 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -59,7 +59,7 @@ service healthd /sbin/healthd -n service recovery /sbin/recovery seclabel u:r:recovery:s0 -service adbd /sbin/adbd recovery +service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery disabled socket adbd stream 660 system system seclabel u:r:adbd:s0 -- cgit v1.2.3 From 1b9641127c539c73cf97d7a69fa917838043db92 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Wed, 19 Feb 2014 17:41:02 -0800 Subject: recovery: Fix adb with linux 3.10 In kernel 3.10, f_adb has been removed and adbd can use functionfs instead. Mount functionfs on boot for adbd. On older kernels, mount will fail silently and adbd will revert to f_adb. Change-Id: I5db57aaf35b35859ea88c7d0e0661d8c553e5811 --- etc/init.rc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 159747e2c..6e0595b44 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -28,9 +28,15 @@ on init chown root shell /tmp chmod 0775 /tmp +on fs + mkdir /dev/usb-ffs 0770 shell shell + mkdir /dev/usb-ffs/adb 0770 shell shell + mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 + write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18D1 write /sys/class/android_usb/android0/idProduct D001 + write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} write /sys/class/android_usb/android0/iProduct ${ro.product.model} -- cgit v1.2.3 From e739d7e6cd94e8300f9ea61a2d57d88328755b9f Mon Sep 17 00:00:00 2001 From: Riley Andrews Date: Tue, 24 Jun 2014 16:29:16 -0700 Subject: Fix recovery mode. Duplicate changes made to init.rc for https://android-review.googlesource.com/98852 in the init.rc used for recovery mode. Bug 15849856 Change-Id: Ia376ddf6373a28718653f7fb1435bf7ecb33d813 --- etc/init.rc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 6e0595b44..cd25d98dd 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -44,13 +44,31 @@ on fs on boot - ifup lo hostname localhost domainname localdomain class_start default +# Load properties from /system/ + /factory after fs mount. +on load_all_props_action + load_all_props + +# Mount filesystems and start core system services. +on late-init + trigger early-fs + trigger fs + trigger post-fs + trigger post-fs-data + + # Load properties from /system/ + /factory after fs mount. Place + # this in another action so that the load will be scheduled after the prior + # issued fs triggers have completed. + trigger load_all_props_action + + trigger early-boot + trigger boot + on property:sys.powerctl=* powerctl ${sys.powerctl} -- cgit v1.2.3 From 22bcf97a5949816db85242157cb2640feed73616 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 24 Jun 2014 13:43:39 -0700 Subject: recovery: enable panic_on_oops Set panic_on_oops=1 to reboot if the kernel panics. Change-Id: Id9e8689a570229db2ea2a3d72b52784f8a1ed107 --- etc/init.rc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index 8ed003888..23aca5aa2 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -28,6 +28,8 @@ on init chown root shell /tmp chmod 0775 /tmp + write /proc/sys/kernel/panic_on_oops 1 + on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell -- cgit v1.2.3 From 075ad800c539503d0515e5e0b4af160eccedead9 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 26 Jun 2014 15:35:51 -0700 Subject: sideload without holding the whole package in RAM 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 --- etc/init.rc | 1 + 1 file changed, 1 insertion(+) (limited to 'etc') diff --git a/etc/init.rc b/etc/init.rc index effb6449a..1b402e20d 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -23,6 +23,7 @@ on init mkdir /system mkdir /data mkdir /cache + mkdir /sideload mount tmpfs tmpfs /tmp chown root shell /tmp -- cgit v1.2.3