qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Michal Novotny <minovotn@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vl.c: Implement SIGILL signal handler for triggering SIGSEGV
Date: Fri, 06 Sep 2013 00:37:34 +0200	[thread overview]
Message-ID: <522907AE.7020804@redhat.com> (raw)
In-Reply-To: <52288696.1010007@redhat.com>

On 09/05/13 15:26, Paolo Bonzini wrote:
> Il 05/09/2013 14:19, Michal Novotny ha scritto:
>> This is the patch to introduce SIGILL handler to be able to trigger
>> SIGSEGV signal in qemu. This has been written to help debugging
>> state when qemu crashes by SIGSEGV as a simple reproducer to
>> emulate such situation in case of need.
> 
> What's wrong with "kill -11" or, within gdb, "j *0x1234"?  Why do you
> need a SIGILL handler for this?  In fact, SIGILL is a pretty bad choice:
> QEMU includes a JIT compiler, so a SIGILL is a relatively common thing
> to happen while debugging it.
> 
> Also:
> 
> (1) there is a known bug in qemu-thread-posix.c, which should not block
> SIGILL, SIGBUS, SIGSEGV, SIGFPE and SIGSYS.  Without fixing that, this
> trick will only work for the iothread and not for the VCPU threads.  If
> you can produce a patch for this, it would be very nice.
> 
>>
>> +    int *p = NULL;
>> +
>> +    *p = 0xDEADBEEF;
> 
> (2) This is undefined behavior.  You probably want something like
> "volatile int *p = (volatile int *)(intptr_t)4;" instead.

What's wrong with raise(SIGSEGV)?

I don't understand the motivation BTW -- what sense does it make to turn
SIGILL into SIGSEGV?

If someone just wants to force a "coredump due to signal" interactively,
SIGQUIT was invented *exactly* for that. You can even send it from the
controlling terminal directly, with Ctrl-\. (More precisely, by entering
QUIT character, see eg. the stty manual.)

(Also, in this specific case it would be no problem if all but one
threads blocked SIGQUIT -- the terminal driver or the "kill" utility
would generate the signal for the entire process, not a specific thread,
and then the signal would be delivered to some thread among those
threads that are not blocking the signal.)

Laszlo

  reply	other threads:[~2013-09-05 22:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 12:19 [Qemu-devel] [PATCH] vl.c: Implement SIGILL signal handler for triggering SIGSEGV Michal Novotny
2013-09-05 13:26 ` Paolo Bonzini
2013-09-05 22:37   ` Laszlo Ersek [this message]
2013-09-05 22:50 ` Anthony Liguori
2013-09-05 23:06   ` Eric Blake
2013-09-06 13:24   ` Michal Novotny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=522907AE.7020804@redhat.com \
    --to=lersek@redhat.com \
    --cc=minovotn@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).