target/arm: PSTATE.PAN should not clear exec bits

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

Backports commit f4e1dbc578a051db08a40c05276ebf525b98f949 from qemu
This commit is contained in:
Peter Maydell 2020-04-30 07:20:18 -04:00 committed by Lioncash
parent f0a864a8d9
commit 4228e7f155

View file

@ -9779,7 +9779,10 @@ 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);
}