Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FaeUR-0002wB-VC for qemu-devel@nongnu.org; Mon, 01 May 2006 15:55:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FaeUP-0002vz-3i for qemu-devel@nongnu.org; Mon, 01 May 2006 15:55:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FaeUO-0002vw-UE for qemu-devel@nongnu.org; Mon, 01 May 2006 15:55:24 -0400 Received: from [212.247.154.204] (helo=swip.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FaeUO-0005zc-Gq for qemu-devel@nongnu.org; Mon, 01 May 2006 15:55:24 -0400 Received: from d213-103-35-236.cust.tele2.fr ([213.103.35.236] verified) by mailfe07.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 189238834 for qemu-devel@nongnu.org; Mon, 01 May 2006 21:53:52 +0200 From: Even Rouault Date: Mon, 1 May 2006 21:53:50 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_PdmVEWM4tEU9gJj" Message-Id: <200605012153.51699.even.rouault@mines-paris.org> Subject: [Qemu-devel] bug report : kqemu and self-writing code Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_PdmVEWM4tEU9gJj Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Guest OS : Linux 2.6.15-1.2054_FC5 i686 (Fedora Core 5 i386) Host OS: Linux 2.6.12-10-amd64-k8 #1 x86_64 (Ubuntu 5.10 amd64) QEMU Version : today CVS compiled with kqemu support KQEMU : 1.3.0pre6 Binary used : qemu-system-x86-64 (so kqemu user-mode is used) I'm running the simple C code attached. With kqemu user-mode, this fails (sigsegv) with the following warning in dmesg : audit(1146505373.813:12): avc: denied { execheap } for pid=1860 comm="selfmodifying scontext=user_u:system_r:unconfined_t:s0 tcontext=user_u:system_r:unconfined_t:s0 tclass=process Erreur de segmentation Without kqemu enabled, it runs fine. --Boundary-00=_PdmVEWM4tEU9gJj Content-Type: text/x-csrc; charset="us-ascii"; name="selfmodifying.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="selfmodifying.c" #define _XOPEN_SOURCE 600 #include #include #include #include int main(int argc, char** argv) { int pagesize = getpagesize(); unsigned char* addr = NULL; posix_memalign((void**)&addr, pagesize, pagesize); mprotect(addr, pagesize, PROT_WRITE | PROT_READ | PROT_EXEC); addr[0] = 0x8b; addr[1] = 0x44; addr[2] = 0x24; addr[3] = 0x04; /* mov 0x4(%esp),%eax */ addr[4] = 0x83; addr[5] = 0xc0; addr[6] = 0x01; /* add $0x1,%eax */ addr[7] = 0xc3; /* ret */ printf("10+1=%d\n", ((int (*)(int))addr)(10)); free(addr); return 0; } --Boundary-00=_PdmVEWM4tEU9gJj--