-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] kasan read access error in umm_initialize #12855
Comments
@Gary-Hobson could you take a look? |
It seems that Kasan is recursively checking when it is initialized. @Gary-Hobson |
@Rrooach After I updated to the latest mainline code, I used boards/risc-v/qemu-rv/rv-virt/configs/nsh64 to test and nothing unusual happened Can you provide a method that can be reproduced in the mainline code? defconfig:
Startup Command
|
the git version I used is 4197b5a And when I try the lastest mainline, seems I get: serial/uart_16550.c:230:21: error: 'CONFIG_16550_UART0_RX_TRIGGER' undeclared here (not in a function); did you mean 'CONFIG_16550_UART0_RXBUFSIZE'?
230 | .rxtrigger = CONFIG_16550_UART0_RX_TRIGGER,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| CONFIG_16550_UART0_RXBUFSIZE
[97/1243] Building C objec...fs.dir/fs_initialize.c.obj |
sorry for the misclose |
@Rrooach This configuration was added recently #12830, you may need to clear the out directory and compile again |
@Gary-Hobson Hi, I am not quiet understand what is going on here, but after I pull the lastest mainline: 2ff2b82, compile with: and then I start the qemu: qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 -bios none -kernel ./build_tt/nuttx -nographic -S -s I still get a memory error: Thread 1 hit Breakpoint 2, exception_common ()
at /path/to/nuttx/arch/risc-v/src/common/riscv_exception_common.S:112
112 addi sp, sp, -XCPTCONTEXT_SIZE
(gdb) bt
#0 exception_common ()
at /path/to/nuttx/arch/risc-v/src/common/riscv_exception_common.S:112
#1 0x00000000800075dc in kasan_set_poison (
addr=addr@entry=0x80056dd0, size=<optimized out>,
poisoned=poisoned@entry=false)
at /path/to/nuttx/mm/kasan/kasan.c:188
#2 0x00000000800076ac in kasan_unpoison (addr=addr@entry=0x80056dd0,
size=<optimized out>)
at /path/to/nuttx/mm/kasan/kasan.c:241
#3 0x0000000080007d52 in mm_malloc (heap=heap@entry=0x80056b00,
size=<optimized out>, size@entry=128)
at /path/to/nuttx/mm/mm_heap/mm_malloc.c:325
#4 0x0000000080007d84 in mm_zalloc (heap=0x80056b00,
size=size@entry=128)
at /path/to/nuttx/mm/mm_heap/mm_zalloc.c:45
#5 0x00000000800078a8 in zalloc (size=128)
at /path/to/nuttx/mm/umm_heap/umm_zalloc.c:70
#6 0x0000000080008ec8 in nx_start ()
at /path/to/nuttx/sched/init/nx_start.c:613
#7 0x00000000800005ee in qemu_rv_start (mhartid=<optimized out>,
dtb=0x87e00000 "\320\r\376\355")
at /path/to/nuttx/arch/risc-v/src/qemu-rv/qemu_rv_start.c:220
#8 0x0000000080000048 in _stext ()
at /path/to/nuttx/arch/risc-v/src/qemu-rv/qemu_rv_head.S:76
Backtrace stopped: frame did not save the PC However, I can successfully run the nuttx if I disable "enable asan for the entire image" |
In the above error, it seems that dataabort/unaligned access has occurred. It is not that Kasan actively panics after detecting the error. The following error is when executing the code at address 0x80006ec2, kasan detects that it accesses an unallocated memory (addr: 0x81f81580, size is 8)
@Rrooach Can you provide more information for analysis? |
Description / Steps to reproduce the issue
I'm encountering an illegal memory read error when running NuttX kernel built with (ASAN) for full image instrumentation. The kernel fails to run due to this error.
Steps to Reproduce:
GDB Debugging Session:
It appears that there is an illegal memory read operation in the nx_start() function, which is causing the kernel to fail. The error is detected by KASAN, and further investigation using GDB points to the kasan_mem_to_shadow function in kasan.c.
Do you have any idea what might cause this error?
On which OS does this issue occur?
[Linux]
What is the version of your OS?
Ubuntu
NuttX Version
masrer / git version 4197b5a
Issue Architecture
[risc-v]
Issue Area
[Kernel], [Memory Management]
Verification
The text was updated successfully, but these errors were encountered: