From patchwork Tue Apr 15 22:07:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 28437 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9787D2036A for ; Tue, 15 Apr 2014 22:11:18 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kq14sf39020421pab.6 for ; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:references:in-reply-to:cc:subject:precedence :list-id:list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-transfer-encoding:content-type; bh=HyW4R12AkIQbv3z1sN9C0wST2AuMikqG7JuhuO2HWPA=; b=C+8iG39uYB9mcQlG3o+mmQnY21EKHpFezCN96qGq9fKFlPacZzhjzh0E+MEqmMEhSG nsH3DiZh3klrPvyQcljiIv7e/ZXxVdalckBVovsNxRn26GSY/DdWc9XOXlkrZi8YpD2X 0Khnj1NX01RXiMUOEJ4Daph+59Smehp8XJguaF4SiPlBr3WQD/AUTvL3gqsY4JezwhqZ k205+PE2OOzwcryLWgPRXnz3IzeQFG7iEkZk0ZwZ+hXYPDXF2fEaIUcKCiaMWVN4DTK2 JzP02XCY/7azhKhVC8SCvuQNPjzishTbC0dsT2YnHavJYMzSg6m9eycu9AZJkKRis+8X IAJQ== X-Gm-Message-State: ALoCoQk35nswG/pnChpAXIQB4YmrhijK9GwS5uhzlofK8M/k1a4y72SPZV2NYfkj5/Bsqu4szGuX X-Received: by 10.66.188.238 with SMTP id gd14mr2093777pac.18.1397599877777; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.197 with SMTP id j63ls378374qgf.89.gmail; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-Received: by 10.52.251.199 with SMTP id zm7mr73884vdc.21.1397599877666; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id sh5si3630869vdc.140.2014.04.15.15.11.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 15:11:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so9638829veb.40 for ; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-Received: by 10.52.51.226 with SMTP id n2mr70360vdo.57.1397599877575; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp265367vcb; Tue, 15 Apr 2014 15:11:17 -0700 (PDT) X-Received: by 10.236.116.99 with SMTP id f63mr6585138yhh.10.1397599876889; Tue, 15 Apr 2014 15:11:16 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id c21si20753019yhh.15.2014.04.15.15.11.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 15 Apr 2014 15:11:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaBXi-0007ll-AH; Tue, 15 Apr 2014 22:09:26 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaBXh-0007lW-Ml for xen-devel@lists.xen.org; Tue, 15 Apr 2014 22:09:26 +0000 Received: from [85.158.143.35:30694] by server-1.bemta-4.messagelabs.com id 2E/37-09853-41EAD435; Tue, 15 Apr 2014 22:09:24 +0000 X-Env-Sender: w1.huang@samsung.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1397599761!9321696!1 X-Originating-IP: [203.254.224.34] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjAzLjI1NC4yMjQuMzQgPT4gMzY4MTYw\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29412 invoked from network); 15 Apr 2014 22:09:23 -0000 Received: from mailout4.samsung.com (HELO mailout4.samsung.com) (203.254.224.34) by server-2.tower-21.messagelabs.com with DES-CBC3-SHA encrypted SMTP; 15 Apr 2014 22:09:23 -0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N43004EBEVKS870@mailout4.samsung.com> for xen-devel@lists.xen.org; Wed, 16 Apr 2014 07:09:20 +0900 (KST) X-AuditID: cbfee61a-b7fb26d00000724f-d1-534dae0f2e9a Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B8.A0.29263.F0EAD435; Wed, 16 Apr 2014 07:09:20 +0900 (KST) Received: from [172.31.201.10] ([105.140.31.10]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4300ACBEVHLT90@mmp1.samsung.com>; Wed, 16 Apr 2014 07:09:19 +0900 (KST) Message-id: <534DAD89.1040604@samsung.com> Date: Tue, 15 Apr 2014 17:07:05 -0500 From: Wei Huang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-version: 1.0 To: Julien Grall , duqi References: <25f20e60.4a87.145633bba97.Coremail.duqi_2009@163.com> <1397552021.24638.13.camel@kazak.uk.xensource.com> <78496d24.5d.14564c71cc0.Coremail.duqi_2009@163.com> <534D3E54.9060008@linaro.org> In-reply-to: <534D3E54.9060008@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsVy+t9jAV2Bdb7BBk8aWC0+nPzLZNH7YS2j xZvj05ks3vR2sFhM/3OHzWLyluXMFj/vXGS0WPJxMYsDh8fiFVNYPV5PnsDosf2JiMeda3vY PI7u/s3k8X7fVTaP9VuusgSwR3HZpKTmZJalFunbJXBlnNrwmrlgunrFmjUyDYz7ZbsYOTkk BEwkdp6cxwphi0lcuLeerYuRi0NIYBGjxMoXr1kgnAYmiVdTWtlAqngFtCR6pu0G62ARUJU4 sfE2mM0moCZx6uJ/FhBbVCBC4l7jYVaIekGJH5PvgcVFBFwkpqzewAQylFlgKZPEyxtLmUES wgLOEq2XPzBBbDvHKHF++mKwbZxA2y6seMYEYjMLmEk8alnHDGHLS2xe85Z5AqPALCRLZiEp m4WkbAEj8ypG0dSC5ILipPRcQ73ixNzi0rx0veT83E2M4Dh4JrWDcWWDxSFGAQ5GJR7eGTm+ wUKsiWXFlbmHGCU4mJVEeDe0AIV4UxIrq1KL8uOLSnNSiw8xSnOwKInzHmi1DhQSSE8sSc1O TS1ILYLJMnFwSjUwHsm9HLcl92BZwoEVE7orc45n3V2ocXFSrF77dpvDXRd85/3JFI/KYKrw l9Hvf6g223fXvsdWEZ6THj/98qfkzRKG0NentURihXO3sDBPfjr9UEDP6VnuKTk8YjrefIbN Wv5PNf4aXdDpFtknf2tllkSIXHlxzYdnGUd8H3gV8xpd2uzuEV+nxFKckWioxVxUnAgAHOrX N38CAAA= Cc: Ian Campbell , "Stefano Stabellini \(Xen mainlister\)" , =?UTF-8?B?5a6r5pmT5Yip?= , hdegoede , "bjzhang@suse.com" , "xen-devel@lists.xen.org" Subject: Re: [Xen-devel] The segmentfault when using xl create domU X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: w1.huang@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: On 04/15/2014 09:12 AM, Julien Grall wrote: > Hello, > > On 04/15/2014 10:45 AM, duqi wrote: >> At 2014-04-15 04:53:41, "Ian Campbell" wrote: >>> On Tue, 2014-04-15 at 10:33 +0800, duqi wrote: >>>> Hi there, >>>> We tried to create domU with command "xl -vvv create -d domU_01" and >>>> met the below fault: >>>> >>>> root@linaro-alip:~/domU# xl -vvv create -d domU_01 >>> >>> Does this happen if you drop the "-d"? >>> >>> please could you run under gdb and grab a backtrace. Someth8ing like: >>> # gdb --args xl -vvv create -d domU_01 >>> (gdb) run >>> .... >>> crash! >>> (gdb) bt >>> >> >> Hi, here is the gdb output: >> Program received signal SIGSEGV, Segmentation fault. >> 0xb6f6bc30 in memcpy (__len=16, __src=0xbefe6e0c, __dest=0x39488) >> at /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/include/bits/string3.h:51 >> 51 /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/include/bits/string3.h: No such file or direc. >> (gdb) bt >> #0 0xb6f6bc30 in memcpy (__len=16, __src=0xbefe6e0c, __dest=0x39488) >> at /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/include/bits/string3.h:51 >> #1 libxl_list_vm (ctx=ctx@entry=0x33030, >> nb_vm_out=nb_vm_out@entry=0xbeffee30) at libxl.c:689 >> #2 0xb6f7b934 in libxl__domain_make (gc=gc@entry=0x393d0, >> info=info@entry=0xbefff040, domid=domid@entry=0xbeffeec0) >> at libxl_create.c:613 >> #3 0xb6f7cadc in initiate_domain_create (dcs=0x398a8, egc=0xbeffeec4) >> at libxl_create.c:791 >> #4 do_domain_create (ctx=ctx@entry=0x33030, >> d_config=d_config@entry=0xbefff040, domid=domid@entry=0xbeffef80, >> restore_fd=restore_fd@entry=-1, >> checkpointed_stream=checkpointed_stream@entry=0, ao_how=ao_how@entry=0x0, >> aop_console_how=aop_console_how@entry=0x0) at libxl_create.c:1424 >> #5 0xb6f7d428 in libxl_domain_create_new (ctx=0x33030, >> d_config=d_config@entry=0xbefff040, domid=domid@entry=0xbeffef80, >> ao_how=ao_how@entry=0x0, aop_console_how=aop_console_how@entry=0x0) >> at libxl_create.c:1449 >> #6 0x00017040 in create_domain (dom_info=0xbeffefdc) at xl_cmdimpl.c:2283 >> #7 main_create (argc=, argv=) >> at xl_cmdimpl.c:4469 >> #8 0x0000db84 in main (argc=3, argv=0xbefff82c) at xl.c:362 >> (gdb) > > It's a compiler bug. For some reasons gcc doesn't generate the right assembly > when -O1 is specified on the command line. Which version of gcc do you use(4.7.*?)? > Which distribution are you using? > Can you also call disas the crash and copy the output? > > Gcc 4.8 doesn't seem to be affected. > > FYI, I got this output from 4.7 with Linaro Ubuntu raring (gcc 4.7.3). > > 0x76f71bd0 <+224>: mov r5, #0 > 0x76f71bd4 <+228>: mov r4, r5 > 0x76f71bd8 <+232>: mov r7, r5 <= r7 = r5 = 0 > 0x76f71bdc <+236>: sub r6, r11, #98304 ; 0x18000 > 0x76f71be0 <+240>: sub r6, r6, #36 ; 0x24 > 0x76f71be4 <+244>: mov r9, r5 > 0x76f71be8 <+248>: str r8, [r12, #-68] ; 0x44 > 0x76f71bec <+252>: sub r3, r11, #98304 ; 0x18000 > 0x76f71bf0 <+256>: ldr r0, [r3, #-68] ; 0x44 > 0x76f71bf4 <+260>: ldrh r1, [r6, r5] > 0x76f71bf8 <+264>: mov r2, r9 > 0x76f71bfc <+268>: bl 0x76f6d6ac > 0x76f71c00 <+272>: cmp r0, #0 > 0x76f71c04 <+276>: bne 0x76f71c50 > 0x76f71c08 <+280>: add r8, r7, r7, lsl #2 <= Last time we set r8 = r7 << 2 = 0 > 0x76f71c0c <+284>: sub r12, r11, #98304 ; 0x18000 > 0x76f71c10 <+288>: str r8, [r12, #-56] ; 0x38 > 0x76f71c14 <+292>: ldr r3, [r12, #-60] ; 0x3c > 0x76f71c18 <+296>: add lr, r3, r8, lsl #2 > 0x76f71c1c <+300>: add r12, r4, r4, lsl #1 > 0x76f71c20 <+304>: add r12, r6, r12, lsl #5 > 0x76f71c24 <+308>: add r12, r12, #76 ; 0x4c > 0x76f71c28 <+312>: ldm r12!, {r0, r1, r2, r3} > 0x76f71c2c <+316>: mov r12, r8 > => 0x76f71c30 <+320>: ldr r8, [r8, #-60] ; 0x3c <= r8 (=0) is dereferenced > I saw the same thing on my system and ack'ed that this is compiler related. My compiler is 4.7.3. I was able to fix it with the following hack: ret = xc_domain_getinfolist(ctx->xch, 1, ARRAY_SIZE(info), info); > > Regards, > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 730f6e1..14eac6b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -667,7 +667,8 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm_out) { GC_INIT(ctx); libxl_vminfo *ptr = NULL; - int idx, i, ret; + volatile int idx, i; + int ret; xc_domaininfo_t info[1024];