Patches to target denies of LocationManager (GPS).
LocationManger needs to access GPS over UART devices. Two core functionalities are required in order to access GPS. The first one is the uart driver. /dev/ttyO0 is for UART Driver. It's defined in CSR SiRF policy file. We can find it on both maguro and toro devices. But it's Samsung tuna board specific. We define it as "gps_device".
The second one is the uart rts level ctrl. The uart1 is for GPS and CSR GPS chip should control uart1 rts level for GPS firmware download. /proc/mcspi1_cs3_ctrl is the proc entry assigned "uart1 rts level" control. It is also Samsung Tuna Board specific.
But we find one problem that we cannot label contexts of /proc/mcspi1_cs3_ctrl out of file "ocontext". Could someone help us to label it in the file of "/device/samsung/tuna/sepolicy.fc" to make it device-specific?
Thanks a lot,
Haiqing Jiang
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
PATCH 1/1 GPS chip accesses to uart driver when locationmanager launched.
--- sepolicy.fc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
sepolicy.fc +3 -1
@@ -9,7 +9,6 @@ /dev/tiler u:object_r:video_device:s0 /dev/ttyGS0 u:object_r:radio_device:s0 /dev/ttyGS1 u:object_r:radio_device:s0 -/dev/ttyO0 u:object_r:radio_device:s0 /dev/umts_boot0 u:object_r:radio_device:s0 /dev/umts_boot1 u:object_r:radio_device:s0 /dev/umts_ipc0 u:object_r:radio_device:s0
@@ -25,3 +24,6 @@ #The devices and files used by the hciattach service are device specific /system/bin/brcm_patchram_plus u:object_r:hci_attach_exec:s0 /dev/ttyO1 u:object_r:hci_attach_dev:s0 + +# In Samsung Tuna Board, ttyO0 is for uart driver. gps_device is device specific +/dev/ttyO0 u:object_r:gps_device:s0
Signature · 7 lines
1.7.0.4 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
PATCH 1/1 Corrected denials for LocationManager when accessing gps over uart.
In reply to hqjiang--- device.te | 1 + file.te | 3 +++ ocontexts | 3 +++ rild.te | 3 +++ system.te | 5 +++++ 5 files changed, 15 insertions(+), 0 deletions(-)
device.te +1 -0
@@ -39,6 +39,7 @@ type vcs_device, dev_type; type zero_device, dev_type; type fuse_device, dev_type; type ion_device, dev_type; +type gps_device, dev_type; # All devices have a uart for the hci # attach service. The uart dev node
file.te +3 -0
@@ -79,6 +79,9 @@ type vold_socket, file_type; type wpa_socket, file_type; type zygote_socket, file_type; +# UART (for GPS) control proc file +type gps_control, file_type; + # Allow files to be created in their appropriate filesystems. allow fs_type self:filesystem associate; allow sysfs_type sysfs:filesystem associate;
ocontexts +3 -0
@@ -52,6 +52,9 @@ genfscon rootfs / u:object_r:rootfs:s0 # proc labeling can be further refined (longest matching prefix). genfscon proc / u:object_r:proc:s0 genfscon proc /net/xt_qtaguid/ctrl u:object_r:qtaguid:s0 +# These proc entries are for the CSR GPS chip +# XXX Can we label these as device specific? +genfscon proc /mcspi1_cs3_ctrl u:object_r:gps_control:s0 # selinuxfs booleans can be individually labeled. genfscon selinuxfs / u:object_r:selinuxfs:s0 genfscon cgroup / u:object_r:cgroup:s0
rild.te +3 -0
@@ -34,3 +34,6 @@ allow rild sysfs:file rw_file_perms; # property service allow rild rild_prop:property_service set; allow rild radio_prop:property_service set; + +# Read/Write to uart driver (for GPS) +allow rild gps_device:chr_file rw_file_perms;
system.te +5 -0
@@ -187,3 +187,8 @@ allow system system_file:file x_file_perms; # XXX dontaudit candidate allow system domain:dir r_dir_perms; allow system domain:file r_file_perms; + +# LocationManager(e.g, GPS) needs to read and write +# to uart driver and ctrl proc entry +allow system gps_device:chr_file rw_file_perms; +allow system gps_control:file rw_file_perms;
Signature · 7 lines
1.7.0.4 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 5 lines · hqjiang
LocationManger needs to access GPS over UART devices. Two core functionalities are required in order to access GPS. The first one is the uart driver.
/dev/ttyO0is for UART Driver. It's defined in CSR SiRF policy file. We can find it on both maguro and toro devices. But it's Samsung tuna board specific. We define it as "gps_device".
Quoted 8 lines
The second one is the uart rts level ctrl. The uart1 is for GPS and CSR GPS chip should control uart1 rts level for GPS firmware download.
/proc/mcspi1_cs3_ctrlis the proc entry assigned "uart1 rts level" control. It is also Samsung Tuna Board specific.But we find one problem that we cannot label contexts of
/proc/mcspi1_cs3_ctrlout of file "ocontext". Could someone help us to label it in the file of "/device/samsung/tuna/sepolicy.fc" to make it device-specific?
You'd need to modify sepolicy/Android.mk to look for a new file in the per-device directories, maybe sepolicy.ocontexts, and merge its contents into the base ocontexts configuration. But it isn't a simple matter of concatenating as with the .fc files or .te files as it has multiple sections and you can't just intermingle them. One option would be to split up ocontexts into separate files for each kind of statement (as in the refpolicy) and then you could in fact just look for a corresponding sepolicy.X file in the per-device directory and concatenate it. The individual files would be initial_sid_contexts (the sid statements), fs_use (the fs_use_* statements), genfs_contexts (the genfscon statements), etc.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Ok we will submit patches for this soon.
Quoted 40 lines · Stephen Smalley
Quoted 1 line · hqjiang
LocationManger needs to access GPS over UART devices. Two core
functionalities are
Quoted 1 line
required in order to access GPS. The first one is the uart driver.
/dev/ttyO0isQuoted 1 line
for UART Driver. It's defined in CSR SiRF policy file. We can find it on
both maguro
Quoted 1 line
and toro devices. But it's Samsung tuna board specific. We define it as
"
gps_device".Quoted 2 lines
The second one is the uart rts level ctrl. The uart1 is for GPS and CSR
GPS chip
Quoted 1 line
should control uart1 rts level for GPS firmware download.
/proc/mcspi1_cs3_ctrlisQuoted 1 line
the proc entry assigned "uart1 rts level" control. It is also Samsung
Tuna Board
Quoted 3 lines
specific.
But we find one problem that we cannot label contexts of
/proc/mcspi1_cs3_ctrloutQuoted 2 lines
of file "ocontext". Could someone help us to label it in the file of "/device/samsung/tuna/sepolicy.fc" to make it device-specific?
You'd need to modify
sepolicy/Android.mkto look for a new file in the per-device directories, maybe sepolicy.ocontexts, and merge its contents into the base ocontexts configuration. But it isn't a simple matter of concatenating as with the .fc files or .te files as it has multiple sections and you can't just intermingle them. One option would be to split up ocontexts into separate files for each kind of statement (as in the refpolicy) and then you could in fact just look for a corresponding sepolicy.X file in the per-device directory and concatenate it. The individual files would beinitial_sid_contexts(the sid statements),fs_use(the fs_use_* statements),genfs_contexts(the genfscon statements), etc.--
Stephen Smalley
National Security Agency
Signature · 3 lines
Respectfully, William C Roberts