-
Notifications
You must be signed in to change notification settings - Fork 755
Troubleshooting
This page lists some common problems you might encounter when using Qiling and how to resolve them.
Cause: Qiling is not installed in your Python environment or you are using a different Python interpreter than the one you installed it with.
Solution:
- Make sure you have installed Qiling using
pip install qiling
. - If you are using a virtual environment, ensure it is activated.
- Verify that the
python
command you are using to run your script is the same one thatpip
is associated with. You can check withwhich python
andwhich pip
.
Cause: The rootfs
is not set up correctly, and the emulated program cannot find a required library or file.
Example Error:
qiling.exception.QlFileNotFoundError: File ‘/lib/x86_64-linux-gnu/libc.so.6’ not found
Solution:
-
Check your
rootfs
path: Ensure therootfs
variable in your Qiling script points to the correct directory. -
Verify the
rootfs
contents: Make sure therootfs
you are using matches the architecture and OS of the binary you are emulating. For example, an x86_64 Linux binary needs anx8664_linux
rootfs. -
Check for missing libraries: Ensure the required shared libraries (like
libc
) exist within therootfs
directory structure.
Example Error:
unicorn.uc.UcError: Invalid memory read (UC_ERR_READ_UNMAPPED)
Cause: The program is trying to read from or write to a memory address that has not been mapped. This could be due to:
- A bug in the emulated program itself.
- An incorrect memory layout set up by Qiling.
- A missing or incorrect implementation of a syscall or API that was supposed to allocate that memory.
Solution:
-
Enable verbose logging: Run Qiling with
verbose=QL_VERBOSE.DEBUG
to get a detailed trace of the instructions leading up to the crash. -
Use the GDB stub: This is the most effective way to debug. Set
ql.debugger = "gdb"
and connect with a GDB client. You can then inspect the memory map, registers, and backtrace at the point of the crash. - Check your hooks: If you are using hooks, make sure they are not corrupting the memory or registers in an unexpected way.
Example Warning:
[+] syscall ‘some_syscall’ is not implemented, return 0
Cause: The emulated program is calling an OS function that Qiling does not yet have an implementation for.
Solution:
- Check for updates: The Qiling team is constantly adding new syscalls and APIs. Make sure you are using the latest version of Qiling.
-
Implement it yourself: This is a great way to contribute! You can define a Python function to handle the syscall/API and use
ql.os.set_syscall()
orql.os.set_api()
to register it. - Ignore it: If the function is not critical to the execution path you are analyzing, you can often ignore the warning. Qiling will typically return a default value (like 0) and continue.
If you encounter an issue that is not listed here, please feel free to open an issue on our GitHub repository.
- Home
- Getting Started
- Core Concepts
- Usage
- Features
- Tutorials
- Development
- Resources