From ca2da60206063f077a73a08e262c94b377b6c929 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 25 Jan 2017 08:08:51 -0500 Subject: [PATCH] Ensure property_set connection sockets are CLOEXEC. When handling a property control message to start a service, the connection socket was being left open. The child socket FD would then be inherited by the service from init as "/null". Bug: 34698883 Test: adb shell start webview_zygote32; adb shell ls -l /proc//fd, no "/null" FD open. Change-Id: I25f34e1bfc1414e6143acf23414b05f5a241cace --- init/property_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/property_service.cpp b/init/property_service.cpp index b2f641127..d323425fb 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -381,7 +381,7 @@ static void handle_property_set(SocketConnection& socket, static void handle_property_set_fd() { static constexpr uint32_t kDefaultSocketTimeout = 2000; /* ms */ - int s = accept(property_set_fd, nullptr, nullptr); + int s = accept4(property_set_fd, nullptr, nullptr, SOCK_CLOEXEC); if (s == -1) { return; }