aboutsummaryrefslogtreecommitdiffstats
path: root/rootdir/init.rc
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-11-18 19:19:50 -0800
committerSteve Kondik <shade@chemlab.org>2012-11-18 19:19:50 -0800
commit39d33d8d54ba55e49f9b430f842647a84751cb85 (patch)
treef5a3756ea25d3b87902ae6a6a8df2428509e4246 /rootdir/init.rc
parentd8aa8ab7424be375e4408ab360c000ac8b05d15d (diff)
parent31da9db0d1bf3227e3c383aa6ac28bde3c6409e5 (diff)
downloadsystem_core-39d33d8d54ba55e49f9b430f842647a84751cb85.tar.gz
system_core-39d33d8d54ba55e49f9b430f842647a84751cb85.tar.bz2
system_core-39d33d8d54ba55e49f9b430f842647a84751cb85.zip
Merge branch 'jb-mr1-release' of https://android.googlesource.com/platform/system/core into mr1
Conflicts: adb/Android.mk adb/usb_vendors.c include/private/android_filesystem_config.h include/system/audio.h include/system/camera.h init/property_service.c libnetutils/ifc_utils.c mkbootimg/mkbootimg.c rootdir/init.rc Change-Id: Ie42f0c14808e9f8cabd24854bfe15b6667955229
Diffstat (limited to 'rootdir/init.rc')
-rw-r--r--rootdir/init.rc63
1 files changed, 42 insertions, 21 deletions
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 07fb19b8..457ff375 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -4,14 +4,18 @@
# This is a common source of Android security bugs.
#
-import /init.${ro.hardware}.rc
import /init.usb.rc
+import /init.${ro.hardware}.rc
import /init.trace.rc
on early-init
# Set init and its forked children's oom_adj.
write /proc/1/oom_adj -16
+ # 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
# create mountpoints
@@ -30,9 +34,10 @@ loglevel 3
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
+ export ANDROID_STORAGE /storage
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
- export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar
+ export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar
# Backward compatibility
symlink /system/etc /etc
@@ -52,8 +57,14 @@ loglevel 3
mkdir /cache 0771 system cache
mkdir /config 0500 root root
+ # See storage config details at http://source.android.com/tech/storage/
+ mkdir /mnt/shell 0700 shell shell
+ mkdir /storage 0050 root sdcard_r
+
# Directory for putting things only root should see.
mkdir /mnt/secure 0700 root root
+ # Create private mountpoint so we can MS_MOVE from staging
+ mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0
# Directory for staging bindmounts
mkdir /mnt/secure/staging 0700 root root
@@ -124,24 +135,36 @@ on fs
on post-fs
# once everything is setup, no need to modify /
mount rootfs rootfs / ro remount
+ # mount shared so changes propagate into child namespaces
+ mount rootfs rootfs / shared rec
+ mount tmpfs tmpfs /mnt/secure private rec
# We chown/chmod /cache again so because mount is run as root + defaults
chown system cache /cache
- chmod 0771 /cache
+ chmod 0770 /cache
+ # We restorecon /cache in case the cache partition has been reset.
+ restorecon /cache
# This may have been created by the recovery system with odd permissions
chown system cache /cache/recovery
chmod 0770 /cache/recovery
+ # This may have been created by the recovery system with the wrong context.
+ restorecon /cache/recovery
#change permissions on vmallocinfo so we can grab it from bugreports
chown root log /proc/vmallocinfo
chmod 0440 /proc/vmallocinfo
+ chown root log /proc/slabinfo
+ chmod 0440 /proc/slabinfo
+
#change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
chown root system /proc/kmsg
chmod 0440 /proc/kmsg
chown root system /proc/sysrq-trigger
chmod 0220 /proc/sysrq-trigger
+ chown system log /proc/last_kmsg
+ chmod 0440 /proc/last_kmsg
# create the lost+found directories, so as to enforce our permissions
mkdir /cache/lost+found 0770 root root
@@ -150,6 +173,8 @@ on post-fs-data
# We chown/chmod /data again so because mount is run as root + defaults
chown system system /data
chmod 0771 /data
+ # We restorecon /data in case the userdata partition has been reset.
+ restorecon /data
# Create dump dir and collect dumps.
# Do this before we mount cache so eventually we can use cache for
@@ -169,10 +194,12 @@ on post-fs-data
# create basic filesystem structure
mkdir /data/misc 01771 system misc
- mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
+ mkdir /data/misc/adb 02750 system shell
+ mkdir /data/misc/bluedroid 0770 bluetooth net_bt_stack
mkdir /data/misc/bluetooth 0770 system system
mkdir /data/misc/keystore 0700 keystore keystore
mkdir /data/misc/keychain 0771 system system
+ mkdir /data/misc/sms 0770 system radio
mkdir /data/misc/vpn 0770 system vpn
mkdir /data/misc/systemkeys 0700 system system
# give system access to wpa_supplicant.conf for backup and restore
@@ -186,6 +213,7 @@ on post-fs-data
mkdir /data/data 0771 system system
mkdir /data/app-private 0771 system system
mkdir /data/app-asec 0700 root root
+ mkdir /data/app-lib 0771 system system
mkdir /data/app 0771 system system
mkdir /data/property 0700 root root
mkdir /data/ssh 0750 root shell
@@ -247,6 +275,7 @@ on boot
chown radio system /sys/android_power/acquire_full_wake_lock
chown radio system /sys/android_power/acquire_partial_wake_lock
chown radio system /sys/android_power/release_wake_lock
+ chown system system /sys/power/autosleep
chown system system /sys/power/state
chown system system /sys/power/wakeup_count
chown radio system /sys/power/wake_lock
@@ -361,6 +390,11 @@ on property:vold.decrypt=trigger_shutdown_framework
service ueventd /sbin/ueventd
class core
critical
+ seclabel u:r:ueventd:s0
+
+on property:selinux.reload_policy=1
+ restart ueventd
+ restart installd
service console /system/bin/sh
class core
@@ -375,7 +409,9 @@ on property:ro.debuggable=1
# adbd is controlled via property triggers in init.<platform>.usb.rc
service adbd /sbin/adbd
class core
+ socket adbd stream 660 system system
disabled
+ seclabel u:r:adbd:s0
# adbd on at boot in emulator
on property:ro.kernel.qemu=1
@@ -415,7 +451,7 @@ service ril-daemon /system/bin/rild
service surfaceflinger /system/bin/surfaceflinger
class main
user system
- group graphics
+ group graphics drmrpc
onrestart restart zygote
service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
@@ -429,7 +465,7 @@ service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-sys
service drm /system/bin/drmserver
class main
user drm
- group drm system inet drmrpc sdcard_r
+ group drm system inet drmrpc
service media /system/bin/mediaserver
class main
@@ -444,21 +480,6 @@ service bootanim /system/bin/bootanimation
disabled
oneshot
-service dbus /system/bin/dbus-daemon --system --nofork
- class main
- socket dbus stream 660 bluetooth bluetooth
- user bluetooth
- group bluetooth net_bt_admin
-
-service bluetoothd /system/bin/bluetoothd -n
- class main
- socket bluetooth stream 660 bluetooth bluetooth
- socket dbus_bluetooth stream 660 bluetooth bluetooth
- # init.rc does not yet support applying capabilities, so run as root and
- # let bluetoothd drop uid to bluetooth with the right linux capabilities
- group bluetooth net_bt_admin misc
- disabled
-
service installd /system/bin/installd
class main
socket installd stream 600 system system