* [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction
@ 2024-10-25 2:48 Ido Plat
2024-10-25 15:13 ` Richard Henderson
2024-10-25 15:50 ` Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Ido Plat @ 2024-10-25 2:48 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Ido Plat
Pass the stage size to step function callback,
otherwise do_setm would hang when size is larger then page size because stage size would underflow.
This fix changes do_setm to be more inline with do_setp.
Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions")
Signed-off-by: Ido Plat <ido.plat1@ibm.com>
---
target/arm/tcg/helper-a64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index 56b431faf5..8f42a28d07 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -1348,7 +1348,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc,
/* Do the actual memset: we leave the last partial page to SETE */
stagesetsize = setsize & TARGET_PAGE_MASK;
while (stagesetsize > 0) {
- step = stepfn(env, toaddr, setsize, data, memidx, &mtedesc, ra);
+ step = stepfn(env, toaddr, stagesetsize, data, memidx, &mtedesc, ra);
toaddr += step;
setsize -= step;
stagesetsize -= step;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction
2024-10-25 2:48 [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction Ido Plat
@ 2024-10-25 15:13 ` Richard Henderson
2024-10-25 15:50 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-10-25 15:13 UTC (permalink / raw)
To: Ido Plat, qemu-devel; +Cc: peter.maydell
On 10/25/24 03:48, Ido Plat wrote:
> Pass the stage size to step function callback,
> otherwise do_setm would hang when size is larger then page size because stage size would underflow.
> This fix changes do_setm to be more inline with do_setp.
>
> Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions")
> Signed-off-by: Ido Plat<ido.plat1@ibm.com>
> ---
> target/arm/tcg/helper-a64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes: 0e92818887d ("target/arm: Implement the SET* instructions")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction
2024-10-25 2:48 [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction Ido Plat
2024-10-25 15:13 ` Richard Henderson
@ 2024-10-25 15:50 ` Michael Tokarev
2024-10-28 15:32 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2024-10-25 15:50 UTC (permalink / raw)
To: Ido Plat, qemu-devel; +Cc: peter.maydell, qemu-stable
25.10.2024 05:48, Ido Plat wrote:
> Pass the stage size to step function callback,
> otherwise do_setm would hang when size is larger then page size because stage size would underflow.
> This fix changes do_setm to be more inline with do_setp.
>
> Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions")
> Signed-off-by: Ido Plat <ido.plat1@ibm.com>
> ---
> target/arm/tcg/helper-a64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
> index 56b431faf5..8f42a28d07 100644
> --- a/target/arm/tcg/helper-a64.c
> +++ b/target/arm/tcg/helper-a64.c
> @@ -1348,7 +1348,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc,
> /* Do the actual memset: we leave the last partial page to SETE */
> stagesetsize = setsize & TARGET_PAGE_MASK;
> while (stagesetsize > 0) {
> - step = stepfn(env, toaddr, setsize, data, memidx, &mtedesc, ra);
> + step = stepfn(env, toaddr, stagesetsize, data, memidx, &mtedesc, ra);
> toaddr += step;
> setsize -= step;
> stagesetsize -= step;
This also seems to be:
Cc: qemu-stable@nongnu.org
(Cc'ed now, there's no need to add it again).
Please let me know if it shouldn't.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction
2024-10-25 15:50 ` Michael Tokarev
@ 2024-10-28 15:32 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2024-10-28 15:32 UTC (permalink / raw)
To: Michael Tokarev; +Cc: Ido Plat, qemu-devel, qemu-stable
On Fri, 25 Oct 2024 at 16:50, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> 25.10.2024 05:48, Ido Plat wrote:
> > Pass the stage size to step function callback,
> > otherwise do_setm would hang when size is larger then page size because stage size would underflow.
> > This fix changes do_setm to be more inline with do_setp.
> >
> > Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions")
> > Signed-off-by: Ido Plat <ido.plat1@ibm.com>
> > ---
> > target/arm/tcg/helper-a64.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
> > index 56b431faf5..8f42a28d07 100644
> > --- a/target/arm/tcg/helper-a64.c
> > +++ b/target/arm/tcg/helper-a64.c
> > @@ -1348,7 +1348,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc,
> > /* Do the actual memset: we leave the last partial page to SETE */
> > stagesetsize = setsize & TARGET_PAGE_MASK;
> > while (stagesetsize > 0) {
> > - step = stepfn(env, toaddr, setsize, data, memidx, &mtedesc, ra);
> > + step = stepfn(env, toaddr, stagesetsize, data, memidx, &mtedesc, ra);
> > toaddr += step;
> > setsize -= step;
> > stagesetsize -= step;
> This also seems to be:
>
> Cc: qemu-stable@nongnu.org
>
> (Cc'ed now, there's no need to add it again).
>
> Please let me know if it shouldn't.
Yes, I think it's stable material.
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-28 15:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 2:48 [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction Ido Plat
2024-10-25 15:13 ` Richard Henderson
2024-10-25 15:50 ` Michael Tokarev
2024-10-28 15:32 ` 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).