* [PATCH] target/arm: Fix MTE0_ACTIVE
@ 2020-12-21 20:44 Richard Henderson
2021-01-07 17:54 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2020-12-21 20:44 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, pcc, qemu-stable
In 50244cc76abc we updated mte_check_fail to match the ARM
pseudocode, using the correct EL to select the TCF field.
But we failed to update MTE0_ACTIVE the same way, which led
to g_assert_not_reached().
Cc: qemu-stable@nongnu.org
Buglink: https://bugs.launchpad.net/bugs/1907137
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 7b8bcd6903..4597081d5d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -12932,7 +12932,7 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV)
&& tbid
&& !(env->pstate & PSTATE_TCO)
- && (sctlr & SCTLR_TCF0)
+ && (sctlr & SCTLR_TCF)
&& allocation_tag_access_enabled(env, 0, sctlr)) {
flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] target/arm: Fix MTE0_ACTIVE
2020-12-21 20:44 [PATCH] target/arm: Fix MTE0_ACTIVE Richard Henderson
@ 2021-01-07 17:54 ` Peter Maydell
2021-01-07 19:10 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2021-01-07 17:54 UTC (permalink / raw)
To: Richard Henderson; +Cc: Peter Collingbourne, QEMU Developers, qemu-stable
On Mon, 21 Dec 2020 at 20:44, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> In 50244cc76abc we updated mte_check_fail to match the ARM
> pseudocode, using the correct EL to select the TCF field.
> But we failed to update MTE0_ACTIVE the same way, which led
> to g_assert_not_reached().
>
> Cc: qemu-stable@nongnu.org
> Buglink: https://bugs.launchpad.net/bugs/1907137
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 7b8bcd6903..4597081d5d 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -12932,7 +12932,7 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
> if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV)
> && tbid
> && !(env->pstate & PSTATE_TCO)
> - && (sctlr & SCTLR_TCF0)
> + && (sctlr & SCTLR_TCF)
> && allocation_tag_access_enabled(env, 0, sctlr)) {
> flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
> }
I don't understand this change, could you explain a bit more?
In commit 50244cc76abcac we change to looking at the TCF
field corresponding to the actual current EL instead of the
EL for the memory-access. But if we're doing that then why
should we be looking at exclusively SCTLR_TCF0 in this
for-unpriv-access code rather than doing the same thing we do
for normal accesses and checking
(sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))
?
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/arm: Fix MTE0_ACTIVE
2021-01-07 17:54 ` Peter Maydell
@ 2021-01-07 19:10 ` Richard Henderson
2021-01-07 19:46 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2021-01-07 19:10 UTC (permalink / raw)
To: Peter Maydell; +Cc: Peter Collingbourne, QEMU Developers, qemu-stable
On 1/7/21 7:54 AM, Peter Maydell wrote:
>> - && (sctlr & SCTLR_TCF0)
>> + && (sctlr & SCTLR_TCF)
>> && allocation_tag_access_enabled(env, 0, sctlr)) {
>> flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
>> }
>
>
> I don't understand this change, could you explain a bit more?
> In commit 50244cc76abcac we change to looking at the TCF
> field corresponding to the actual current EL instead of the
> EL for the memory-access.
Correct.
> But if we're doing that then why
> should we be looking at exclusively SCTLR_TCF0 in this
> for-unpriv-access code rather than doing the same thing we do
> for normal accesses and checking
> (sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))
Because this is for the UNPRIV instructions which are UNDEF at el == 0.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/arm: Fix MTE0_ACTIVE
2021-01-07 19:10 ` Richard Henderson
@ 2021-01-07 19:46 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-01-07 19:46 UTC (permalink / raw)
To: Richard Henderson; +Cc: Peter Collingbourne, QEMU Developers, qemu-stable
On Thu, 7 Jan 2021 at 19:10, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 1/7/21 7:54 AM, Peter Maydell wrote:
> >> - && (sctlr & SCTLR_TCF0)
> >> + && (sctlr & SCTLR_TCF)
> >> && allocation_tag_access_enabled(env, 0, sctlr)) {
> >> flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
> >> }
> >
> >
> > I don't understand this change, could you explain a bit more?
> > In commit 50244cc76abcac we change to looking at the TCF
> > field corresponding to the actual current EL instead of the
> > EL for the memory-access.
>
> Correct.
>
> > But if we're doing that then why
> > should we be looking at exclusively SCTLR_TCF0 in this
> > for-unpriv-access code rather than doing the same thing we do
> > for normal accesses and checking
> > (sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))
>
> Because this is for the UNPRIV instructions which are UNDEF at el == 0.
Ah, right. (It didn't help that I'd read the diff backwards:
the new code looks at SCTLR_TCF, not SCTLR_TCF0.)
Further, the SCTLR_*.ATA/ATA0 checks *are* based on the
privilege of the access, which is why calling
allocation_tag_access_enabled(env, 0, sctlr)
is still correct.
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-07 19:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 20:44 [PATCH] target/arm: Fix MTE0_ACTIVE Richard Henderson
2021-01-07 17:54 ` Peter Maydell
2021-01-07 19:10 ` Richard Henderson
2021-01-07 19:46 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.