moralismercatus / crete

Open source concolic testing tool for binaries
1 stars 1 forks source link

QEMU freezes while testing coreutils/expand #166

Closed moralismercatus closed 8 years ago

moralismercatus commented 8 years ago

QEMU Version: 1.0 Mode: distributed

The bug was only observed using QEMU 1.0 and distributed mode. If using 2.3 or developer mode, the bug was not observed.

We attached gdb after it froze to locate the problem. The problem occurred in printing debugging information to std::cout. While we did not precisely identify the cause, it is likely a deadlock. QEMU maintains two threads. An IO thread that can preempt the main thread (so I'm told). In the back trace, it is found waiting on a pthread_mutex. After removing the std::cout statement, the problem went away. It is known that standard IO is not thread safe, but we were not aware of the conflict between QEMU's two threads that is likely the cause.

Another curiosity is the distinction between developer mode and distributed mode. The only substantive difference is that, in distributed mode, the vm-node spawns the QEMU instance, while in developer mode, the user must manually start it. As part of the vm-node's spawning, it may redirect IO streams which may factor into the situation in some way.