Skip to content

Initial IRQ stack pointer needs to be in ROM #8271

@andrewboie

Description

@andrewboie

Memory corruption can affect exception handling since for all arches, the stack pointer for handling exceptions is fetched from _kernel. If _kernel is corrupted the stack pointer could get set to some insane value and cause a double fault. However this value doesn't need to be in RAM, it's computed once as K_THREAD_STACK_BUFFER(_interrupt_stack) + CONFIG_ISR_STACK_SIZE and is never touched again. It's essentially a read-only value. It doesn't need to be in RAM.

Remove the irq_stack members from _kernel (for both UP and SMP) and use ROM for it. Initialize a const read-only array at buiild time which contains this information for each CPU, stored in ROM/text region, and have the exception handler read that instead. Do this for all arches.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions