From nobody Wed May 15 11:55:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1683197018; cv=none; d=zohomail.com; s=zohoarc; b=Ss1+F7TtkIWu7LbRxbUMSNztC3U+WpK+SoipMrv0dy2C3Ly5vpzbaaeqFU/Hi7TLjIoE44742lTHyYnENcPcvTShWn1uXEwY9kWHPT6YDlgAlvV3Dc+/KYMmg+B1K5vVL/svafw1zYVzNfIG/kRANm8BMi3+KOnhlzrbk7TXA7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683197018; h=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; bh=n7vQQ3BCTeRFq/ysBUUocz5IDjn6DJp11hxaWsFLtKo=; b=B1FiJTPaWAy5GK+p5taUu01QPgWCKIhPCfMTtYaUOTgtXirLywV4vmrVXk2aMzo1MfbGCOhmn5du/sPeHhDVYyAS9es+9t25TDy3kff+OeIYLVVKHDU9KxM3Os1e7U4b9ZoEX5ubpnURKQ8pFckiSoeshvKtjDhBZ8IKjMUCT34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683197017758337.010057481889; Thu, 4 May 2023 03:43:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puWQA-0007jN-6l; Thu, 04 May 2023 06:42:46 -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 1puWQ4-0007h0-SJ for qemu-devel@nongnu.org; Thu, 04 May 2023 06:42:41 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1puWQ2-0000yG-2j for qemu-devel@nongnu.org; Thu, 04 May 2023 06:42:40 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-94f7a0818aeso45129966b.2 for ; Thu, 04 May 2023 03:42:36 -0700 (PDT) Received: from stoup.. ([91.223.100.49]) by smtp.gmail.com with ESMTPSA id th7-20020a1709078e0700b009596e7e0dbasm14655268ejc.162.2023.05.04.03.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 03:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683196955; x=1685788955; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n7vQQ3BCTeRFq/ysBUUocz5IDjn6DJp11hxaWsFLtKo=; b=Ues+fT0fjKGve6XPE8QqkySHLLemHX2SfNzF2f0THkp82wRSgMxGGoUIN+ampSwg5/ iNO9I/qvhQBjDBgCoxeBNT5e3qCnwocJ3lkgNdLU5wg9Zivstd4WWc9FgP3rwKOoHkH0 UTmWGUqEOGEfBGx0hhUN2RWEi22Uz6nx06kjk/vr7yGT5R32Z15iscFB5ff5g/pd3A7R TiIPiCnX024AV2aCan8BpC+jUaXgkYQQpJ+52F66V9ExAyWSxnalWVm2ZUuyZ70xaLVL YS2ey2JN32VBAnWJcpipLYReCyHva/U2VnfflbyBtd9N3/FM46+uHK0H5M9IdfkF111k 3Q3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683196955; x=1685788955; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n7vQQ3BCTeRFq/ysBUUocz5IDjn6DJp11hxaWsFLtKo=; b=TpbNaimSPeGgUFIEDkE0bRlCdfJAkEQYdREeUaeL3yG3Z/LTZhJOSI5WC0VGM1xWCh lr1HSzTxQ7g6ZZwWfHmm3kJdvn8U7waaoZdUNAVtbdFoey1NeSZCTKwb+UH0FlBRSPFA ELr0VslY5UA1nKdfy6tTGOD7xDYRjyylvsbk7xBO+QUG4aS+N7GWzwD56qBB9virQfdg w2Fc9EVO5/I5iHKgp0E/rsXIdwsmlCgAwVQ+ngzyc/zMoeG+ZCiupvgsMXhVg0iBwgvK mWM+0yFwQt1oE/s1+nbjQa/thWaBGKdNSuuzWreVIUZkpjPIPwLYSWJUmm/jXhyMJTqh dtKQ== X-Gm-Message-State: AC+VfDyctglF5q4c33Lvb4qS+HUpETGVkn/Elu77fGFAL4LSUBn4SLoO GeXbRyHC1Qn3AwY5t7s27W8OlHAQ5pqR9p91dDqooQ== X-Google-Smtp-Source: ACHHUZ5pI5Ef5pnK7O97rVmYLLOundnY27HugqSXMBsnXeP04AbXiB0I5hIesceoif6e6ZvmrICicw== X-Received: by 2002:a17:907:948a:b0:947:5acb:920c with SMTP id dm10-20020a170907948a00b009475acb920cmr5989140ejc.34.1683196955009; Thu, 04 May 2023 03:42:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-stable@nongnu.org Subject: [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z Date: Thu, 4 May 2023 11:42:32 +0100 Message-Id: <20230504104232.1877774-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-ej1-x62e.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=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1683197019228100001 Content-Type: text/plain; charset="utf-8" If vd =3D=3D 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 --- 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 ccf5e5beca..0097522470 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; =20 /* Skip to the first true predicate. */ reg_off =3D 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; } =20 + /* Protect against overlap between vd and vm. */ + if (unlikely(vd =3D=3D vm)) { + vm =3D memcpy(&scratch, vm, reg_max); + } + /* * Probe the first element, allowing faults. */ --=20 2.34.1