All of lore.kernel.org
 help / color / mirror / Atom feed
* Patches to target denies of LocationManager (GPS).
@ 2012-07-10 21:36 hqjiang
  2012-07-10 21:36 ` [PATCH] GPS chip accesses to uart driver when locationmanager launched hqjiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: hqjiang @ 2012-07-10 21:36 UTC (permalink / raw)
  To: selinux; +Cc: bill.c.roberts, sds


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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] GPS chip accesses to uart driver when locationmanager launched.
  2012-07-10 21:36 Patches to target denies of LocationManager (GPS) hqjiang
@ 2012-07-10 21:36 ` hqjiang
  2012-07-10 21:36 ` [PATCH] Corrected denials for LocationManager when accessing gps over uart hqjiang
  2012-07-11 12:43 ` Patches to target denies of LocationManager (GPS) Stephen Smalley
  2 siblings, 0 replies; 5+ messages in thread
From: hqjiang @ 2012-07-10 21:36 UTC (permalink / raw)
  To: selinux; +Cc: bill.c.roberts, sds, hqjiang

---
 sepolicy.fc |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sepolicy.fc b/sepolicy.fc
index 599ff92..066f4fb 100644
--- a/sepolicy.fc
+++ b/sepolicy.fc
@@ -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
-- 
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] Corrected denials for LocationManager when accessing gps over uart.
  2012-07-10 21:36 Patches to target denies of LocationManager (GPS) hqjiang
  2012-07-10 21:36 ` [PATCH] GPS chip accesses to uart driver when locationmanager launched hqjiang
@ 2012-07-10 21:36 ` hqjiang
  2012-07-11 12:43 ` Patches to target denies of LocationManager (GPS) Stephen Smalley
  2 siblings, 0 replies; 5+ messages in thread
From: hqjiang @ 2012-07-10 21:36 UTC (permalink / raw)
  To: selinux; +Cc: bill.c.roberts, sds, hqjiang

---
 device.te |    1 +
 file.te   |    3 +++
 ocontexts |    3 +++
 rild.te   |    3 +++
 system.te |    5 +++++
 5 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/device.te b/device.te
index cb15eeb..9fc4d18 100644
--- a/device.te
+++ b/device.te
@@ -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
diff --git a/file.te b/file.te
index f18eb23..ba85ca5 100644
--- a/file.te
+++ b/file.te
@@ -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;
diff --git a/ocontexts b/ocontexts
index 7cbb989..a3e7d91 100644
--- a/ocontexts
+++ b/ocontexts
@@ -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
diff --git a/rild.te b/rild.te
index 033fc84..9176348 100644
--- a/rild.te
+++ b/rild.te
@@ -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;
diff --git a/system.te b/system.te
index 2030af4..1a94c75 100644
--- a/system.te
+++ b/system.te
@@ -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;
-- 
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Patches to target denies of LocationManager (GPS).
  2012-07-10 21:36 Patches to target denies of LocationManager (GPS) hqjiang
  2012-07-10 21:36 ` [PATCH] GPS chip accesses to uart driver when locationmanager launched hqjiang
  2012-07-10 21:36 ` [PATCH] Corrected denials for LocationManager when accessing gps over uart hqjiang
@ 2012-07-11 12:43 ` Stephen Smalley
  2012-07-11 21:29   ` William Roberts
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2012-07-11 12:43 UTC (permalink / raw)
  To: hqjiang; +Cc: selinux, bill.c.roberts

On Tue, 2012-07-10 at 14:36 -0700, hqjiang wrote:
> 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? 

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.

-- 
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patches to target denies of LocationManager (GPS).
  2012-07-11 12:43 ` Patches to target denies of LocationManager (GPS) Stephen Smalley
@ 2012-07-11 21:29   ` William Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: William Roberts @ 2012-07-11 21:29 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: hqjiang, selinux

[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]

Ok we will submit patches for this soon.

On Wed, Jul 11, 2012 at 5:43 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:

> On Tue, 2012-07-10 at 14:36 -0700, hqjiang wrote:
> > 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?
>
> 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.
>
> --
> Stephen Smalley
> National Security Agency
>
>


-- 
Respectfully,

William C Roberts

[-- Attachment #2: Type: text/html, Size: 2458 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-11 21:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 21:36 Patches to target denies of LocationManager (GPS) hqjiang
2012-07-10 21:36 ` [PATCH] GPS chip accesses to uart driver when locationmanager launched hqjiang
2012-07-10 21:36 ` [PATCH] Corrected denials for LocationManager when accessing gps over uart hqjiang
2012-07-11 12:43 ` Patches to target denies of LocationManager (GPS) Stephen Smalley
2012-07-11 21:29   ` William Roberts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.