]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0011-target-arm-Fix-vd-vm-overlap-in-sve_ldff1_z.patch
799aa8486e1bc3351ef9e21c98f5dd7e0f985d2b
[pve-qemu.git] / debian / patches / extra / 0011-target-arm-Fix-vd-vm-overlap-in-sve_ldff1_z.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Richard Henderson <richard.henderson@linaro.org>
3 Date: Thu, 4 May 2023 11:42:32 +0100
4 Subject: [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z
5
6 If vd == vm, copy vm to scratch, so that we can pre-zero
7 the output and still access the gather indicies.
8
9 Cc: qemu-stable@nongnu.org
10 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1612
11 Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12 (picked up from https://lists.nongnu.org/archive/html/qemu-devel/2023-05/msg00961.html)
13 Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 ---
15 target/arm/tcg/sve_helper.c | 6 ++++++
16 1 file changed, 6 insertions(+)
17
18 diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c
19 index ccf5e5beca..0097522470 100644
20 --- a/target/arm/tcg/sve_helper.c
21 +++ b/target/arm/tcg/sve_helper.c
22 @@ -6727,6 +6727,7 @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm,
23 intptr_t reg_off;
24 SVEHostPage info;
25 target_ulong addr, in_page;
26 + ARMVectorReg scratch;
27
28 /* Skip to the first true predicate. */
29 reg_off = find_next_active(vg, 0, reg_max, esz);
30 @@ -6736,6 +6737,11 @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm,
31 return;
32 }
33
34 + /* Protect against overlap between vd and vm. */
35 + if (unlikely(vd == vm)) {
36 + vm = memcpy(&scratch, vm, reg_max);
37 + }
38 +
39 /*
40 * Probe the first element, allowing faults.
41 */