WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] call setsid() before exec() in fork/exec daemon
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Tue, 2 Feb 2010 14:53:13 +0000
Delivery-date: Tue, 02 Feb 2010 06:46:02 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] call setsid() before exec() in fork/exec daemon, David Scott <=