From: Richard Purdie <rpurdie@rpsys.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix page protection flag handling solving ARM emulation issues
Date: Wed, 23 Apr 2008 14:48:36 +0100 [thread overview]
Message-ID: <1208958516.4988.30.camel@dax.rpnet.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]
Hi,
I've been seeing some strange errors when trying to mix binaries from
two different ARM toolchains. They work on real hardware but they don't
work under qemu failing with an error about being unable to change the
stack area protection bits. I tracked this down to an mprotect call
failing inside the dynamic linker.
The reason is that ARM has some strange page protection bits (from
mman.h):
#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
growsdown vma (mprotect only). */
#define PROT_GROWSUP 0x02000000 /* Extend change to start of
growsup vma (mprotect only). */
and if qemu sees these as page protection flags it gets rather upset.
A fix is to:
a) not error if these bits are present
b) not pass them to the host system since that doesn't like them
I've attached a simple patch which fixes the ARM on x86 case. This
shouldn't break anything existing although some tweaking of the bits may
be needed for some mixtures of other architectures.
Regards,
Richard
[-- Attachment #2: fix_protection_bits.patch --]
[-- Type: text/x-patch, Size: 513 bytes --]
Index: qemu-0.9.1/linux-user/mmap.c
===================================================================
--- qemu-0.9.1.orig/linux-user/mmap.c 2008-04-16 14:10:26.000000000 +0100
+++ qemu-0.9.1/linux-user/mmap.c 2008-04-16 14:10:51.000000000 +0100
@@ -49,8 +49,7 @@
end = start + len;
if (end < start)
return -EINVAL;
- if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
- return -EINVAL;
+ prot = prot & (PROT_READ | PROT_WRITE | PROT_EXEC);
if (len == 0)
return 0;
reply other threads:[~2008-04-23 13:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1208958516.4988.30.camel@dax.rpnet.com \
--to=rpurdie@rpsys.net \
--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).