From patchwork Tue May 23 10:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 684895 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1630422wrt; Tue, 23 May 2023 03:21:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4im8DPrbZFntE+hpZO+Q6Z0NM0DLOPiunu9+41Y2bkoGDY6NY4Bk5L9atUIhmZ0dJNcE1s X-Received: by 2002:a05:620a:2b2f:b0:75b:23a0:dea2 with SMTP id do47-20020a05620a2b2f00b0075b23a0dea2mr3648287qkb.32.1684837282283; Tue, 23 May 2023 03:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684837282; cv=none; d=google.com; s=arc-20160816; b=L74nYUgz06OeUmCS143xnTFPwh2RClRRQNu2t0W8P38xnNc9g4yiTekVeeDcSxrWfX gmSkJafMpp4NSjWcZ+4CFtMOlgfxltJ6FYHka5s0Vfrt3iBSgqeuSAqdkmoFp0abHewp H8POLkK/RxlIdwrRql/9aTGNObaO4OoMi07ch1HxjsXWMRhOjIXRukfXwyM43nWiVtIp irRIbABd86KgprWNkmdpoLLn/eObplwK0lVCNOvZiqxfT8Ipd4HNTH+kwDmQp5isaqgB uD08xU7lJUwfhLktr1PhfL9gM38vq3mJWSFaot9lxBDvWaP0sN/bZDmBiR4ttRJdd7pv I9dA== 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:cc:to :from; bh=kMDtoycQG4/T6rHULh4xPbJzG6+4VrYqv26/SXSH93o=; b=jmEC1IgJoqYvsIwjxd0tM1O2Kaqkb0SiJtG+ujDeWQMhggxkF1GP4a/LG1/sr6UQs3 wqtJezt0o4pTViP54y/EYF8oN4cuBeBQIisAyrSwihiWukHWp+9viAr3wSE96BNRCSkp I7ABnSvGwPKId0x6IG5rhhZxyrymzH6SH6pKHgemx0lxnTZfZyMfkT9qyRK2Wcwchif5 CadnWeBT9YEjhyfp+JgwaBLWZ4UIbqmchTFqF4HXdgF8by7SDxlOVeX8dxFqPd/4RxtB bL0FndnLeD7Mo3NrbZZ3JRtkZuSpYnK+S9wvQGAJUAlb0SistvAkBc660wiRy5LLMRjd 2/AQ== 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 g23-20020ae9e117000000b0075b25837942si1303631qkm.174.2023.05.23.03.21.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 May 2023 03:21:22 -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 1q1P8F-0006kz-Ml; Tue, 23 May 2023 06:20:43 -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 1q1P86-0005dm-5k; Tue, 23 May 2023 06:20:34 -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 1q1P83-000381-QO; Tue, 23 May 2023 06:20:33 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 7B71F7D3E; Tue, 23 May 2023 13:20:16 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id C28A072A5; Tue, 23 May 2023 13:20:15 +0300 (MSK) Received: (nullmailer pid 86085 invoked by uid 1000); Tue, 23 May 2023 10:20:14 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Peter Maydell , Michael Tokarev Subject: [Stable-7.2.3 39/45] target/arm: Fix vd == vm overlap in sve_ldff1_z Date: Tue, 23 May 2023 13:17:16 +0300 Message-Id: <20230523102014.85954-8-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: 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 (cherry picked from commit a6771f2f5cbfbf312e2fb5b1627f38a6bf6321d0) Signed-off-by: Michael Tokarev diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 521fc9b969..27838fb6e2 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -6726,6 +6726,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); @@ -6735,6 +6736,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. */