Dirk,

Thanks for the update. I could reproduce the issue, it happens when
starter forks() to the background. I haven't seen that, as starter logs
to a different file here.

Due to [1], starter closefrom()s all open file descriptors after the
fork. As we now use libstrongswan to manage IPC sockets, this won't
work. The file descriptor watcher class uses a pipe() to signal FDSET
changes. And the closefrom() just kills our pipe.

Not sure what the best approach is to address this, but the closefrom()
is definitely not that elegant. The attached patch fixes the issue here.

@Tobias: What do you think about reverting [1]? Could we use a less
aggressive mechanism to close these FDs for Android?

Probably we should go through a libstrongswan deinit/init cycle
after/during the fork(), so we don't share the pipe with the parent
process. This is a little tricky with leak-detective, though.

Regards
Martin

[1]http://git.strongswan.org/?p=strongswan.git;a=commitdiff;h=652ddf5c
>From 468b8159ee0b18143706f86ed0a1233b901c9d02 Mon Sep 17 00:00:00 2001
From: Martin Willi <[email protected]>
Date: Fri, 11 Jul 2014 14:40:56 +0200
Subject: [PATCH] starter: Do not close all file descriptors after fork()

As we use libstrongswan and expect that it still works after the fork, we
can't just closefrom() all file descriptors. Watcher, for example, uses
a pipe to notify FDSET changes, which must be kept open.
---
 src/starter/starter.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/starter/starter.c b/src/starter/starter.c
index ef57808..71f33ae 100644
--- a/src/starter/starter.c
+++ b/src/starter/starter.c
@@ -612,7 +612,6 @@ int main (int argc, char **argv)
 				int fnull;
 
 				close_log();
-				closefrom(3);
 
 				fnull = open("/dev/null", O_RDWR);
 				if (fnull >= 0)
-- 
1.9.1

_______________________________________________
Users mailing list
[email protected]
https://lists.strongswan.org/mailman/listinfo/users

Reply via email to