From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I5KuH-0006zu-JN for qemu-devel@nongnu.org; Mon, 02 Jul 2007 08:21:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I5KuF-0006zi-6m for qemu-devel@nongnu.org; Mon, 02 Jul 2007 08:21:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5KuF-0006zf-0N for qemu-devel@nongnu.org; Mon, 02 Jul 2007 08:21:27 -0400 Received: from mx2.suse.de ([195.135.220.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I5KuE-0001Qj-KJ for qemu-devel@nongnu.org; Mon, 02 Jul 2007 08:21:26 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 9D0DE2158A for ; Mon, 2 Jul 2007 14:21:20 +0200 (CEST) Message-ID: <4688EE56.7040505@suse.de> Date: Mon, 02 Jul 2007 14:23:50 +0200 From: Alexander Graf MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090606020800020308090603" Subject: [Qemu-devel] [PATCH] Ignore PROT_GROWSDOWN and PROT_GROWSUP 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 This is a multi-part message in MIME format. --------------090606020800020308090603 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------090606020800020308090603 Content-Type: text/x-patch; name="qemu-cvs-mprotect.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-cvs-mprotect.patch" 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; --------------090606020800020308090603--