[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] call setsid() before exec() in fork/exec daemon



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# 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 <dave.scott@xxxxxxxxxxxxx>

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 +++


Attachment: xen-api-libs.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.