Patchwork qemu crashes on Mac OS X

login
register
mail settings
Submitter Damjan Marion
Date July 1, 2011, 2:56 p.m.
Message ID <EB590324-281D-4023-92DC-8AAEE4AC2510@gmail.com>
Download mbox | patch
Permalink /patch/102920/
State New
Headers show

Comments

Damjan Marion - July 1, 2011, 2:56 p.m.
On Jul 1, 2011, at 11:17 AM, Damjan Marion (damarion) wrote:

> 
> Hi,
> 
> I have an issue when I try to run qemu-system-arm on Mac OS X. 
> Sometime between 1 and 15 secs after qemu is started it crashes
> as shown bellow.
> 
> Same thing on linux host works fine.
> 
> Is anybody else experiencing this?
> Any Hints?

After bisection seems that this starts happening after following patch:

commit 09716e45a05cc0c93bcf55bd0c0888dd678e490f
Author: Alexander Graf <agraf@suse.de>
Date:   Thu Jun 9 00:55:37 2011 +0200

    sigfd: use pthread_sigmask



However before this patch qemu doesn't respond to keyboard (i.e. commit 31b7c261).

Last full working commit is 630ecca.

Thanks,

Damjan
Alexandre Raymond - July 4, 2011, 4:59 p.m.
Hi Damjan,

