From patchwork Tue Sep 3 16:08:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172856 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp96689ily; Tue, 3 Sep 2019 09:41:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8U5LQFBnX7uhttOxc6pfN4zc931VWfNuDmEMvK7BD2jV8kzVV2t6jy4FdL6t6RI/aDWx8 X-Received: by 2002:ad4:5288:: with SMTP id v8mr22300860qvr.159.1567528900155; Tue, 03 Sep 2019 09:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567528900; cv=none; d=google.com; s=arc-20160816; b=TYwygyyhR4PeTSptbBfJVqmZV1fHM51w3UBZZqi6IDcvTlulpoVQca836xt4wkxCk2 W5szAHGZ5YUo+nsI9iLvVEAyCTBM5lvA/GaI2keCz5S9wf+KIN+6/0ML+6pAjEYDV5gP QCLsXxBnyOf/CeRLmNLthSolgcIRNUdTSZJsVTlgV5QB5Oh0FFmVFwIaobw1zckFcDtS 1OP9w/FHfOPiw6F8+c6qK62ETxtaXv85gnTYANawtDHTIWwANciTCFP7Ts52zWffBJUV HlQhINz2exLVRYlInXcOQU9FLCt6nLoDPeqegZFnL3O1o1socb6rjcquiwwG3hoWqM+C 6mMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ojSV1KHJRFOmyFtfduQlUjdioBteKBK+7oTZZ6njL2U=; b=AEFO4rNxz6tfQsLvH2stcAl/vaGvB3aDeBzHPd4sdkKmcEkTTvn9MK2XbtfyJonMGX Klixsr4DEw1zqnfIHL33VNkVG8FRge73ikf9xWxEA/SysFIC7MQTwVWSrI12fKoVnSVv o/MF4eJMxSTuioMM7W2hjmRthgtdCPbOv+XMMOulxNv6QUDK8NJC4ULTfZm5+n65OHEU VaVwTxUhLEs7Gf41psvmZ3XGsbbHWQsGzyMsEUIyahmcteHVE1HNQFz9gjJl7gBajTJu UdOExI2Fx5BhguRZOW6EI5Fgcw+8iFED5GsQ6XtzsfRBIT1hm726gNxAVgM1lugYtYeT G8kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WVuL41hg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 33si6598978qvx.104.2019.09.03.09.41.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 09:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WVuL41hg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BsB-00033k-0S for patch@linaro.org; Tue, 03 Sep 2019 12:41:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37420) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BNB-0001c8-AL for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5BNA-0003yn-AC for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:37 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:36995) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5BNA-0003y2-2t for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:36 -0400 Received: by mail-pg1-x52e.google.com with SMTP id d1so9401843pgp.4 for ; Tue, 03 Sep 2019 09:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ojSV1KHJRFOmyFtfduQlUjdioBteKBK+7oTZZ6njL2U=; b=WVuL41hg93slnIHJ4d59nc6vn4MZqQJ1LislX2APCainrVYohko0MQ52VI1h7l14oo lutgHvTi0fzxZ39XminusWgPeRq1FBYSaRgKCt6bQxOsAs1B3s6uypcRKJi8+CHHfgdO aPXFmacJHuyMOdT1O5O86yn9pud64U7o6iDCjCDjkfSPr3PBvSz7gmgQTYOMvjOvjtp0 YGSazNS0W+Rjy/S9ZmxObkNYHlbRZE/LSIeoqdQs+RURCdHMowXRoKYVmD8dhzBVJH1B 9xKHkvuykLLmAHmhAXQj278s+/89tQriHX7bUSKQCY/qDRB6CYm2UinB0NpAXwfns7S9 c9yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ojSV1KHJRFOmyFtfduQlUjdioBteKBK+7oTZZ6njL2U=; b=N4YHEAfdwKXpw2T3Yg7elGsOnsV7VFTcPTIVEeRhgjzGMKTlti6v4MOSR/ifuVAbkn 897/8nwgjL9xuvbIFaeB8wX0HEgARAC6TKwaNHSQC1VeqVwY+fuo6eATL5eINQFfHSgC 1JUY+YPpQp+u6NXtGYVXmCz97B73/R1lktgqRibG04m/b0PHRWXnRXdvqbg6cZTNXBk6 GCrjANC8qvP/dRDXCI62MICqJ8A129gWR8b8osoEuOWDz7POaR7/+Uitf0khXniLlKgx lgo62//4Ayw2+LZUI+l2coV1IyfyMMrgVzIwB0KN61Efq4Vj4/dF+wXqBEkERpJVKU7n OCOg== X-Gm-Message-State: APjAAAU84I1PnZ4AeIsDDhdiVNWChY0kUZR/n/AHcjDnwfjT6ECHbKAP m4Wquuzl/mlGO8Enoap6Ya93AWQRxak= X-Received: by 2002:a62:6045:: with SMTP id u66mr40214582pfb.261.1567526974873; Tue, 03 Sep 2019 09:09:34 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 127sm28089711pfy.56.2019.09.03.09.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:09:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 09:08:50 -0700 Message-Id: <20190903160858.5296-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903160858.5296-1-richard.henderson@linaro.org> References: <20190903160858.5296-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::52e Subject: [Qemu-devel] [PATCH 28/36] s390x/tcg: Use guest_addr_valid() instead of h2g_valid() in probe_write_access() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand If I'm not completely wrong, we are dealing with guest addresses here and not with host addresses. Use the right check. Fixes: c5a7392cfb96 ("s390x/tcg: Provide probe_write_access helper") Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck Message-Id: <20190826075112.25637-2-david@redhat.com> Signed-off-by: Richard Henderson --- target/s390x/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 91ba2e03d9..7819aca15d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -2616,7 +2616,7 @@ void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, uintptr_t ra) { #ifdef CONFIG_USER_ONLY - if (!h2g_valid(addr) || !h2g_valid(addr + len - 1) || + if (!guest_addr_valid(addr) || !guest_addr_valid(addr + len - 1) || page_check_range(addr, len, PAGE_WRITE) < 0) { s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); }