From patchwork Thu May 18 12:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 683364 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp354668wrt; Thu, 18 May 2023 05:53:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZyS5BWWmOcGimTJQcRmYRpiBdkjvMjdIwkiLGZ71sxESGjzdH6jygOPXj2Dv0Hr+TxhgI X-Received: by 2002:a05:6214:f27:b0:5ef:422c:be7f with SMTP id iw7-20020a0562140f2700b005ef422cbe7fmr6144862qvb.12.1684414411685; Thu, 18 May 2023 05:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684414411; cv=none; d=google.com; s=arc-20160816; b=r+cBNiarC4LpN5PY8rvEexasmnu5mvNzgMztxZHwP71CHKFgygeijeyxTEFCZNM9d2 uuXD3qIcfpy7SdJGsDDltn9uMsuCIMWDm4a5GBItWmXzKGHUigbZ6zfIlBa36WdnYtn4 /yGs6y02l7SKICeV4ilvzcAVy42PKOyef36Wm0mTc6N0gZCJihHuJkvcy2KzO2eY5hfJ SRIYeImhjeuj6sVVQhwtjaBsjDL7hy/8xmNbsmCtj9gBeX4+YrGI9JiPXVBhYAW6buSe QCRFU0AG8wYjyeCUffb4Dp1l88zMD9124kB/cdYf6pg2ilDEbc/oQgmxvC6gUC3xQp7S C8PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3qgQgU0oovp++OASw0Q9fkW/XuF2+8h0xHqcmjtio2o=; b=Tqsc9DYusVP+/d1GlyXM2zpz7mVjwQYK8QOTov+eZN7DWmN4IcGVfBvXjK8vDgKWET 39fHBjoF0hepJ6K5HhVXy6iGlIASEWbIxCaKgYW9jggPEBPXMqvMbfOzaDbeLiaIctH+ QT7EL4pkLizLzBOXSlOgIFRShcyx9MDaLc648taQq1jGfkpwwNk3RJZEX0gnLv/0dpVa Xog/9hTKPGektp/hg9FwcPT8RtnTqffDKb7p56Kh2OVkRxRLzmOE475PzhvjqHLYAQno fpLCaCTdkr5Y+T5gjBzZnKifIiGl9/zWUbf3Fi1vabgJIw9Itwy4kkx2y/N+0yef0cil 7KzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PIY78DRz; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fo11-20020ad45f0b000000b0062126d1ba09si1076453qvb.61.2023.05.18.05.53.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 May 2023 05:53:31 -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=PIY78DRz; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzd6M-0004AU-5P; Thu, 18 May 2023 08:51:27 -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 1pzd6C-00048l-Tv for qemu-devel@nongnu.org; Thu, 18 May 2023 08:51:19 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzd67-0007vn-Hs for qemu-devel@nongnu.org; Thu, 18 May 2023 08:51:13 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f4249b7badso20004865e9.3 for ; Thu, 18 May 2023 05:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684414269; x=1687006269; 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=3qgQgU0oovp++OASw0Q9fkW/XuF2+8h0xHqcmjtio2o=; b=PIY78DRzhDloelyVFdnDXBNoH066+cQQD70srzPuacfQ/BpVgoygWKSHW4xo3uF2r1 GwRsDlz4ugmcWrjE6KjAfgykQXbyidmmxwJ+Gjst+IFG1fDZEvAzzssIMNn8jRD4iT4o Y/uWStgtb4nccBdpXD5FTqafWF54MNfG+O5oaWWAgk230iwNKol9WqJrXJMNLA2OxX0W wAZQbMAZM9MhBampIWsbpl04HZ8h4Ii+fId3zvX/JCBxmkWB7WeLNdQTkwo7zCLQpIzG S78CciOyW3VK2R+B4iwyX5m+uHGzmfZm3QNkcijkgSribOgUapeSokiZ47Erux7Gsjiw Umrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684414269; x=1687006269; 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=3qgQgU0oovp++OASw0Q9fkW/XuF2+8h0xHqcmjtio2o=; b=Ypy867hss6S8m2jz6xs7PLKWmkDNXCrOmoU0GzMx3LV6NG9Vau4+FfDe/Sa10xhwEC SDbA38zsAuG29rgsSSBQUkcGIR1UrBGHKkhusTc6+D4GzEFHDvvpnie8vtKhXIn2Eyk5 S43EJGg/Pkhc7iO7kgI/Om+vXzr/6KjQiEJ1JHj2RZ+myLKJurxkUjzG0R0edZflSAdN zY2BJe9F78W08TfXITh49y9jVdlm+1X0rSu34tT8p0577JLWCFa+FSmjcy+DcAf1IbHt 2JdMx801WBqDMXELCakSO3GKtv+sRbJNJqizlP7rWpciOcXTu2OhYPUgi58Jo+Am6E32 LgJA== X-Gm-Message-State: AC+VfDzHkWvy32PsOgVOasQEab+ayNQTXWnJYnfTJIhW7sYA0/gwaIel zruzyegB/a+1KjxYSgDeg62+26MtU3k8APMThr8= X-Received: by 2002:a05:600c:ad9:b0:3f4:21ff:b91f with SMTP id c25-20020a05600c0ad900b003f421ffb91fmr1416245wmr.28.1684414269574; Thu, 18 May 2023 05:51:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z21-20020a1c4c15000000b003f42d2f4531sm5201321wmf.48.2023.05.18.05.51.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 05:51:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/29] target/arm: Fix vd == vm overlap in sve_ldff1_z Date: Thu, 18 May 2023 13:50:40 +0100 Message-Id: <20230518125107.146421-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230518125107.146421-1-peter.maydell@linaro.org> References: <20230518125107.146421-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, 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: Richard Henderson If vd == vm, copy vm to scratch, so that we can pre-zero the output and still access the gather indicies. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1612 Signed-off-by: Richard Henderson Message-id: 20230504104232.1877774-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/tcg/sve_helper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index ccf5e5beca2..0097522470e 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -6727,6 +6727,7 @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, intptr_t reg_off; SVEHostPage info; target_ulong addr, in_page; + ARMVectorReg scratch; /* Skip to the first true predicate. */ reg_off = find_next_active(vg, 0, reg_max, esz); @@ -6736,6 +6737,11 @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, return; } + /* Protect against overlap between vd and vm. */ + if (unlikely(vd == vm)) { + vm = memcpy(&scratch, vm, reg_max); + } + /* * Probe the first element, allowing faults. */