NJU-ProjectN / nemu

NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching
Other
844 stars 180 forks source link

Runing difftest may cause crash #24

Closed marryjianjian closed 2 years ago

marryjianjian commented 2 years ago

I had a crash when I was doing PA2-2-Differential Testing. I collapsed in getopt_long. The following is a screenshot of the crash. 图片

After a few traceing and debuging with nemu and glibc, I think maybe the flag RTLD_DEEPBIND cause this crash (Of course I am not seting CC_ASAN in Kconfig). When I just open the dynamic library with flag RTLD_LAZY, the program won't crash.

https://github.com/NJU-ProjectN/nemu/blob/49366fa402efdbeee305785e15ff21b8e0a660f6/src/cpu/difftest/dut.c#L51

I am not sure about the specific reason, but I hope this information is helpful.

sashimi-yzh commented 2 years ago

You are right. Removing RTLD_DEEPBIND will help. We also have a patch to fix this issue. See here for more information.

marryjianjian commented 2 years ago

Thanks! It solves my problem!