From: Eric Blake <eblake@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Michal Novotny <minovotn@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] vl.c: Implement SIGILL signal handler for triggering SIGSEGV
Date: Thu, 05 Sep 2013 17:06:58 -0600 [thread overview]
Message-ID: <52290E92.20601@redhat.com> (raw)
In-Reply-To: <CA+aC4kuPq7dyWYdp06qRC=-Hvn0iCaH=jLt4TpCKg-fez75KBA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
On 09/05/2013 04:50 PM, Anthony Liguori wrote:
>> + int *p = NULL;
>> +
>> + *p = 0xDEADBEEF;
>
> I won't repeat the questions from Paolo and Lazlo (I share their
> confusion) but will simply add that you cannot rely on NULL address
> accessing causing a SEGV. Even with all the use of volatile in the
> world, there's no guarantee this is going to crash.
If you want to guarantee that a write would cause a SEGV, then you have
to use mmap(MAP_ANONYMOUS|MAP_PRIVATE) + mprotect(PROT_NONE) to get a
valid unwritable pointer that will reliably fault, rather than hoping
that NULL (or any other low-valued intptr_t cast to void*) is
sufficiently protected. But I also echo the question: why is raise()
insufficient?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-09-05 23:07 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
2013-09-05 22:50 ` Anthony Liguori
2013-09-05 23:06 ` Eric Blake [this message]
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=52290E92.20601@redhat.com \
--to=eblake@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=minovotn@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).