From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHidm-0001a2-Ne for qemu-devel@nongnu.org; Thu, 05 Sep 2013 19:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHidg-00054l-NJ for qemu-devel@nongnu.org; Thu, 05 Sep 2013 19:07:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13950) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHidg-00054f-Ei for qemu-devel@nongnu.org; Thu, 05 Sep 2013 19:07:00 -0400 Message-ID: <52290E92.20601@redhat.com> Date: Thu, 05 Sep 2013 17:06:58 -0600 From: Eric Blake MIME-Version: 1.0 References: <5824aebefdadb9beb24cda3fab0398931bedbfb1.1378383549.git.minovotn@redhat.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jCW4EdMflpf2BB5Lj1B9Jso6Iw14G0W8j" Subject: Re: [Qemu-devel] [PATCH] vl.c: Implement SIGILL signal handler for triggering SIGSEGV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Michal Novotny , qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jCW4EdMflpf2BB5Lj1B9Jso6Iw14G0W8j Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/05/2013 04:50 PM, Anthony Liguori wrote: >> + int *p =3D NULL; >> + >> + *p =3D 0xDEADBEEF; >=20 > 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? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jCW4EdMflpf2BB5Lj1B9Jso6Iw14G0W8j Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSKQ6SAAoJEKeha0olJ0NqN4UH/i/cvtr75vXgylv4ujeFpbUj MrwwiqkYP4AeHSXchowqREK9+rqmQRXMR+idCKC7qWJAxHMYMOMtc2PhQckGOgXh fzXW+UaYiCyjZ9Y90NiweJgOn1Mx858UeCCCg/8XavLQLbWMuZI74sy1tZ3J5PyG ZCRWZcpBPdO5VKWIgkbWWdVx2hHXfS5J8tCVRA0XS4YiNHLB+Jp55I4YGbzTLYiU hyZKKkiS4oGOq4tfUIrVxDvL+3iSyJ3QkVgryZQpt5Sn1vX1j21nvfvSOgctzSBp SDZTcxedUxytQoqa74hUZHH4crhp8PLa6ekV0NPd8DZIv+U8pHiSkoX3VIjzkwk= =rpby -----END PGP SIGNATURE----- --jCW4EdMflpf2BB5Lj1B9Jso6Iw14G0W8j--