From patchwork Tue Mar 30 18:53:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 49416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DA6C3B7CF0 for ; Tue, 6 Apr 2010 04:05:56 +1000 (EST) Received: from localhost ([127.0.0.1]:40448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NyqgM-0006ZJ-91 for incoming@patchwork.ozlabs.org; Mon, 05 Apr 2010 14:05:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NyqEr-0003Fx-4F for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:29 -0400 Received: from [140.186.70.92] (port=47514 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NyqEn-0003Dz-TF for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NyqEl-0001Cb-BI for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:25 -0400 Received: from are.twiddle.net ([75.149.56.221]:60867) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NyqEl-0001CJ-5F for qemu-devel@nongnu.org; Mon, 05 Apr 2010 13:37:23 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 8E3B9D5F; Mon, 5 Apr 2010 10:37:21 -0700 (PDT) Message-Id: <6dc67394a20af270ba268a5471aef3c8275c1cdf.1270488612.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Tue, 30 Mar 2010 11:53:31 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: blauwirbel@gmail.com Subject: [Qemu-devel] [PATCH 5/7] linux-user: Use guest_start_len_valid in mmap. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Richard Henderson --- linux-user/mmap.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 463679d..085030b 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -494,12 +494,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, end = start + len; real_end = HOST_PAGE_ALIGN(end); - /* - * Test if requested memory area fits target address space - * It can fail only on 64-bit host with 32-bit target. - * On any other target/host host mmap() handles this error correctly. - */ - if ((unsigned long)start + len - 1 > (abi_ulong) -1) { + /* Test if requested memory area fits target address space. */ + if (!guest_start_len_valid(start, len)) { errno = EINVAL; goto fail; }