From patchwork Tue Sep 3 16:08:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172881 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp105711ily; Tue, 3 Sep 2019 09:49:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb1aW+tnoG8+RIHTY/yuSC/D2/Ar7wtVBbpeMTpVK+lqmdino+/+Qgg520ucceVM1gl583 X-Received: by 2002:ac8:44d4:: with SMTP id b20mr9610416qto.357.1567529377997; Tue, 03 Sep 2019 09:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567529377; cv=none; d=google.com; s=arc-20160816; b=gE4iFMRtlipETXiX37Z6JJZqDIThEcw7o1EYQ5/OOH6M1ASGsBtuRKOPD75c1vyZl6 q9gdmwaTUfeVROi5au1FJCw9u610B71BbkcvMh1PdqKTneDu9o+V7WeDCyoCMNC0xTAf FJGwqz4juTZrgWn5LwgWSs8s20CfgFGAhmIm9zQQh/XrgHYH3c1spBowrI9y4MYCHiq4 qakZu2og3ZdQnqy/eu3/gtKOmj3u6RG82laH7RstD5/nB9KjDJttJydyoSRiuDTmCyTM Si/zYo0fE88gNEZH9Rotszu6ymcJuReWYkczUJttBc2GA1CamjroTrHji6DCsQeXiORP GcGQ== 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=qb+ujYL2F+DwauWM58yFrqxB8nQIAn+bvj1URM0E/1A=; b=omKKHNduIyGWhbvr70DQyPYct/tWH1BiQ0jVGF2GtY7wH1ROqEvqmumGL+haVZlpUc H7AEioKBudYtwjGTC5ArWX2a+XOMGw0CgTKKFCgprq1+iR4akzFVnfTgeEKuSLZUc6j8 QqEOfjxayVjz207p2JUv7yO/StY4LlUp+AjMn9oWYiE+WoQr9ZoOS5tqNYOtFsE8jYMt ov40OoyUcwPR8x2vm0bQDYm8q7Hoz/838+fGcE0GXvNRK7eX2QmSzbp1bd5WyFjYZk1L qmxoqJjRhVVxP6+HGspobTaGOphsqn4bvpOPlAc8zepr71eaX81cKRkvJ6UhiY3EyL5W +mzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=izdtibyB; 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 o8si12969516qkg.41.2019.09.03.09.49.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 09:49:37 -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=izdtibyB; 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]:49284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Bzt-0003so-3T for patch@linaro.org; Tue, 03 Sep 2019 12:49:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37436) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BNC-0001dk-B0 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5BNB-0003zi-9J for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:38 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:46267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5BNB-0003z4-3v for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:37 -0400 Received: by mail-pg1-x52f.google.com with SMTP id m3so9372502pgv.13 for ; Tue, 03 Sep 2019 09:09:37 -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=qb+ujYL2F+DwauWM58yFrqxB8nQIAn+bvj1URM0E/1A=; b=izdtibyB5ELd5XFmw6SM8+8NHJ9yQFyZQYQiOZuXek3o0WFC2VT07MLoBK+MrJD/Yo IsRwHWkRBj/qpnpuCh4HD5yXJIwHKlplGFWdIri8MsEXpYoJXkwXw5Szv0WUop5qzSTk TCTrZ2Zk9Rat7GU7slX0zSVm2jmBuUWNNv/VntvnHF7yEqx7zjdvLtUQ2UeJGRICwsUG K90LjedCbYBskr1fSW7vBMUkhUtCs0R1JFH4aG4X89KBh3axYRWR4D3vcJFKr01CWc5Y oc/ns6fRz7KY1/DZJJOQUm9NZAZeP/btqCkfEx4stW2UIEuGs9RYUpA54FvJ3/xGNXLG kqyg== 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=qb+ujYL2F+DwauWM58yFrqxB8nQIAn+bvj1URM0E/1A=; b=ljGl3OkPlHMC61wfPXKiDRWULcoIxwf9M32gUz8SJvE01UW7pQvpVAJ2s6oQD4UEP9 6vvUYEVlo6JkI9cieX3ivQYgwnoB+d52EPgJNpUSjOnaJt2QavBQHTreug73qqHqcEwn YiH3qGh/4GWz4Jr7fekMvyxSJfP/Pned/YDaPMAELRsklLC8INOPAjXrurIcXtEU7KzP 43Z8UygZahWBX8/YH+RxUscd11u0yssUpb8/pmtW0R4O0AJ463PZ1MGTAtyNIhUReWu4 IMk/yMKLRqFYatFWDVdEIVNFB9bdqB08jmhnOQIPG81tW6ozrM6740sJZ+Y98yE2ulWG XkSA== X-Gm-Message-State: APjAAAUmTffbjAgsUsQFEkiWsoOfPvm6Omn7xyb//Jshrm5ccd6vy2ku 329E/j4vJ+wi9wbHHR2aObC3ecQTWpk= X-Received: by 2002:a62:f80a:: with SMTP id d10mr2891158pfh.98.1567526975855; Tue, 03 Sep 2019 09:09:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:09:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 09:08:51 -0700 Message-Id: <20190903160858.5296-30-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::52f Subject: [Qemu-devel] [PATCH 29/36] s390x/tcg: Fix length calculation 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 Hm... how did that "-" slip in (-TAGRET_PAGE_SIZE would be correct). This currently makes us exceed one page in a single probe_write() call, essentially leaving some memory unchecked. 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-3-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 7819aca15d..4b43440e89 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -2623,7 +2623,7 @@ void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, #else /* test the actual access, not just any access to the page due to LAP */ while (len) { - const uint64_t pagelen = -(addr | -TARGET_PAGE_MASK); + const uint64_t pagelen = -(addr | TARGET_PAGE_MASK); const uint64_t curlen = MIN(pagelen, len); probe_write(env, addr, curlen, cpu_mmu_index(env, false), ra);