From patchwork Thu Feb 2 02:19:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F0055B6F99 for ; Thu, 2 Feb 2012 13:19:20 +1100 (EST) Received: from localhost ([::1]:33625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsmGa-0002zN-PY for incoming@patchwork.ozlabs.org; Wed, 01 Feb 2012 21:19:16 -0500 Received: from eggs.gnu.org ([140.186.70.92]:40249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsmGV-0002z0-US for qemu-devel@nongnu.org; Wed, 01 Feb 2012 21:19:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsmGU-0006eP-Kc for qemu-devel@nongnu.org; Wed, 01 Feb 2012 21:19:11 -0500 Received: from cantor2.suse.de ([195.135.220.15]:50071 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsmGU-0006cy-F4 for qemu-devel@nongnu.org; Wed, 01 Feb 2012 21:19:10 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 645508FFDD; Thu, 2 Feb 2012 03:19:09 +0100 (CET) From: Alexander Graf To: qemu-devel Developers Date: Thu, 2 Feb 2012 03:19:08 +0100 Message-Id: <1328149148-13422-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: riku.voipio@linaro.org Subject: [Qemu-devel] [PATCH] linux-user: take RESERVED_VA into account for g2h_valid() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When running with -R (RESERVED_VA > 0) all guest virtual addresses are within the [0..RESERVED_VA] range. Reflect this with g2h_valid() too so we can safely check for boundaries of our guest address space. This is required to have the /proc/self/maps code not show maps that aren't accessible from the guest process's point of view. Signed-off-by: Alexander Graf --- cpu-all.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index e2c3c49..d42a06e 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -204,7 +204,8 @@ extern unsigned long reserved_va; #else #define h2g_valid(x) ({ \ unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \ - __guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS); \ + (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \ + (!RESERVED_VA || (__guest < RESERVED_VA)); \ }) #endif