dmesg: allow dmesg_t access to init script stream sockets#1137
Conversation
|
What socket exactly is it accessing, and what configuration do you need for it to do that? I haven't observed this and I'm curious as to what it is (this kind of information is very useful when debugging things way down the line too). |
|
Command executed from adb shell: Following denials are seen: `type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782 comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=unix_stream_socket permissive=1 type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782 comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=unix_stream_socket permissive=1 type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782 comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=unix_stream_socket permissive=1 type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782 comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=unix_stream_socket permissive=1` |
|
That makes much more sense, thank you! Please include that in the commit message. |
Updated commit message with the denials. |
|
Please also include that it was |
Updated the commit message. |
|
It was a long weekend in the US and UK and it's only been 2 days since your last ping. I'd personally find that excessive on the projects I'm a reviewer for. |
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Upstream-Status: Pending [SELinuxProject/refpolicy#1137]
Signed-off-by: Sasi Kumar Maddineni <sasikuma@qti.qualcomm.com>
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Upstream-Status: Pending [SELinuxProject/refpolicy#1137]
Signed-off-by: Sasi Kumar Maddineni <sasikuma@qti.qualcomm.com>
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Upstream-Status: Submitted [SELinuxProject/refpolicy#1137]
Signed-off-by: Sasi Kumar Maddineni <sasikuma@qti.qualcomm.com>
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Upstream-Status: Submitted [SELinuxProject/refpolicy#1137]
Signed-off-by: Sasi Kumar Maddineni <sasikuma@qti.qualcomm.com>
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Upstream-Status: Submitted [SELinuxProject/refpolicy#1137]
Signed-off-by: Sasi Kumar Maddineni <sasikuma@qti.qualcomm.com>
|
As per my comments on the pipewire patch, I don't think this is correct. adb shell is clearly interactive, but for some reason is initrc_t? Which doesn't make sense. I would rather prefer that we add a domain for adb_shell_t and wire that up properly and run in a login domain than doing this, which comes off as a bit of a hack to me. I suspect that this will extent over to various policy modules too, which is not desirable as the ability to talk to unconfined, highly privileged initrc_t processes opens up quite a bit of attack surface. |
Yes, it will extend to many other policy modules which i am not sure on how to get this validated and reduce the ripple effort of creating a new domain for adb. |
dmesg was generating AVC denials when interacting with an init-script-owned
UNIX stream socket for operations such as read, write, ioctl, and getattr on
performing `adb shell dmesg`.
Denials:
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:412): avc: denied { getattr } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:410): avc: denied { read write } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1773565011.851:411): avc: denied { ioctl } for pid=4782
comm="dmesg" path="socket:[764973]" dev="sockfs" ino=764973 ioctlcmd=0x542a
scontext=system_u:system_r:dmesg_t:s0 tcontext=system_u:system_r:initrc_t:s0
tclass=unix_stream_socket permissive=1
Grant the expected socket access for dmesg_t resolving the AVC denials.
Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
No description provided.