On Fri, Jul 1, 2011 at 10:56 AM, Damjan Marion <damjan.marion@gmail.com> wrote:
>
> On Jul 1, 2011, at 11:17 AM, Damjan Marion (damarion) wrote:
>
>>
>> Hi,
>>
>> I have an issue when I try to run qemu-system-arm on Mac OS X.
>> Sometime between 1 and 15 secs after qemu is started it crashes
>> as shown bellow.
>>
>> Same thing on linux host works fine.
>>
>> Is anybody else experiencing this?
>> Any Hints?
>
> After bisection seems that this starts happening after following patch:
>
> commit 09716e45a05cc0c93bcf55bd0c0888dd678e490f
> Author: Alexander Graf <agraf@suse.de>
> Date:   Thu Jun 9 00:55:37 2011 +0200
>
>    sigfd: use pthread_sigmask
>
>
> diff --git a/compatfd.c b/compatfd.c
> index bd377c4..41586ce 100644
> --- a/compatfd.c
> +++ b/compatfd.c
> @@ -29,7 +29,7 @@ static void *sigwait_compat(void *opaque)
>     sigset_t all;
>
>     sigfillset(&all);
> -    sigprocmask(SIG_BLOCK, &all, NULL);
> +    pthread_sigmask(SIG_BLOCK, &all, NULL);
>
>     while (1) {
>
>
> However before this patch qemu doesn't respond to keyboard (i.e. commit 31b7c261).
>
> Last full working commit is 630ecca.
>
> Thanks,
>
> Damjan
>

Can you try applying the following two patches and see if it solves
your problem?

http://patchwork.ozlabs.org/patch/100348/
http://patchwork.ozlabs.org/patch/100477/

Alexandre
Damjan Marion - July 4, 2011, 10:35 p.m.
On Jul 4, 2011, at 6:59 PM, Alexandre Raymond wrote:

> Hi Damjan,
> 
> 
> Can you try applying the following two patches and see if it solves
> your problem?
> 
> http://patchwork.ozlabs.org/patch/100348/
> http://patchwork.ozlabs.org/patch/100477/
> 

Unfortunately same thing happens: segmentation fault.

Thanks,

Damjan
Alexandre Raymond - July 5, 2011, 7:03 p.m.
Hi again Damjan,

On Mon, Jul 4, 2011 at 6:35 PM, Damjan Marion <damjan.marion@gmail.com> wrote:
>
> On Jul 4, 2011, at 6:59 PM, Alexandre Raymond wrote:
>
>> Hi Damjan,
>>
>>
>> Can you try applying the following two patches and see if it solves
>> your problem?
>>
>> http://patchwork.ozlabs.org/patch/100348/
>> http://patchwork.ozlabs.org/patch/100477/
>>
>
> Unfortunately same thing happens: segmentation fault.
You might also want to have a look at the following patches by Paolo:
http://www.mail-archive.com/qemu-devel@nongnu.org/msg67088.html

Finally, you might want to disable io-thead (if you've enabled it),
which doesn't work properly on OS X.

Alexandre
Alexandre Raymond - July 26, 2011, 4:58 a.m.
Hi Damjan,

I've been able to reproduce the crash you're describing.

Could you try the following patch, to see if it solves it?

Alexandre

On Tue, Jul 5, 2011 at 3:03 PM, Alexandre Raymond <cerbere@gmail.com> wrote:
> Hi again Damjan,
>
> On Mon, Jul 4, 2011 at 6:35 PM, Damjan Marion <damjan.marion@gmail.com> wrote:
>>
>> On Jul 4, 2011, at 6:59 PM, Alexandre Raymond wrote:
>>
>>> Hi Damjan,
>>>
>>>
>>> Can you try applying the following two patches and see if it solves
>>> your problem?
>>>
>>> http://patchwork.ozlabs.org/patch/100348/
>>> http://patchwork.ozlabs.org/patch/100477/
>>>
>>
>> Unfortunately same thing happens: segmentation fault.
> You might also want to have a look at the following patches by Paolo:
> http://www.mail-archive.com/qemu-devel@nongnu.org/msg67088.html
>
> Finally, you might want to disable io-thead (if you've enabled it),
> which doesn't work properly on OS X.
>
> Alexandre
>
Paolo Bonzini - July 26, 2011, 8:46 a.m.
On 07/26/2011 06:58 AM, Alexandre Raymond wrote:
> +#ifdef __APPLE__
> +            if (sig == 0) continue;
> +#endif

From looking at the code this should not happen:

http://fxr.watson.org/fxr/source/bsd/kern/kern_sig.c?v=xnu-792#L986

 1046         sigw = (ut->uu_sigwait & siglist);
...
 1053                 signum = ffs((unsigned int)sigw);
 1054                 if (!signum)
 1055                         panic("sigwait with no signal wakeup");
 1056                 ut->uu_siglist &= ~(sigmask(signum));
 1057                 if (uap->sig != USER_ADDR_NULL)
 1058                                 error = copyout(&signum, uap->sig, sizeof(int));

??

Paolo
Alexandre Raymond - July 26, 2011, 1:08 p.m.
Indeed, I'd come to the exact same conclusion, yet I've witnessed it
both in the debugger and with trace messages...

Alexandre

On Tue, Jul 26, 2011 at 4:46 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 07/26/2011 06:58 AM, Alexandre Raymond wrote:
>> +#ifdef __APPLE__
>> +            if (sig == 0) continue;
>> +#endif
>
> From looking at the code this should not happen:
>
> http://fxr.watson.org/fxr/source/bsd/kern/kern_sig.c?v=xnu-792#L986
>
>  1046         sigw = (ut->uu_sigwait & siglist);
> ...
>  1053                 signum = ffs((unsigned int)sigw);
>  1054                 if (!signum)
>  1055                         panic("sigwait with no signal wakeup");
>  1056                 ut->uu_siglist &= ~(sigmask(signum));
>  1057                 if (uap->sig != USER_ADDR_NULL)
>  1058                                 error = copyout(&signum, uap->sig, sizeof(int));
>
> ??
>
> Paolo
>
Alexandre Raymond - July 26, 2011, 2:25 p.m.
On Tue, Jul 26, 2011 at 9:08 AM, Alexandre Raymond <cerbere@gmail.com> wrote:
> Indeed, I'd come to the exact same conclusion, yet I've witnessed it
> both in the debugger and with trace messages...
>
> Alexandre
Note that I don't think that this is a proper patch. I simply want to
verify that it solves the issue encountered by Damjan.
Damjan Marion - July 27, 2011, 1:24 p.m.
Hi Alexandre,

I tried your patch and it works OK.

Then I tried without it and seems that it also works ok. It might be 2 reasons:
 - I upgraded to Mac OS X 10.7 Lion
 - Something changed in qemu master branch

I dont remember what was exact version I used when I reported this problem.

Thanks,

Damjan

On Jul 26, 2011, at 6:58 AM, Alexandre Raymond wrote:

> Hi Damjan,
> 
> I've been able to reproduce the crash you're describing.
> 
> Could you try the following patch, to see if it solves it?
> 
> Alexandre
> 
> On Tue, Jul 5, 2011 at 3:03 PM, Alexandre Raymond <cerbere@gmail.com> wrote:
>> Hi again Damjan,
>> 
>> On Mon, Jul 4, 2011 at 6:35 PM, Damjan Marion <damjan.marion@gmail.com> wrote:
>>> 
>>> On Jul 4, 2011, at 6:59 PM, Alexandre Raymond wrote:
>>> 
>>>> Hi Damjan,
>>>> 
>>>> 
>>>> Can you try applying the following two patches and see if it solves
>>>> your problem?
>>>> 
>>>> http://patchwork.ozlabs.org/patch/100348/
>>>> http://patchwork.ozlabs.org/patch/100477/
>>>> 
>>> 
>>> Unfortunately same thing happens: segmentation fault.
>> You might also want to have a look at the following patches by Paolo:
>> http://www.mail-archive.com/qemu-devel@nongnu.org/msg67088.html
>> 
>> Finally, you might want to disable io-thead (if you've enabled it),
>> which doesn't work properly on OS X.
>> 
>> Alexandre
>> 
> <0001-Darwin-catch-invalid-return-of-sigwait.patch>

Patch

diff --git a/compatfd.c b/compatfd.c
index bd377c4..41586ce 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -29,7 +29,7 @@  static void *sigwait_compat(void *opaque)
     sigset_t all;
 
     sigfillset(&all);
-    sigprocmask(SIG_BLOCK, &all, NULL);
+    pthread_sigmask(SIG_BLOCK, &all, NULL);
 
     while (1) {