qiling icon indicating copy to clipboard operation
qiling copied to clipboard

Multithreaded mode is missing initialization in Linux

Open FernandoDoming opened this issue 3 years ago • 1 comments

ql.os.thread_class is not properly initialized in multithreaded mode for Linux and thus attempting to run any binary results in an exception.

$ qltool run -f f9ab06de9ffa4b27692b3ed687c1b3ff8717d41a5950e7eaa9a3656b40bed8ca -m --rootfs ~/rootfs
Traceback (most recent call last):
  File "/home/fdd/.local/bin/qltool", line 253, in <module>
    ql.run(timeout=options.timeout)
  File "/home/fdd/.local/lib/python3.10/site-packages/qiling/core.py", line 573, in run
    self.os.run()
  File "/home/fdd/.local/lib/python3.10/site-packages/qiling/os/linux/linux.py", line 147, in run
    thread_management.run()
  File "/home/fdd/.local/lib/python3.10/site-packages/qiling/os/linux/thread.py", line 606, in run
    self.main_thread = self.ql.os.thread_class.spawn(self.ql, self.ql.loader.elf_entry, self.ql.os.exit_point)
AttributeError: 'NoneType' object has no attribute 'spawn'

Tested in Ubuntu 22.04 / Python 3.10.

FernandoDoming avatar Aug 16 '22 14:08 FernandoDoming

Hi there. This multithreaded Linux example works perfectly fine over here:

python3 ./qltool run -f examples/rootfs/x86_linux/bin/x86_multithreading --rootfs examples/rootfs/x86_linux -m

What Qiling version are you using? Can you give more details about this issue?

elicn avatar Nov 21 '22 07:11 elicn