qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Ignore PROT_GROWSDOWN and PROT_GROWSUP
@ 2007-07-02 12:23 Alexander Graf
  0 siblings, 0 replies; only message in thread
From: Alexander Graf @ 2007-07-02 12:23 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

In an mprotect call the flags PROT_GROWSDOWN and PROT_GROWSUP can be
defined. Currently qemu returns an EINVAL as soon as one of these is
found, which breaks some programs (especially mplayer).
As far as I can tell it is safe to ignore these flags and just go on as
if nothing happened. To be on the safe side a warning message to the
user is thrown though.

Is there anything wrong with ignoring these? Should they be implemented
properly? Comments appreciated.

Alex


[-- Attachment #2: qemu-cvs-mprotect.patch --]
[-- Type: text/x-patch, Size: 658 bytes --]

Index: qemu/linux-user/mmap.c
===================================================================
--- qemu.orig/linux-user/mmap.c
+++ qemu/linux-user/mmap.c
@@ -48,8 +48,10 @@ int target_mprotect(target_ulong start, 
     end = start + len;
     if (end < start)
         return -EINVAL;
-    if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
-        return -EINVAL;
+    if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) {
+	gemu_log("WARNING: dirty hack in mprotect: setting prot (%#x -> %#x)\n", prot, prot & (PROT_READ | PROT_WRITE | PROT_EXEC));
+        prot &= (PROT_READ | PROT_WRITE | PROT_EXEC);
+    }
     if (len == 0)
         return 0;
     

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-02 12:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-02 12:23 [Qemu-devel] [PATCH] Ignore PROT_GROWSDOWN and PROT_GROWSUP Alexander Graf

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).