From patchwork Tue Oct 29 15:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 839346 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4593:b0:37d:45d0:187 with SMTP id gb19csp428837wrb; Tue, 29 Oct 2024 08:15:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXBzmpCWJ/tBJZpmaYiSXSxMQciwz1CZ4Y0anveRmOPiAAC/FQ1ao3hqC2fR5zocO4FnIfyMQ==@linaro.org X-Google-Smtp-Source: AGHT+IHaCsFqGP+fRZ3kulWuFLdpklYbFiV+WXT5zbPZIKoV8W2emGcXvC8BP3Fdw5ihFhDZI4pu X-Received: by 2002:a05:6870:1614:b0:277:7147:26ff with SMTP id 586e51a60fabf-29051d728ebmr9751992fac.35.1730214955712; Tue, 29 Oct 2024 08:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730214955; cv=none; d=google.com; s=arc-20240605; b=hlH07AJiJ3+fRJb0t+4w8T1xFcj4zvJUs/xW/HCfd+KtZ2HGJ5WpbCKUlAywv+vbuo WQQFlqJQeIUFLxVvlVP6bBcKIS7qqrF3mawSij4kYsSQELcC5u0sP4KYNILqAWkuHsmx d/VYeJ8GiehPLq8lqBE5ibBgMZwKhkgCAKFrOPGn5g4NgI5ADMNsP5eytW4FDgb9Zzoy +5uBhBS/i284ynXUmBtId5EKtmnsq9i7BImWHR8znqT4hwnyQehKtzqLz7RtP1EdZs8W nD/H1HbOpYpTVNDaTHEcK0Mb3wPNjhOsWV+oiw9r0anp+NbNTIls8i9W0hOvkx9+8JqM S4Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=T+ZkiB0yRpxPAiy0AdprSxhYgetza8NXjghFFGQPPbg=; fh=QwrJAO0hdJNRBN1i9Wabj6eVYGsL5u8VOWFDyPQnNYY=; b=brhdUWx8fu6LPJHWlHgEVtnMqp4ikgHYjL30oS+4AGDZZHj52z3rYk+lZuu36F0lvm zStovJoxz7OKf4y51XVlH5wYYEiSnh7U1lCH+ylrb8vj6ySjcnXQ+5nUZ51q3SbGvHXZ Lrm+s7TEdarHaV77+odydN9PpY1rkuy2A/e4rrWfTdkppLVliQbm9+dZg1iPy5QkPmoW KnqybPE6Mcl8eZNlhCJ487nGujmaDyw+IqKOuEtAY40MZ5XKATPTcrPsvELty7V8UqBE 6jN0gsBDaJDNhOeAp620BNWLUJ8rHIjuBk8Vz6yceuPDBlHmxHWbq7tQEdAEEnCtD5LR 3ZuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WBmPB+j+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4a8c53115a9si2756080137.321.2024.10.29.08.15.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Oct 2024 08:15:55 -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=pass header.i=@linaro.org header.s=google header.b=WBmPB+j+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5nvs-0006YJ-5Z; Tue, 29 Oct 2024 11:15:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5nsC-0000pD-0N for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:11:11 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5ns3-0007jX-Kv for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:11:07 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4319399a411so42333895e9.2 for ; Tue, 29 Oct 2024 08:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730214658; x=1730819458; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=T+ZkiB0yRpxPAiy0AdprSxhYgetza8NXjghFFGQPPbg=; b=WBmPB+j+ECukrqDHMt76xJCIllMoxxVXrr4mBIfCYv835SIQi8E3h8KQcZOe+pOhfB 3mnsjYvKL4585C/neGFSXsM4ikJU5jmdujBhnuJRjPIQTLR9kVRZBIawp1/v2YMr7D5c 6p9XGXIOHRQU2GJBUvvyDZLigy0oz1XtOwpk3oMSDgdfUB1hlYhj/3VxXcj2oPbVDocW AhuzVOyONsFwXV4Q6gyRt6OVQ4QIvjQwKoCN+a9LPJBrPc5pZvPPV63Soie4DF1XjfSF HMI/XHufUa/4qWFtfQswWNmSyRCAaF7h6zIpxcBFxvGV2hgUwixDmPMLrdXtBk8vsVMX 2IGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730214658; x=1730819458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T+ZkiB0yRpxPAiy0AdprSxhYgetza8NXjghFFGQPPbg=; b=h6BT3kCX4UyxiE/OXCiaZ4DYby7yCffUDjm/mOqzsBPUXqxlYn42V8SkMV4C9l9jbp xd44p2eMwQAYuPEyPbpEAvw4hBLnx8NymRNKPQS7NzMmcG9VeiMOvtnJSw9StdFT+mGI W7iH/9c6tCTh2EOZ9MyGNeuySnJfY4t1HeTNcZpGIBSlP0yPuyjPawXpbWb8Wlm4ikAi +35CfY1hXrdpoZxmPzuPWIosqktIjJid+cjsYhfD1M3NwQ8vh/uFlgY76gJi4XTaz07A Xaub4wKzUACUtpyzNbu5ekMHaUFZez/G/U7mz0Tqn/Kn5iCjIzlDTPpEgWUYZ2rmNr1O q2hw== X-Forwarded-Encrypted: i=1; AJvYcCVIpG9bthRGP6RuUk9COY8BT6auyaHpiqVIuMiq2wQNuQnXcTWr0A3bZnhKCeF4pWE9oabG8XAxFSOC@nongnu.org X-Gm-Message-State: AOJu0YzsI8soAY823Kw9rQBbN2Qe87mwfDjxo3PJhxdXTxX5O9iyqKvu +P42UqwE173/+1QS6Ta7BsWCwuhfexwFDtKFNwQDfz7jxDSw6Jj7idmuyZk8+zmaH67V90O0tm8 i X-Received: by 2002:a05:600c:1c95:b0:42f:6d3d:399f with SMTP id 5b1f17b1804b1-4319acbab55mr111741305e9.21.1730214658108; Tue, 29 Oct 2024 08:10:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4319360cc2esm146835865e9.44.2024.10.29.08.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 08:10:57 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PULL 16/18] target/arm: Fix arithmetic underflow in SETM instruction Date: Tue, 29 Oct 2024 15:10:46 +0000 Message-Id: <20241029151048.1047247-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029151048.1047247-1-peter.maydell@linaro.org> References: <20241029151048.1047247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ido Plat Pass the stage size to step function callback, otherwise do_setm would hang when size is larger then page size because stage size would underflow. This fix changes do_setm to be more inline with do_setp. Cc: qemu-stable@nongnu.org Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions") Signed-off-by: Ido Plat Reviewed-by: Richard Henderson Message-id: 20241025024909.799989-1-ido.plat1@ibm.com Signed-off-by: Peter Maydell --- target/arm/tcg/helper-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 56b431faf57..8f42a28d07b 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -1348,7 +1348,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc, /* Do the actual memset: we leave the last partial page to SETE */ stagesetsize = setsize & TARGET_PAGE_MASK; while (stagesetsize > 0) { - step = stepfn(env, toaddr, setsize, data, memidx, &mtedesc, ra); + step = stepfn(env, toaddr, stagesetsize, data, memidx, &mtedesc, ra); toaddr += step; setsize -= step; stagesetsize -= step;