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: 1075312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="B90uKOmq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44YsR1262bz9sPJ for ; Wed, 3 Apr 2019 14:44:58 +1100 (AEDT) Received: from localhost ([127.0.0.1]:51133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBWpc-0002dR-CC for incoming@patchwork.ozlabs.org; Tue, 02 Apr 2019 23:44:56 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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);