* [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z
@ 2023-05-04 10:42 Richard Henderson
2023-05-15 14:22 ` Richard Henderson
2023-05-15 15:30 ` Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2023-05-04 10:42 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, qemu-stable
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 <richard.henderson@linaro.org>
---
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.
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z
2023-05-04 10:42 [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z Richard Henderson
@ 2023-05-15 14:22 ` Richard Henderson
2023-05-15 15:30 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2023-05-15 14:22 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, qemu-stable
Ping.
r~
On 5/4/23 03:42, Richard Henderson wrote:
> 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 <richard.henderson@linaro.org>
> ---
> 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.
> */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z
2023-05-04 10:42 [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z Richard Henderson
2023-05-15 14:22 ` Richard Henderson
@ 2023-05-15 15:30 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2023-05-15 15:30 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, qemu-arm, qemu-stable
On Thu, 4 May 2023 at 11:42, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> 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 <richard.henderson@linaro.org>
> ---
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-15 15:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 10:42 [PATCH] target/arm: Fix vd == vm overlap in sve_ldff1_z Richard Henderson
2023-05-15 14:22 ` Richard Henderson
2023-05-15 15:30 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).