diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 29c1613..4c738b2 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -79,6 +79,9 @@ TARGET_RECOVERY_FSTAB := $(LOCAL_PATH)/rootdir/etc/fstab.qcom # SELinux -include device/qcom/sepolicy/sepolicy.mk +BOARD_SEPOLICY_DIRS += \ + device/samsung/klte-common/sepolicy + # Wifi BOARD_HAVE_SAMSUNG_WIFI := true BOARD_WLAN_DEVICE := bcmdhd diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index 61f5420..5030e75 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -81,7 +81,7 @@ on fs mount_all fstab.qcom restorecon_recursive /persist - restorecon -R /efs + restorecon_recursive /efs setprop ro.crypto.fuse_sdcard true @@ -133,6 +133,7 @@ on post-fs-data mkdir /efs/wifi 0775 radio system chown system wifi /efs/wifi/.mac.info chmod 0660 /efs/wifi/.mac.info + restorecon /efs/wifi/.mac.info chmod 0660 /efs/wifi/.mac.cob # Create directory used by audio subsystem @@ -986,8 +987,11 @@ on boot # permissions for bluetooth. setprop ro.bt.bdaddr_path "/efs/bluetooth/bt_addr" chown bluetooth net_bt_stack ro.bt.bdaddr_path + chown radio net_bt_stack /efs/bluetooth/bt_addr chmod 0640 /efs/bluetooth/bt_addr + restorecon_recursive /efs/bluetooth + chmod 0660 /sys/class/rfkill/rfkill0/state chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type @@ -1000,6 +1004,18 @@ on boot chmod 0600 /dev/btlock chown bluetooth bluetooth /dev/btlock + # Sensors + chown system system /efs/prox_cal + chmod 0640 /efs/prox_cal + restorecon /efs/prox_cal + + chown system system /efs/FactoryApp/baro_delta + chmod 0640 /efs/FactoryApp/baro_delta + restorecon /efs/FactoryApp/baro_delta + + chown system system /efs/gyro_cal_data + chmod 0640 /efs/gyro_cal_data + restorecon /efs/gyro_cal_data # Services begin here diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te new file mode 100644 index 0000000..154f4bc --- /dev/null +++ b/sepolicy/bluetooth.te @@ -0,0 +1,2 @@ +allow bluetooth bluetooth_device:chr_file { open write }; +allow bluetooth proc_bluetooth_writable:dir search; diff --git a/sepolicy/device.te b/sepolicy/device.te new file mode 100644 index 0000000..5cc35eb --- /dev/null +++ b/sepolicy/device.te @@ -0,0 +1 @@ +type bluetooth_device, dev_type; diff --git a/sepolicy/file.te b/sepolicy/file.te new file mode 100644 index 0000000..1cef9ce --- /dev/null +++ b/sepolicy/file.te @@ -0,0 +1,6 @@ +type sensors_efs_file, file_type; +type sysfs_camera, fs_type, sysfs_type; +type sysfs_display, fs_type, sysfs_type; +type sysfs_sec, fs_type, sysfs_type; +type sysfs_vibeamp, fs_type, sysfs_type; +type wifi_efs_file, file_type; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts new file mode 100644 index 0000000..0af10a4 --- /dev/null +++ b/sepolicy/file_contexts @@ -0,0 +1,34 @@ + +# Bluetooth +/dev/btlock u:object_r:bluetooth_device:s0 +/dev/rfkill u:object_r:bluetooth_device:s0 +/efs/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 + +# Camera +/data/cam_socket.* u:object_r:camera_socket:s0 +/sys/devices/virtual/camera(/.*)? u:object_r:sysfs_camera:s0 + +# CMHW +/sys/devices/virtual/timed_output/vibrator(/.*)? u:object_r:sysfs_vibeamp:s0 + +# Display +/sys/devices/virtual/lcd/panel/power_reduce u:object_r:sysfs_display:s0 + +# GPS +/data/misc/gsiff_ctrl_q u:object_r:location_data_file:s0 + +# NFC +/dev/pn547 u:object_r:nfc_device:s0 + +# SEC +/sys/devices/virtual/sec/sec_key/hall_irq_ctrl u:object_r:sysfs_sec:s0 + +# Sensors +/dev/batch_io u:object_r:sensors_device:s0 +/efs/FactoryApp/baro_delta u:object_r:sensors_efs_file:s0 +/efs/gyro_cal_data u:object_r:sensors_efs_file:s0 +/efs/prox_cal u:object_r:sensors_efs_file:s0 + +# WiFi +/data/.wifiver.info u:object_r:wifi_data_file:s0 +/efs/wifi(/.*)? u:object_r:wifi_efs_file:s0 diff --git a/sepolicy/genfs_contexts b/sepolicy/genfs_contexts new file mode 100644 index 0000000..49a35af --- /dev/null +++ b/sepolicy/genfs_contexts @@ -0,0 +1 @@ +genfscon proc /bluetooth/sleep u:object_r:proc_bluetooth_writable:s0 diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te new file mode 100644 index 0000000..4d1c590 --- /dev/null +++ b/sepolicy/mediaserver.te @@ -0,0 +1,2 @@ +allow mediaserver sysfs_camera:dir search; +allow mediaserver sysfs_camera:file { getattr open read }; diff --git a/sepolicy/mm-qcamerad.te b/sepolicy/mm-qcamerad.te new file mode 100644 index 0000000..962f70d --- /dev/null +++ b/sepolicy/mm-qcamerad.te @@ -0,0 +1,5 @@ +allow mm-qcamerad media_rw_data_file:dir search; +allow mm-qcamerad qdsp_device:chr_file { open read ioctl }; +allow mm-qcamerad sysfs_camera:dir search; +allow mm-qcamerad sysfs_camera:file { getattr open read write }; +type_transition mm-qcamerad system_data_file:sock_file camera_socket "cam_socket3"; diff --git a/sepolicy/rild.te b/sepolicy/rild.te new file mode 100644 index 0000000..1de7b6b --- /dev/null +++ b/sepolicy/rild.te @@ -0,0 +1,2 @@ +allow rild proc_net:file { write }; +allow rild sysfs_sec:file { getattr open read write }; diff --git a/sepolicy/rmt_storage.te b/sepolicy/rmt_storage.te new file mode 100644 index 0000000..a46ca64 --- /dev/null +++ b/sepolicy/rmt_storage.te @@ -0,0 +1 @@ +allow rmt_storage ssd_device:blk_file { open read write }; diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te new file mode 100644 index 0000000..fb88b08 --- /dev/null +++ b/sepolicy/system_app.te @@ -0,0 +1,4 @@ +allow system_app shell_data_file:dir search; +allow system_app sysfs_display:file { getattr open read write }; +allow system_app sysfs_vibeamp:dir search; +allow system_app sysfs_vibeamp:file { getattr open read write }; diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te new file mode 100644 index 0000000..1d1f07a --- /dev/null +++ b/sepolicy/system_server.te @@ -0,0 +1,5 @@ +allow system_server efs_file:dir search; +allow system_server sensors_efs_file:file { open read }; +allow system_server sysfs_vibeamp:dir search; +allow system_server sysfs_vibeamp:file { open read write }; +allow system_server time_daemon:unix_stream_socket connectto; diff --git a/sepolicy/time_daemon.te b/sepolicy/time_daemon.te new file mode 100644 index 0000000..bf20926 --- /dev/null +++ b/sepolicy/time_daemon.te @@ -0,0 +1,3 @@ +allow time_daemon system_server:dir search; +allow time_daemon system_server:file { open read }; +allow time_daemon time_data_file:file { getattr append }; diff --git a/sepolicy/ueventd.te b/sepolicy/ueventd.te new file mode 100644 index 0000000..0018a7d --- /dev/null +++ b/sepolicy/ueventd.te @@ -0,0 +1,2 @@ +allow ueventd sysfs_camera:file { open read write }; +allow ueventd sysfs_vibeamp:file { open read write }; diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te new file mode 100644 index 0000000..3261485 --- /dev/null +++ b/sepolicy/wpa.te @@ -0,0 +1,4 @@ +allow wpa bluetooth_device:chr_file { open read write }; +allow wpa efs_file:dir search; +allow wpa wifi_efs_file:dir search; +allow wpa wifi_efs_file:file { open read };