* [PATCH for-5.0] target/arm: PSTATE.PAN should not clear exec bits
@ 2020-03-30 17:06 Peter Maydell
2020-03-30 19:41 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2020-03-30 17:06 UTC (permalink / raw)
To: qemu-arm, qemu-devel; +Cc: Richard Henderson
Our implementation of the PSTATE.PAN bit incorrectly cleared all
access permission bits for privileged access to memory which is
user-accessible. It should only affect the privileged read and write
permissions; execute permission is dealt with via XN/PXN instead.
Fixes: 81636b70c226dc27d7ebc8d
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Compare the pseudocode AArch64.CheckPermission().
---
target/arm/helper.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 163c91a1ccd..ed7eb8ab54e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10025,9 +10025,11 @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64,
prot_rw = user_rw;
} else {
if (user_rw && regime_is_pan(env, mmu_idx)) {
- return 0;
+ /* PAN forbids data accesses but doesn't affect insn fetch */
+ prot_rw = 0;
+ } else {
+ prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
}
- prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
}
if (ns && arm_is_secure(env) && (env->cp15.scr_el3 & SCR_SIF)) {
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-5.0] target/arm: PSTATE.PAN should not clear exec bits
2020-03-30 17:06 [PATCH for-5.0] target/arm: PSTATE.PAN should not clear exec bits Peter Maydell
@ 2020-03-30 19:41 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2020-03-30 19:41 UTC (permalink / raw)
To: Peter Maydell, qemu-arm, qemu-devel
On 3/30/20 10:06 AM, Peter Maydell wrote:
> Our implementation of the PSTATE.PAN bit incorrectly cleared all
> access permission bits for privileged access to memory which is
> user-accessible. It should only affect the privileged read and write
> permissions; execute permission is dealt with via XN/PXN instead.
>
> Fixes: 81636b70c226dc27d7ebc8d
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Compare the pseudocode AArch64.CheckPermission().
> ---
> target/arm/helper.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Oops,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-30 19:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 17:06 [PATCH for-5.0] target/arm: PSTATE.PAN should not clear exec bits Peter Maydell
2020-03-30 19:41 ` Richard Henderson
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).