summaryrefslogtreecommitdiffstats
path: root/server/FwmarkServer.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2016-12-20 06:51:32 -0800
committerNick Kralevich <nnk@google.com>2016-12-20 09:38:11 -0800
commit9384f23e018a6c29dec65f1de3d29cbfcf67a932 (patch)
tree6ab55a54d4c7588b4da4f2fe32c0c5f4b7a2b645 /server/FwmarkServer.cpp
parent9a22d1f28d84a0a83f0662252f198150d214d666 (diff)
downloadplatform_system_netd-9384f23e018a6c29dec65f1de3d29cbfcf67a932.tar.gz
platform_system_netd-9384f23e018a6c29dec65f1de3d29cbfcf67a932.tar.bz2
platform_system_netd-9384f23e018a6c29dec65f1de3d29cbfcf67a932.zip
FwMarkServer.cpp: Add O_CLOEXEC to received FDs
Add O_CLOEXEC to file descriptors received via the fwmark service. This prevents netd's file descriptors from leaking across an exec() boundary, and may address the following non-reproducible SELinux denials: avc: denied { use } for comm="clatd" path="socket:[860297]" dev="sockfs" ino=860297 scontext=u:r:clatd:s0 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=fd permissive=0 avc: denied { read write } for comm="clatd" path="socket:[1414454]" dev="sockfs" ino=1414454 scontext=u:r:clatd:s0 tcontext=u:r:system_server:s0 tclass=tcp_socket permissive=0 avc: denied { use } for comm="clatd" path="socket:[681600]" dev="sockfs" ino=681600 scontext=u:r:clatd:s0 tcontext=u:r:priv_app:s0:c512,c768 tclass=fd permissive=0 Test: Device boots and no obvious problems Test: /data/nativetest/netd_integration_test/netd_integration_test passed Change-Id: I866b1ee0693516b46269c7106e7fc1f85b017639
Diffstat (limited to 'server/FwmarkServer.cpp')
-rw-r--r--server/FwmarkServer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/FwmarkServer.cpp b/server/FwmarkServer.cpp
index 0fabfc424..000ffef73 100644
--- a/server/FwmarkServer.cpp
+++ b/server/FwmarkServer.cpp
@@ -73,7 +73,7 @@ int FwmarkServer::processClient(SocketClient* client, int* socketFd) {
message.msg_control = cmsgu.cmsg;
message.msg_controllen = sizeof(cmsgu.cmsg);
- int messageLength = TEMP_FAILURE_RETRY(recvmsg(client->getSocket(), &message, 0));
+ int messageLength = TEMP_FAILURE_RETRY(recvmsg(client->getSocket(), &message, MSG_CMSG_CLOEXEC));
if (messageLength <= 0) {
return -errno;
}