From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuWAq-0008Qx-Fa for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:46:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuWAo-0008QF-2e for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:46:39 -0400 Received: from [199.232.76.173] (port=55445 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuWAo-0008Q8-0J for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:46:38 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]:5803) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KuWAn-0007Tm-KU for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:46:37 -0400 Received: by ug-out-1314.google.com with SMTP id 17so345542ugm.14 for ; Mon, 27 Oct 2008 10:46:35 -0700 (PDT) From: "Kirill A. Shutemov" Date: Mon, 27 Oct 2008 19:48:11 +0200 Message-Id: <1225129691-11566-1-git-send-email-kirill@shutemov.name> In-Reply-To: <1224225264-8483-1-git-send-email-kirill@shutemov.name> References: <1224225264-8483-1-git-send-email-kirill@shutemov.name> Subject: [Qemu-devel] [PATCH, v2] mmap: add check if requested memory area fits target address space 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 Cc: "Kirill A. Shutemov" Signed-off-by: Kirill A. Shutemov --- linux-user/mmap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 6677014..b420065 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -388,6 +388,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, end = start + len; real_end = HOST_PAGE_ALIGN(end); + if ((unsigned long)start + len - 1 > (abi_ulong) -1) { + errno = EINVAL; + goto fail; + } + for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) { flg = page_get_flags(addr); if (flg & PAGE_RESERVED) { -- 1.6.0.2.GIT