Prevent unprivileged from writing to the Software Triggered Interrupt register
Signed-off-by: Michael Davidsaver <mdavidsa...@gmail.com> --- hw/intc/armv7m_nvic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index ca8c93c..b744cd5 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -654,7 +654,9 @@ static void nvic_writel(nvic_state *s, uint32_t offset, uint32_t value) "NVIC: fault status registers unimplemented\n"); break; case 0xf00: /* Software Triggered Interrupt Register */ - if ((value & 0x1ff) < NVIC_MAX_IRQ) { + /* STIR write allowed if privlaged or USERSETMPEND set */ + if ((arm_current_el(&cpu->env) || (cpu->env.v7m.ccr&2)) + && ((value & 0x1ff) < NVIC_MAX_IRQ)) { armv7m_nvic_set_pending(s, (value&0x1ff)+16); } break; -- 2.1.4