From patchwork Fri Sep 6 11:12:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 825930 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp744071wrb; Fri, 6 Sep 2024 04:14:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUtNGZo5cOq16lzVcs/hiZbRVopzN0PIvM8aen4Q86KyyaHtNfJwrSqmHcvEyzjJxXkqenE/A==@linaro.org X-Google-Smtp-Source: AGHT+IFZtiQ65Y3JMyFmM6QgRz2dLVhjK6x39wCHVP+q+SGf0GRVSLw4CvWINkWOmmxml/Qv2EwC X-Received: by 2002:a05:6214:3c88:b0:6c3:3d7e:7152 with SMTP id 6a1803df08f44-6c5284f56e4mr28811056d6.25.1725621277165; Fri, 06 Sep 2024 04:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725621277; cv=none; d=google.com; s=arc-20240605; b=N5GzsUy12uquGX9YJPYRLa/Sf5VXcfTb+cBKwlSSV4yS8AC2bZg1sfNG9Uf+ddbfQc yW11DEWT1YWhFmZj9zsSKfxdSUNoGhFoumINWUGl5IU0x8NcQRCxworYdj6rpIxIqVqb kfDwW9p0CGGAMa1Z42n9SUAa/7xwi5vyvl8uM7P5neIDKBhfUdltWEQsUqd7kTkW1lss t9mFq0cCR/NNMXlhNh4pNK2AfA8JHc8Nb3fisiqxCpcm2ez/lxoAVdzf2d7HW21b612y gpUgKX3gV8PjSroKbV32KMDlcGK2nuUlNASbtC8Q/HbI6MMDzq/er2qdsRBvYSGF8Utl /vMg== 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:cc:to :from; bh=duDrgkBcYk6Vwi7K00VEjySNR3G0h1nog9wKYFtbUCc=; fh=taStO74W/EZXcDvsT3Zoyq1h58w93JzpEc66fmdrq4s=; b=DJl9yDX44yxABlDzPHJ2b9BK8dBJaKhMmRK4/AkykWvNCqkv0CaWJv8bArWyo8bIDW dqe+EWP7IXh/wo/VVpV0MVPFr+KkIrl3L6rVFzqUuMhTjDa/2nlDxrkwXs1z858tPjo9 g6zEcKq7jqDbcuu7iJlbUaljy3vhR5iFGtBymboo/8nBBKbxCUSi6e7nmdPCTWqjubAi CM2SLhQFIxKOojOKE6eI9rBl3mBfd0dgihO8eH5JngDmDwJ4CAeHasL9Moqckd2jDiR9 2uysGIQBJBPQPvtIbulcRpAnA9TcmMuQmql8ZEHH9ZLHoZrDb3NSP8vXPWY4uhDkgagn VVCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c5306a8e3bsi427686d6.548.2024.09.06.04.14.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2024 04:14: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smWuJ-0000Z9-Ke; Fri, 06 Sep 2024 07:13:39 -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 1smWuH-0000Rh-6Z; Fri, 06 Sep 2024 07:13:37 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smWuF-0007fp-Hq; Fri, 06 Sep 2024 07:13:36 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B92D68C474; Fri, 6 Sep 2024 14:12:06 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id C49111336DE; Fri, 6 Sep 2024 14:13:24 +0300 (MSK) Received: (nullmailer pid 353552 invoked by uid 1000); Fri, 06 Sep 2024 11:13:24 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Michael Tokarev Subject: [Stable-9.0.3 04/69] target/arm: Fix handling of LDAPR/STLR with negative offset Date: Fri, 6 Sep 2024 14:12:13 +0300 Message-Id: <20240906111324.353230-4-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: Peter Maydell When we converted the LDAPR/STLR instructions to decodetree we accidentally introduced a regression where the offset is negative. The 9-bit immediate field is signed, and the old hand decoder correctly used sextract32() to get it out of the insn word, but the ldapr_stlr_i pattern in the decode file used "imm:9" instead of "imm:s9", so it treated the field as unsigned. Fix the pattern to treat the field as a signed immediate. Cc: qemu-stable@nongnu.org Fixes: 2521b6073b7 ("target/arm: Convert LDAPR/STLR (imm) to decodetree") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2419 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20240709134504.3500007-2-peter.maydell@linaro.org (cherry picked from commit 5669d26ec614b3f4c56cf1489b9095ed327938b1) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 8a20dce3c8..6cc29a4bce 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -467,7 +467,7 @@ LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm &ldapr_stlr_i rn rt imm sz sign ext -@ldapr_stlr_i .. ...... .. . imm:9 .. rn:5 rt:5 &ldapr_stlr_i +@ldapr_stlr_i .. ...... .. . imm:s9 .. rn:5 rt:5 &ldapr_stlr_i STLR_i sz:2 011001 00 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 LDAPR_i sz:2 011001 01 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 LDAPR_i 00 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=0