From nobody Mon Nov 10 22:28:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1559836140; cv=none; d=zoho.com; s=zohoarc; b=OGQ/w9QzMpy1Oiu1+wg8AuZxDUg1D8sEUypU1gPyvSpC2Omvzbu+JNjYy+FgUZigCv+fHASZYjeju9Ib7MaWvFGpafK26Yn92rX6I1qw7JPyIaze4qUTObaXw6hrAKr/PMjerCq4oMMzFu5kbujfFQCnSMA/ChAcOh7mGCfEWS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559836140; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=LqSNzOPOVJw9rsvpaWin3k5tpPNT/bVkcPC7OHiBDoM=; b=IX+9wAvpqViOUEvMYEF25ISKcH7hzrkz2RgV9/9+zWM6W3AMRd+bwzfwmQ3Qcw7s9Qr8kjdVfIEvJynBi6pUhvucJoikXtlkll7pRre78lItVoxUtZCW1mIbtq/Bv9Fa4FCYQch4sssljUauvHm3Dows5R/vQEfo2d7NrNI9LIQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559836140156655.0053063587815; Thu, 6 Jun 2019 08:49:00 -0700 (PDT) Received: from localhost ([127.0.0.1]:34262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYudL-00063l-6D for importer@patchew.org; Thu, 06 Jun 2019 11:48:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYuXw-0001s9-Js for qemu-devel@nongnu.org; Thu, 06 Jun 2019 11:43:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYuXv-0001JV-Kx for qemu-devel@nongnu.org; Thu, 06 Jun 2019 11:43:20 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35380) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYuXv-0001Gp-C1 for qemu-devel@nongnu.org; Thu, 06 Jun 2019 11:43:19 -0400 Received: by mail-wr1-x442.google.com with SMTP id m3so2961432wrv.2 for ; Thu, 06 Jun 2019 08:43:19 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z14sm2133483wrh.86.2019.06.06.08.43.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 08:43:17 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A4D4B1FF87; Thu, 6 Jun 2019 16:43:16 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LqSNzOPOVJw9rsvpaWin3k5tpPNT/bVkcPC7OHiBDoM=; b=S9vg+zVS7tzYjM3haTyt3+QOFA8EJhYMMbIJ7G+d4WZomkI7MR8hg4oxVkK+AvLVvS ND6fbQxKR135zXta70D8HU4//+jhHCjXksRRQgiKuPZkcdRfmRzxBgUIkLu5MZ4G+QTa Ky5bGozNzwovEHvfzTY59lYz02dtSEXh9wNjLvFddP59GPjPKJ6fsiQmZ8gTEi/m3ikE 8Bf5iZ5dHDskwDg97BYkUpk3mUeLsMOjPMJkXlvhF4mF/lBJPccuIbG9K2dIRqZ0FO2y L6emb51FAvl0YtDlc3s1NyDxq+qCJaK5UHT8I4gFqQ9hSUe0qpnV6t/SWHgPg24kglJz 4Y0Q== 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:mime-version :content-transfer-encoding; bh=LqSNzOPOVJw9rsvpaWin3k5tpPNT/bVkcPC7OHiBDoM=; b=s9VnU35XUCKvVXPDgt7tVFfhKVezCtbugCyiy3vZTuG+k9pliftmfbqtSjygQoshhM UlcLTy7tXC4uI3GzFuLPEid7NQ2+RB4HIXemRZlko5bcR63CK3WP3muxxP6zAej6ry49 w9OPPRRjKlelcsgNPq393hXS8nKGflenB4tcObpznDtKjY2oJURyTtVKFKqnCYuJt/bB VK2vtIZJq6gGgo+U/rR/mPwgMZ520gp7guIVXk/UTL9ISS8AbIYUBHXiEJkd70bJDh0t T+myqGbJ2lqkZafL9NS+0N0YaQY/USda8zajAMMjuPM4QbwKrBwmiKqH4fhPIqb4lUix 8I4g== X-Gm-Message-State: APjAAAU3DQpOLK9jsprXowAfSO4ESMn23d2aP7itygdMm6YrpoAPCUTm rxHGQhBpP/1m+IVsLZu8SdQ9Kw== X-Google-Smtp-Source: APXvYqxCf2l8Lpa17skDbhUeMIL4CGBrTpPlGzqJmYm9P2dzbNDhB9bB9Z+AE2sjDvDJHaQiVNGhCw== X-Received: by 2002:adf:eacb:: with SMTP id o11mr6815410wrn.239.1559835797728; Thu, 06 Jun 2019 08:43:17 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2019 16:43:10 +0100 Message-Id: <20190606154310.15830-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH] cputlb: cast size_t to target_ulong before using for address masks 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: , Cc: Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Andrew Randrianasulu , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While size_t is defined to happily access the biggest host object this isn't the case when generating masks for 64 bit guests on 32 bit hosts. Otherwise we end up truncating the address when we fall back to our unaligned helper. Cc: Andrew Randrianasulu Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Tested-by: Andrew Randrianasulu --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b796ab1cbe..8f814a1a2c 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1306,7 +1306,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCG= MemOpIdx oi, uint64_t r1, r2; unsigned shift; do_unaligned_access: - addr1 =3D addr & ~(size - 1); + addr1 =3D addr & ~((target_ulong)size - 1); addr2 =3D addr1 + size; r1 =3D full_load(env, addr1, oi, retaddr); r2 =3D full_load(env, addr2, oi, retaddr); --=20 2.20.1