From patchwork Fri Apr 6 16:35:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 151248 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 27505B7098 for ; Sat, 7 Apr 2012 05:06:07 +1000 (EST) Received: from localhost ([::1]:58476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGEU0-0005i1-Se for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2012 15:06:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGCD7-00032I-M5 for qemu-devel@nongnu.org; Fri, 06 Apr 2012 12:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGCD2-0005ze-5B for qemu-devel@nongnu.org; Fri, 06 Apr 2012 12:40:29 -0400 Received: from afflict.kos.to ([92.243.29.197]:59851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGC89-0004wh-TB for qemu-devel@nongnu.org; Fri, 06 Apr 2012 12:35:22 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id D48C526539; Fri, 6 Apr 2012 16:35:17 +0000 (UTC) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2012 19:35:09 +0300 Message-Id: <39879bbbea4661a4004ca26673e3d1e6ae1e0bc3.1333729958.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 X-Mailman-Approved-At: Fri, 06 Apr 2012 15:05:48 -0400 Cc: Alexander Graf Subject: [Qemu-devel] [PATCH 09/17] 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 From: Alexander Graf 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 Signed-off-by: Riku Voipio --- cpu-all.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index 9621c3c..4512518 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