qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Ignore PROT_GROWSDOWN and PROT_GROWSUP
Date: Mon, 02 Jul 2007 14:23:50 +0200	[thread overview]
Message-ID: <4688EE56.7040505@suse.de> (raw)

[-- 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;
     

                 reply	other threads:[~2007-07-02 12:21 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=4688EE56.7040505@suse.de \
    --to=agraf@suse.de \
    --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).