qilingframework / qilingframework/qiling

Multithreaded mode is missing initialization in Linux

Open
#1,209 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
798
Avg merge
1d 1h
Merged PRs (30d)
9

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with qiling/os/linux/linux.py and qiling/os/linux/thread.py, following the multithreaded path into thread_management.run(). Inspect how ql.os.thread_class is assigned before thread.py:606 calls spawn. Reproduce the qltool command from the report and confirm that running a Linux binary in multithreaded mode no longer raises the NoneType spawn exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems, reverse-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.