From patchwork Wed Apr 3 03:43:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10882631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E91E51669 for ; Wed, 3 Apr 2019 03:45:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D241E289A2 for ; Wed, 3 Apr 2019 03:45:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C64FF289B9; Wed, 3 Apr 2019 03:45:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79619289A2 for ; Wed, 3 Apr 2019 03:45:30 +0000 (UTC) Received: from localhost ([127.0.0.1]:51514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBWq9-0003qZ-K5 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 02 Apr 2019 23:45:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBWoo-0002c4-P4 for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBWon-0007mW-SY for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:06 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:37469) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBWon-0007lf-Lo for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:05 -0400 Received: by mail-pl1-x644.google.com with SMTP id w23so4370461ply.4 for ; Tue, 02 Apr 2019 20:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=eEcb3jpHhBL5V4XKribm6nF4P3y4UD0GK5XfT/XCp8U=; b=B90uKOmqgF7EsJHr8jSCfUoZlwOmSDsOZZtu6n0roECm9uhF5MwZQEW/64NwI9+LU8 e0+YUXJh2N9qzqCCZEZyZXmtjw601kvBv43pZM1CiepuZAm2C2LT/QLuglE9g6r93275 pp5tsptbbK8+x5KHBosJhGSZE8IFY6Lq0tyCOQkw5DbffPsnH4JtSaJ5PMA0NzXrZ6Al F2Bmw/HCk2t9O2Kb14udtmaK1ydmxcf+9uKvjQTE7Tov2uKjgocLkNPxeV8d3sqrjuan QN1VjGYe5n0mCia7Gxa1Z/zJPt9w8gu0H36NtYc5Kl+N7yWsD5E03oUhXUBiFLbmd6pZ fHqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=eEcb3jpHhBL5V4XKribm6nF4P3y4UD0GK5XfT/XCp8U=; b=ZNoMOUXfjVT3HPQ2eEViaRA2/9wm1NR1QSKsNP3c/4rneac50td0R1KJTICAQGiRqn YyhNswATuQaXuMiYqDDgbpzG6Ty9IX/sn0f1yxL+OQ43/Sk25ubfdhPSEbOAuRbviuQf EFkD+MMmiJ5GMsUMHVCJJYZ+n1+kWUHHrhE54Q4GqCnnKma8Jdd1Dco6ywROpqREixj2 +UGI/N8h14mNRUYVDd3lJ8GFvaHIRWdF1hzcF08bTs5/u1WNA1AViBc/76Ee3T4NNdUp g1wqICkFMFCG34KeH9ToO3lJRu2ONleK/lR24oQbIY1DNdMVEn0kEbDk3Sgy5xWNt1OE KbmA== X-Gm-Message-State: APjAAAWHtveauEHGUpyGZm9q0JG17jQxsHlJDkbN6XH2h9VmI+TdsFQ/ 1rgxnxGskEffLFXglVjYf0FpPt7u8DuH1g== X-Google-Smtp-Source: APXvYqxHNoo1OGMoBga8gXSx2GmDGLfgLuUQMnJMLrRffRppt994bMDvW/iSZokYDe8ziicfnZ98iQ== X-Received: by 2002:a17:902:2bab:: with SMTP id l40mr74190163plb.273.1554263044391; Tue, 02 Apr 2019 20:44:04 -0700 (PDT) Received: from cloudburst.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id z6sm26753214pgo.31.2019.04.02.20.44.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 20:44:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 10:43:33 +0700 Message-Id: <20190403034358.21999-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190403034358.21999-1-richard.henderson@linaro.org> References: <20190403034358.21999-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH 01/26] tcg: Assert h2g_valid for 32-bit guest on 64-bit host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For this combination, we can tell whether or not the address being accessed is within the 4GB range that is accessible by the guest. Otherwise the fault must be elsewhere in qemu, accessing qemu data structures. Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 0789984fe6..fa9380a380 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -143,6 +143,15 @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info, } } + /* + * For a 32-bit guest on a 64-bit host, the set of addresses that we + * access on behalf of the guest is constrained. Anything outside + * that range is a bug elsewhere in QEMU. + */ +#if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 64 + g_assert(h2g_valid(address)); +#endif + /* Convert forcefully to guest address space, invalid addresses are still valid segv ones */ address = h2g_nocheck(address);