From: Bamvor Jian Zhang Subject: [PATCH] fix assert fail in libxl__sigchld_installhandler Date: Mon, 25 Nov 2013 17:18:44 +0800 Message-ID: <1385371124-14474-1-git-send-email-bjzhang@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: jfehlig@suse.com, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, Bamvor Jian Zhang List-Id: xen-devel@lists.xenproject.org when libxl_sigchld_owner_libxl_always is used in libvirt or other tools stack, there is a assertion fail in restore in libxl__sigchld_installhandler during the following sequence: create -> save -> restore. here is the backtrace: #0 0x00007f7a522453d5 in raise () from /lib64/libc.so.6 #1 0x00007f7a52246858 in abort () from /lib64/libc.so.6 #2 0x00007f7a5223e2e2 in __assert_fail_base () from /lib64/libc.so.6 #3 0x00007f7a5223e392 in __assert_fail () from /lib64/libc.so.6 #4 0x00007f7a48008113 in libxl__sigchld_installhandler ( gc=gc@entry=0x7f7a4f080480) at libxl_fork.c:225 #5 0x00007f7a480081f4 in perhaps_installhandler (gc=gc@entry=0x7f7a4f080480, creating=creating@entry=false) at libxl_fork.c:272 #6 0x00007f7a4800851f in libxl_childproc_setmode (ctx=0x7f7a400c0ee0, hooks=hooks@entry=0x7f7a482694a0 , user=user@entry=0x7f7a48474f80 ) at libxl_fork.c:427 the sigchld_owner exists but it is not the same as the new CTX. meanwhile the old sigchild is not removed in perhaps_removehandler. Signed-off-by: Bamvor Jian Zhang --- tools/libxl/libxl_fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c index 4ae9f94..9f1a5ce 100644 --- a/tools/libxl/libxl_fork.c +++ b/tools/libxl/libxl_fork.c @@ -252,7 +252,7 @@ static bool chldmode_ours(libxl_ctx *ctx, bool creating) case libxl_sigchld_owner_mainloop: return 0; case libxl_sigchld_owner_libxl_always: - return 1; + return creating || !LIBXL_LIST_EMPTY(&ctx->children); } abort(); } -- 1.8.1.4