Skip to contentSkip to conversation

mprotect in guest makes qemu-i386 crash

Qemu-devel Jan Kiszka 1 participant 2 messages Jul 3, 2008 – Jul 7, 2008

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi,

this fragment from a code self-modification test of mine used to work a few weeks ago with qemu-i386 userspace emulation. Now it causes a segfault.

#include <sys/mman.h>
main()

{
	mprotect((void *)((unsigned long)main & ~0xfff), 0x1000,
		 PROT_READ|PROT_WRITE|PROT_EXEC);
}

qemu-x86_64 even complains about an "Unsupported syscall: 221", while the same 64-bit binary works fine with 0.9.1 (I don't recall anymore if it worked recently with SVN head).

Anyone some idea? Known issue?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
author
#1 lore raw
Quoted 7 lines · Jan Kiszka

Hi,

this fragment from a code self-modification test of mine used to work a few weeks ago with qemu-i386 userspace emulation. Now it causes a segfault.

#include <sys/mman.h>
main()

Quoted 8 lines
{
	mprotect((void *)((unsigned long)main & ~0xfff), 0x1000,
		 PROT_READ|PROT_WRITE|PROT_EXEC);
}

qemu-x86_64 even complains about an "Unsupported syscall: 221", while the same 64-bit binary works fine with 0.9.1 (I don't recall anymore if it worked recently with SVN head).

Some clarification: mprotect is fine with qemu-x86_64, that syscall warning is another, unrelated issue (it pops up with every x86_64 application in userland emu).

That leaves us with mprotect being broken in qemu-i386 on x86_64 hosts.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux