espressif/qemu

ASan issues (QEMU-161)

ra1u opened this issue · 1 comments

ra1u commented

It seems that having enabled ASan (in configure flags) fails during startup.

I haven't debugged that yet, but i suspect it is related with newer asan libraries and instrumentation. (for example my older qemu build binaries also fails after my linux os is upgraded).

For reference here is error against hello_world.

> % qemu-system-xtensa  -nographic -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw                                                                                                                     
==152540==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!                                                                                       
Adding SPI flash device                                                                                                                                                                                              
ets Jul 29 2019 12:21:46                                                                                                                                                                                             
                                                                                                                                                                                                                     
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)                                                                                                                                                              
AddressSanitizer:DEADLYSIGNAL                                                                                                                                                                                        
=================================================================                                                                                                                                                    
==152540==ERROR: AddressSanitizer: SEGV on unknown address 0x7fb618dbb420 (pc 0x555ddeb13c5d bp 0x7fb6197bbe40 sp 0x7fb6197bbcc0 T2)                                                                                 
==152540==The signal is caused by a READ memory access.                                                                                                                                                              
    #0 0x555ddeb13c5d in qemu_coroutine_switch ../util/coroutine-ucontext.c:315                                                                                                                                      
    #1 0x555ddeb1310d in coroutine_trampoline ../util/coroutine-ucontext.c:178                                                                                                                                       
    #2 0x7fb6a96bad9f  (/lib/x86_64-linux-gnu/libc.so.6+0x51d9f) (BuildId: 3a3387d1e5380587aa591ebab5717427aef768d0)                                                                                                 
                                                                                                                                                                                                                     
AddressSanitizer can not provide additional info.                                                                                                                                                                    
SUMMARY: AddressSanitizer: SEGV ../util/coroutine-ucontext.c:315 in qemu_coroutine_switch                                                                                                                            
Thread T2 created by T0 here:                                                                                                                                                                                        
    #0 0x7fb6aa247c26 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:208
    #1 0x555ddead990f in qemu_thread_create ../util/qemu-thread-posix.c:581            
    #2 0x555dde678b10 in mttcg_start_vcpu_thread ../accel/tcg/tcg-accel-ops-mttcg.c:153
    #3 0x555dddfff5bb in qemu_init_vcpu ../softmmu/cpus.c:648               
    #4 0x555dde38c920 in xtensa_cpu_realizefn ../target/xtensa/cpu.c:177    
    #5 0x555dde68790a in device_set_realized ../hw/core/qdev.c:510          
    #6 0x555dde69d235 in property_set_bool ../qom/object.c:2285             
    #7 0x555dde698e90 in object_property_set ../qom/object.c:1420            
    #8 0x555dde6a2090 in object_property_set_qobject ../qom/qom-qobject.c:28 
    #9 0x555dde6993d8 in object_property_set_bool ../qom/object.c:1489       
    #10 0x555dde6868af in qdev_realize ../hw/core/qdev.c:292                 
    #11 0x555dde196345 in esp32_soc_realize ../hw/xtensa/esp32.c:323         
    #12 0x555dde68790a in device_set_realized ../hw/core/qdev.c:510          
    #13 0x555dde69d235 in property_set_bool ../qom/object.c:2285             
    #14 0x555dde698e90 in object_property_set ../qom/object.c:1420           
    #15 0x555dde6a2090 in object_property_set_qobject ../qom/qom-qobject.c:28                             
    #16 0x555dde6993d8 in object_property_set_bool ../qom/object.c:1489                                   
    #17 0x555dde6868af in qdev_realize ../hw/core/qdev.c:292                                              
    #18 0x555dde1999b3 in esp32_machine_init ../hw/xtensa/esp32.c:782                                     
    #19 0x555dddc3b224 in machine_run_board_init ../hw/core/machine.c:1409                                
    #20 0x555dde01ebef in qemu_init_board ../softmmu/vl.c:2513                                            
    #21 0x555dde01f072 in qmp_x_exit_preconfig ../softmmu/vl.c:2609                                       
    #22 0x555dde023c2c in qemu_init ../softmmu/vl.c:3612                                                  
    #23 0x555dde67e76f in main ../softmmu/main.c:47