7142eb9e24
In arm_v7m_mmu_idx_for_secstate() we get the 'priv' level to pass to armv7m_mmu_idx_for_secstate_and_priv() by calling arm_current_el(). This is incorrect when the security state being queried is not the current one, because arm_current_el() uses the current security state to determine which of the banked CONTROL.nPRIV bits to look at. The effect was that if (for instance) Secure state was in privileged mode but Non-Secure was not then we would return the wrong MMU index. The only places where we are using this function in a way that could trigger this bug are for the stack loads during a v8M function-return and for the instruction fetch of a v8M SG insn. Fix the bug by expanding out the M-profile version of the arm_current_el() logic inline so it can use the passed in secstate rather than env->v7m.secure. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20201022164408.13214-1-peter.maydell@linaro.org |
||
---|---|---|
.. | ||
a32-uncond.decode | ||
a32.decode | ||
arch_dump.c | ||
arm_ldst.h | ||
arm-powerctl.c | ||
arm-powerctl.h | ||
arm-semi.c | ||
cpu64.c | ||
cpu_tcg.c | ||
cpu-param.h | ||
cpu-qom.h | ||
cpu.c | ||
cpu.h | ||
crypto_helper.c | ||
debug_helper.c | ||
gdbstub64.c | ||
gdbstub.c | ||
helper-a64.c | ||
helper-a64.h | ||
helper-sve.h | ||
helper.c | ||
helper.h | ||
idau.h | ||
internals.h | ||
iwmmxt_helper.c | ||
kvm64.c | ||
kvm_arm.h | ||
kvm-consts.h | ||
kvm-stub.c | ||
kvm.c | ||
m_helper.c | ||
m-nocp.decode | ||
machine.c | ||
meson.build | ||
monitor.c | ||
mte_helper.c | ||
neon_helper.c | ||
neon-dp.decode | ||
neon-ls.decode | ||
neon-shared.decode | ||
op_addsub.h | ||
op_helper.c | ||
pauth_helper.c | ||
psci.c | ||
sve_helper.c | ||
sve.decode | ||
t16.decode | ||
t32.decode | ||
tlb_helper.c | ||
trace-events | ||
trace.h | ||
translate-a64.c | ||
translate-a64.h | ||
translate-neon.c.inc | ||
translate-sve.c | ||
translate-vfp.c.inc | ||
translate.c | ||
translate.h | ||
vec_helper.c | ||
vec_internal.h | ||
vfp_helper.c | ||
vfp-uncond.decode | ||
vfp.decode |