yang zhang created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/473

Project:Branches: yang.zhang/rtems:fix_potential_interrupt_crash to 
rtems/rtos/rtems:main
Author:   yang zhang




## Summary
In some special cases when disbale `CONFIGURE_RECORD_INTERRUPTS_ENABLED`, it 
will link
`bsp_interrupt_get_dispatch_table_slot` in `irq-record.c` but not the one in 
`irq-generic.c`.

Then when install interrupt handlers by `rtems_interrupt_handler_install`, they 
would be installed
in `_Record_Interrupt_dispatch_table` array, but when dispatch interrupts by
`bsp_interrupt_handler_dispatch_unchecked`, it iterate 
`bsp_interrupt_dispatch_table` array, then
would be crashed.

So we should only define `bsp_interrupt_get_dispatch_table_slot` in 
`irq-generic.c` when enable 
`CONFIGURE_RECORD_INTERRUPTS_ENABLED`.

By the way, this issue only reproduce in myself project for a special board 
when building a example not
a simple testsuite. I try to reproduce it on the aarch64/zynqmp_qemu, but 
failed to reproduce. This issue
can be only reproduce when the exe link the 
`bsp_interrupt_get_dispatch_table_slot` in `irq-record.c`, but
i have not find the reason why there is a link difference, but i think 
`bsp_interrupt_get_dispatch_table_slot`
in `irq-record.c` should be a potential problem.

I have extracted some logs of the linking process.

attempt to open 
../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.so failed
attempt to open 
../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a succeeded
../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)uart_put.S.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)cache.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)clockdrv.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)mips_timer.S.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)inittlb.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)bsp_fdt.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)ls1b_dtb.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)getentropy-cpucounter.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)ls_idtmem.S.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)ls_idttlb.S.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)console-polled.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)bootcard.c.7.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)bspfatal-default.c.7.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-handler-install.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-lock.c.13.o
>>(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-record.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-server.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-shell.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)console-io.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)bspreset.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)bspstart.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)vectorexceptions.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-generic.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-handler-iterate.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-handler-remove.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-info.c.13.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)vectorisrs.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)ls_installisrentries.c.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)isr_entries.S.26.o
(../../../../../../../RTEMS/rtems/6/mips-rtems6/ls1b/lib/librtemsbsp.a)irq-entry-remove.c.13.o

<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/473
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
bugs@rtems.org
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to