Skip to content

Check vector number and pointer to ISR in "_isr_wrapper" routine for aarch64 #29776

@vladimir-podbrezsky

Description

@vladimir-podbrezsky

Problem description:
In file “Kconfig.defconfig.viper_bcm58402_a72” defined NUM_IRQS as 240. It the same time GIC may rise some special purpose interrupts in range 1020 up to 1023. These vectors are out of _sw_isr_table and it case to invoking of wrong function.
I propose to check

  1. GIC rises interrupt that is less than CONFIG_NUM_IRQS
  2. Pointer to ISR is not NULL.

For example, I added some lines to isr_wrapper.S as following

stp x0, x1, [sp, #-16]!
cmp x0, #CONFIG_NUM_IRQS				// new line 
b.hi spr						// new line 
lsl x0, x0, #4 /* table is 16-byte wide */

/* Retrieve the interrupt service routine */
ldr	x1, =_sw_isr_table
add	x1, x1, x0
ldp	x0, x3, [x1] /* arg in x0, ISR in x3 */
cmp	x3, #0x0					// new line 
b.eq spr						// new line 
/*
 * Call the ISR. Unmask and mask again the IRQs to support nested
 * exception handlers
 */
msr	daifclr, #(DAIFSET_IRQ)
blr	x3
msr	daifset, #(DAIFSET_IRQ)

spr: // new line

/* Signal end-of-interrupt */
ldp x0, x1, [sp], #16

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions