Skip to contentSkip to conversation

external/sepolicy: mediaserver talk to rild via socket

PATCH In review Haiqing Jiang 2 participants 7 messages Jul 19, 2012 – Jul 25, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 external/sepolicy: mediaserver talk to rild via socket

---
 mediaserver.te |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mediaserver.te +3 -0
index d3f0334..6dd4d4a 100644
@@ -40,3 +40,6 @@ allow mediaserver camera_calibration_file:file r_file_perms;
 # Read/[write] to /proc/net/xt_qtaguid/ctrl and /dev/xt_qtaguid
 allow mediaserver qtaguid_proc:file rw_file_perms;
 allow mediaserver qtaguid_device:chr_file r_file_perms;
+
+# Talk to rild via socket
+unix_socket_connect(mediaserver, rild, rild)
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.
#1 lore raw
Quoted 9 lines · Haiqing Jiang
---
 mediaserver.te |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mediaserver.te +0 -0
index d3f0334..6dd4d4a 100644

mediaserver.te allow mediaserver camera_calibration_file:file r_file_perms; · line 45

Quoted 6 lines
mediaserver.te +3 -0
@@ -40,3 +40,6 @@ allow mediaserver camera_calibration_file:file r_file_perms;
 # Read/[write] to /proc/net/xt_qtaguid/ctrl and /dev/xt_qtaguid
 allow mediaserver qtaguid_proc:file rw_file_perms;
 allow mediaserver qtaguid_device:chr_file r_file_perms;
+
+# Talk to rild via socket
+unix_socket_connect(mediaserver, rild, rild)

Hmm...it used to be that only radio could connect to rild. socket perms are 660 root radio, and mediaserver runs as media. Doesn't seem like this is possible even under DAC. Clarification requested?

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.
#2 lore raw

If in that case, I don't think it's a good idea to allow permission to mediaserver over rild. Thanks for your comments.

Quoted 28 lines · Stephen Smalley

mediaserver.te allow mediaserver camera_calibration_file:file

Quoted 9 lines · Haiqing Jiang
---
 mediaserver.te |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mediaserver.te +0 -0
index d3f0334..6dd4d4a 100644
@@ -40,3 +40,6 @@ allow mediaserver camera_calibration_file:file

r_file_perms;

mediaserver.te allow mediaserver camera_calibration_file:file r_file_perms; · line 45

Quoted 6 lines
mediaserver.te +3 -0
 # Read/[write] to /proc/net/xt_qtaguid/ctrl and /dev/xt_qtaguid
 allow mediaserver qtaguid_proc:file rw_file_perms;
 allow mediaserver qtaguid_device:chr_file r_file_perms;
+
+# Talk to rild via socket
+unix_socket_connect(mediaserver, rild, rild)

Hmm...it used to be that only radio could connect to rild. socket perms are 660 root radio, and mediaserver runs as media. Doesn't seem like this is possible even under DAC. Clarification requested?

--
Stephen Smalley
National Security Agency

Signature · 4 lines
-----------------------------------
Haiqing Jiang, PH.D student

Computer Science Department, North Carolina State University
#3 lore raw
Quoted 2 lines · Haiqing Jiang

If in that case, I don't think it's a good idea to allow permission to mediaserver over rild. Thanks for your comments.

It may be legitimate, but I want to understand why and how it happens before allowing it.

Quoted 47 lines

On Mon, Jul 23, 2012 at 6:26 AM, Stephen Smalley <[email protected]> wrote:

        On Thu, 2012-07-19 at 16:07 -0700, Haiqing Jiang wrote:
        > ---
        >  mediaserver.te |    3 +++
        >  1 files changed, 3 insertions(+), 0 deletions(-)
        >
        > diff --git a/mediaserver.te b/mediaserver.te
        > index d3f0334..6dd4d4a 100644
        > --- a/mediaserver.te
        > +++ b/mediaserver.te
        > @@ -40,3 +40,6 @@ allow mediaserver
        camera_calibration_file:file r_file_perms;
        >  # Read/[write] to /proc/net/xt_qtaguid/ctrl
        and /dev/xt_qtaguid
        >  allow mediaserver qtaguid_proc:file rw_file_perms;
        >  allow mediaserver qtaguid_device:chr_file r_file_perms;
        > +
        > +# Talk to rild via socket
        > +unix_socket_connect(mediaserver, rild, rild)
        
        
        Hmm...it used to be that only radio could connect to rild.
        socket perms are 660 root radio, and mediaserver runs as
        media.
        Doesn't seem like this is possible even under DAC.
         Clarification
        requested?
        
        --
        Stephen Smalley
        National Security Agency
Signature · 5 lines
-----------------------------------
Haiqing Jiang, PH.D student


Computer Science Department, North Carolina State University
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.
#4 lore raw

I cannot find the corresponding avc logs at this moment.. I will let you know when I find it.

Quoted 60 lines · Stephen Smalley
Quoted 2 lines · Haiqing Jiang

If in that case, I don't think it's a good idea to allow permission to mediaserver over rild. Thanks for your comments.

It may be legitimate, but I want to understand why and how it happens before allowing it.

Quoted 38 lines

On Mon, Jul 23, 2012 at 6:26 AM, Stephen Smalley <[email protected]> wrote:

        On Thu, 2012-07-19 at 16:07 -0700, Haiqing Jiang wrote:
        > ---
        >  mediaserver.te |    3 +++
        >  1 files changed, 3 insertions(+), 0 deletions(-)
        >
        > diff --git a/mediaserver.te b/mediaserver.te
        > index d3f0334..6dd4d4a 100644
        > --- a/mediaserver.te
        > +++ b/mediaserver.te
        > @@ -40,3 +40,6 @@ allow mediaserver
        camera_calibration_file:file r_file_perms;
        >  # Read/[write] to /proc/net/xt_qtaguid/ctrl
        and /dev/xt_qtaguid
        >  allow mediaserver qtaguid_proc:file rw_file_perms;
        >  allow mediaserver qtaguid_device:chr_file r_file_perms;
        > +
        > +# Talk to rild via socket
        > +unix_socket_connect(mediaserver, rild, rild)


        Hmm...it used to be that only radio could connect to rild.
        socket perms are 660 root radio, and mediaserver runs as
        media.
        Doesn't seem like this is possible even under DAC.
         Clarification
        requested?

        --
        Stephen Smalley
        National Security Agency
Quoted 9 lines

--
-----------------------------------
Haiqing Jiang, PH.D student

Computer Science Department, North Carolina State University

--
Stephen Smalley
National Security Agency

Signature · 4 lines
-----------------------------------
Haiqing Jiang, PH.D student

Computer Science Department, North Carolina State University
#5 lore raw

Hi, Stephen

I find the denial. But have not ideas about the exact object related to the denial. Please let me know your comments. Thanks.

*#============= mediaserver ============== allow mediaserver rild:unix_stream_socket connectto;

<5>[ 9719.676422] type=1400 audit(1343162276.710:1512): avc:  denied  {

connectto } for pid=519 comm=42696E646572205468726561642023 path=004D756C7469636C69656E74 scontext=u:r:mediaserver:s0 tcontext=u:r:rild:s0 tclass=unix_stream_socket*

Quoted 76 lines · Haiqing Jiang

I cannot find the corresponding avc logs at this moment.. I will let you know when I find it.

Quoted 50 lines · Stephen Smalley
Quoted 2 lines · Haiqing Jiang

If in that case, I don't think it's a good idea to allow permission to mediaserver over rild. Thanks for your comments.

It may be legitimate, but I want to understand why and how it happens before allowing it.

Quoted 43 lines

On Mon, Jul 23, 2012 at 6:26 AM, Stephen Smalley <[email protected]> wrote:

        On Thu, 2012-07-19 at 16:07 -0700, Haiqing Jiang wrote:
        > ---
        >  mediaserver.te |    3 +++
        >  1 files changed, 3 insertions(+), 0 deletions(-)
        >
        > diff --git a/mediaserver.te b/mediaserver.te
        > index d3f0334..6dd4d4a 100644
        > --- a/mediaserver.te
        > +++ b/mediaserver.te
        > @@ -40,3 +40,6 @@ allow mediaserver
        camera_calibration_file:file r_file_perms;
        >  # Read/[write] to /proc/net/xt_qtaguid/ctrl
        and /dev/xt_qtaguid
        >  allow mediaserver qtaguid_proc:file rw_file_perms;
        >  allow mediaserver qtaguid_device:chr_file r_file_perms;
        > +
        > +# Talk to rild via socket
        > +unix_socket_connect(mediaserver, rild, rild)


        Hmm...it used to be that only radio could connect to rild.
        socket perms are 660 root radio, and mediaserver runs as
        media.
        Doesn't seem like this is possible even under DAC.
         Clarification
        requested?

        --
        Stephen Smalley
        National Security Agency

--
-----------------------------------
Haiqing Jiang, PH.D student

Quoted 10 lines
Quoted 4 lines

Computer Science Department, North Carolina State University

--
Stephen Smalley
National Security Agency

--
-----------------------------------
Haiqing Jiang, PH.D student

Computer Science Department, North Carolina State University

Signature · 4 lines
-----------------------------------
Haiqing Jiang, PH.D student

Computer Science Department, North Carolina State University
#6 lore raw
Quoted 7 lines · Haiqing Jiang

Hi, Stephen

I find the denial. But have not ideas about the exact object related to the denial. Please let me know your comments. Thanks.

Quoted 7 lines

#============= mediaserver ============== allow mediaserver rild:unix_stream_socket connectto;

<5>[ 9719.676422] type=1400 audit(1343162276.710:1512): avc:  denied
 { connectto } for  pid=519 comm=42696E646572205468726561642023

path=004D756C7469636C69656E74 scontext=u:r:mediaserver:s0 tcontext=u:r:rild:s0 tclass=unix_stream_socket

Oh, it is a socket in the abstract namespace (path starts with the null byte). So it is not the /dev/socket/rild socket that is in view here.

So I guess you can add:

	allow mediaserver rild:unix_stream_socket connectto;

and not use the unix_socket_connect() macro because we do not want to allow use of /dev/socket/rild, only the abstract socket connection.

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.