The NMI IRQ (-14) is denied run-time registration
- Dominant language
- C
- Stars
- 135
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Description
Some platforms, like the [K64F development kit](https://developer.mbed.org/platforms/FRDM-K64F/), have mapped hardware buttons to the NMI (IRQ# -14). The current uVisor implementation has defined [unvic_default_check](https://github.com/ARMmbed/uvisor/blob/2f23bf0781263a895967c54d3635b63726b47d9a/core/system/src/unvic.c#L43) which performs an unsigned comparison against the architecture-specific constant NVIC_VECTORS.
```
static void unvic_default_check(uint32_t irqn)
{
/* IRQn goes from 0 to (NVIC_VECTORS - 1) */
if(irqn >= NVIC_VECTORS)
{
HALT_ERROR(NOT_ALLOWED,
"Not allowed: IRQ %d is out of range\n\r", irqn);
}
/* check if uvisor does not already own the IRQn slot */
if(g_isr_vector[NVIC_OFFSET + irqn] != &isr_default_handler)
{
HALT_ERROR(PERMISSION_DENIED,
"Permission denied: IRQ %d is owned by uVisor\n\r", irqn);
}
}
```
The unsigned comparison, by definition, assumes the requested registration is for a positive entry. Although interrupts -1 through -13 are critical to system integrity and should be managed by uVisor, the NMI interrupt, in this case, should have a special case exception.
Contributor guide
Research direction
Start in core/system/src/unvic.c at unvic_default_check and inspect how NVIC_VECTORS and the signed NMI IRQ number are handled. Verify the behavior for IRQ -14 while preserving uVisor ownership checks for the other protected interrupts; done means NMI registration is accepted on affected platforms without weakening those protections.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100