Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434505 > unrolled thread

[PATCH] Tools: hv: kvp: ensure kvp device fd is closed on exec

Started byVitaly Kuznetsov <vkuznets@redhat.com>
First post2016-06-30 14:30 +0200
Last post2016-06-30 14:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] Tools: hv: kvp: ensure kvp device fd is closed on exec Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-30 14:30 +0200

#1434505 — [PATCH] Tools: hv: kvp: ensure kvp device fd is closed on exec

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2016-06-30 14:30 +0200
Subject[PATCH] Tools: hv: kvp: ensure kvp device fd is closed on exec
Message-ID<rPJgt-15H-7@gated-at.bofh.it>
KVP daemon does fork()/exec() (with popen()) so we need to close our fds
to avoid sharing them with child processes. The immediate implication of
not doing so I see is SELinux complaining about 'ip' trying to access
'/dev/vmbus/hv_kvp'.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/hv/hv_kvp_daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 0d9f48e..bc7adb8 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -1433,7 +1433,7 @@ int main(int argc, char *argv[])
 	openlog("KVP", 0, LOG_USER);
 	syslog(LOG_INFO, "KVP starting; pid is:%d", getpid());
 
-	kvp_fd = open("/dev/vmbus/hv_kvp", O_RDWR);
+	kvp_fd = open("/dev/vmbus/hv_kvp", O_RDWR | O_CLOEXEC);
 
 	if (kvp_fd < 0) {
 		syslog(LOG_ERR, "open /dev/vmbus/hv_kvp failed; error: %d %s",
-- 
2.5.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web