From 61dc35072090f2735af2b39572e39eadb30573eb Mon Sep 17 00:00:00 2001 From: Nick Kralevich <nnk@google.com> Date: Tue, 17 Dec 2013 10:58:18 -0800 Subject: [PATCH] app.te: allow getopt/getattr on zygote socket The closure of /dev/socket/zygote occurs in the zygote child process, after Zygote has dropped privileges and changed SELinux domains. In Google's internal tree, socket closures are following a different path, which is causing getopt/getattr to be used on the file descriptor. This is generating a large number of denials. Allow the operations for now. getopt/getattr are fairly harmless. Long term, we shouldn't be performing these operations on the zygote socket. Addresses the following denials: 18.352783 type=1400 audit(1386374111.043:7): avc: denied { getattr } for pid=682 comm="ndroid.systemui" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:platform_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 18.353088 type=1400 audit(1386374111.043:8): avc: denied { getopt } for pid=682 comm="ndroid.systemui" path="/dev/socket/zygote" scontext=u:r:platform_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 18.833251 type=1400 audit(1386374111.524:9): avc: denied { getattr } for pid=761 comm="d.process.acore" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:shared_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 18.833557 type=1400 audit(1386374111.524:10): avc: denied { getopt } for pid=761 comm="d.process.acore" path="/dev/socket/zygote" scontext=u:r:shared_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 19.042419 type=1400 audit(1386374111.734:11): avc: denied { getattr } for pid=806 comm="d.process.media" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:media_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 19.042724 type=1400 audit(1386374111.734:12): avc: denied { getopt } for pid=806 comm="d.process.media" path="/dev/socket/zygote" scontext=u:r:media_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 19.182830 type=1400 audit(1386374111.874:14): avc: denied { getattr } for pid=825 comm="putmethod.latin" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:untrusted_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 19.183105 type=1400 audit(1386374111.874:15): avc: denied { getopt } for pid=825 comm="putmethod.latin" path="/dev/socket/zygote" scontext=u:r:untrusted_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket 19.235473 type=1400 audit(1386374111.924:16): avc: denied { getattr } for pid=840 comm="ndroid.settings" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket Bug: 12061011 Change-Id: Ie1ec7636185aba7954656802e5eed735f49830c9 --- app.te | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.te b/app.te index f3a083ce0..fb1c8ed73 100644 --- a/app.te +++ b/app.te @@ -13,6 +13,10 @@ unix_socket_connect(appdomain, keystore, keystore) # Receive and use open file descriptors inherited from zygote. allow appdomain zygote:fd use; +# Needed to close the zygote socket, which involves getopt / getattr +# This should be deleted after b/12061011 is fixed +allow appdomain zygote:unix_stream_socket { getopt getattr }; + # gdbserver for ndk-gdb reads the zygote. allow appdomain zygote_exec:file r_file_perms; -- GitLab