Skip to content

Commit

Permalink
Tools: hv: kvp: ensure kvp device fd is closed on exec
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
vittyvk authored and gregkh committed Aug 31, 2016
1 parent 3724287 commit 2684043
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2684043

Please sign in to comment.