From patchwork Thu May 4 10:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 679077 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp262682wrs; Thu, 4 May 2023 03:43:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4GH6UIahYeJEpmrA2/mqTVtTgljNQepcGRoWDoA8z5ytuLNgsHTbAZ4X/QiHp+eipZgbeU X-Received: by 2002:a05:6214:e6a:b0:5f1:6892:743d with SMTP id jz10-20020a0562140e6a00b005f16892743dmr11362483qvb.26.1683197017359; Thu, 04 May 2023 03:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683197017; cv=none; d=google.com; s=arc-20160816; b=mkTbMbhWKSUBSbUFOIdU2dVcJcATJk90MQRcv3kieXj6awfVpNTbkX6xoiA7Uh2jGt NxK79t8giIIAy+h2801uzrLcoJj631HT0nI6dZWpzJZqykWtgtbJ3+Pk8uTJpzqiMnpq 3x8f/ejAQwGnMFTiXKAyxq7uKzYL/S7I6FPeMN7/YbvN9hrQ2Eh+U74jJUvzBKnmsk+A h6c7+xPduEE6C0vdysudlNeXXBLcsHXzMPCsp70RHktPEZ32m7+zFSYQDF+whoQH+xgy kHrKGEqFez4DfrYEFbi+UFhepKq573isWwyDvYBp9PJbuujek6OjSAuOl/ntpVwsq2bE AgQw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=n7vQQ3BCTeRFq/ysBUUocz5IDjn6DJp11hxaWsFLtKo=; b=knNfdurIQ/T247lrp4S09vVdriU7oFXqB0J63vK450yD1xMsV9pHYNPTDSsLtwfQo5 3pYKsyESsuDvl0+skslD5kai3dgMj7X6rWWZnataUm70JJwtUwtr4jJPGCanD0oXNvjJ gjl0XnCHAEOw1ADZwsZWQ/OW1cayIoDyrOuyUBAhf86EqxbVBKFtpyHC5P9HsgXevVrA kj1NksvML7AK9GhGR0XGg5amJ6fhlEUpT3PrYq6Rv/Gp5WqDOFkK6CTj2ZNnt1BUTNvX ZkUwGaCoYioAI+z77mocK8W9JSxRIvQ5d7oZkoFN37bD6ZCrlcRMtBGgu2qUAAt94Tgm cD8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ues+fT0f; 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 kl29-20020a056214519d00b0061b5c533a03si3129733qvb.249.2023.05.04.03.43.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 May 2023 03:43: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; dkim=pass header.i=@linaro.org header.s=google header.b=Ues+fT0f; 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 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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; /* 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. */