From: Ian Campbell Subject: Re: [PATCH 4/7] libxl: fork: assert that chldmode is right Date: Fri, 17 Jan 2014 11:13:59 +0000 Message-ID: <1389957239.6697.72.camel@kazak.uk.xensource.com> References: <1389892942-8452-1-git-send-email-ian.jackson@eu.citrix.com> <1389892942-8452-5-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1389892942-8452-5-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Jim Fehlig , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Thu, 2014-01-16 at 17:22 +0000, Ian Jackson wrote: > In libxl_childproc_reaped, check that the chldmode is as expected. The doc comment on libxl_childproc_reaped says: * May be called only by an application which has called setmode with * chldowner == libxl_sigchld_owner_mainloop. If pid was a process started so this is obviously correct. > Signed-off-by: Ian Jackson Acked-by: Ian Campbell > --- > tools/libxl/libxl_fork.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c > index 7b84765..85db2fb 100644 > --- a/tools/libxl/libxl_fork.c > +++ b/tools/libxl/libxl_fork.c > @@ -322,6 +322,8 @@ int libxl_childproc_reaped(libxl_ctx *ctx, pid_t pid, int status) > { > EGC_INIT(ctx); > CTX_LOCK; > + assert(CTX->childproc_hooks->chldowner > + == libxl_sigchld_owner_mainloop); > int rc = childproc_reaped(egc, pid, status); > CTX_UNLOCK; > EGC_FREE;