# HG changeset patch
# User David Scott <[email protected]>
# Date 1265122365 0
# Node ID 307ebc6467dbd950f2f97e53d97b42de44c442e8
# Parent  970802d63b9d2ae7406fbd3dac72ac6f4389d4fe
CA-36554: call setsid() before exec() to make sure children don't accidentally 
kill us when they (eg) send their entire process group a SIGQUIT.

Signed-off-by: David Scott <[email protected]>

diff -r 970802d63b9d -r 307ebc6467db forking_executioner/child.ml
--- a/forking_executioner/child.ml      Tue Feb 02 13:58:27 2010 +0000
+++ b/forking_executioner/child.ml      Tue Feb 02 14:52:45 2010 +0000
@@ -129,6 +129,9 @@
       (* Now let's close everything except those fds mentioned in the 
ids_received list *)
       Unixext.close_all_fds_except ([Unix.stdin; Unix.stdout; Unix.stderr] @ 
fds);
       
+         (* Distance ourselves from our parent process: *)
+         if Unix.setsid () == -1 then failwith "Unix.setsid failed";     
+
       (* And exec *)
       Unix.execve (List.hd args) (Array.of_list args) (Array.of_list state.env)
     end else begin
1 file changed, 3 insertions(+)
forking_executioner/child.ml |    3 +++


# HG changeset patch
# User David Scott <[email protected]>
# Date 1265122365 0
# Node ID 307ebc6467dbd950f2f97e53d97b42de44c442e8
# Parent  970802d63b9d2ae7406fbd3dac72ac6f4389d4fe
CA-36554: call setsid() before exec() to make sure children don't accidentally kill us when they (eg) send their entire process group a SIGQUIT.

Signed-off-by: David Scott <[email protected]>

diff -r 970802d63b9d -r 307ebc6467db forking_executioner/child.ml
--- a/forking_executioner/child.ml	Tue Feb 02 13:58:27 2010 +0000
+++ b/forking_executioner/child.ml	Tue Feb 02 14:52:45 2010 +0000
@@ -129,6 +129,9 @@
       (* Now let's close everything except those fds mentioned in the ids_received list *)
       Unixext.close_all_fds_except ([Unix.stdin; Unix.stdout; Unix.stderr] @ fds);
       
+	  (* Distance ourselves from our parent process: *)
+	  if Unix.setsid () == -1 then failwith "Unix.setsid failed";	  
+
       (* And exec *)
       Unix.execve (List.hd args) (Array.of_list args) (Array.of_list state.env)
     end else begin
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to