I've written a simple C binary like so:
#include <stdio.h>
int main() {
printf("hi!");
return 0;
}
I compiled it with gcc -m32 -o test test.c
My qiling script loads the binary like this:
from qiling import *
from qiling.const import *
rootfs = '/mnt/d/rootfs/x86_linux'
ql = Qiling(['./test'], rootfs, archtype='x86', ostype='Linux', verbose=QL_VERBOSE.DEBUG)
ql.run()
I execute the script with python3 test.py
.
Results:
[+] Profile: default
[+] Mapping GDT at 0x30000 with limit 0x1000
[+] Mapped 0x56555000-0x56556000
[+] Mapped 0x56556000-0x56557000
[+] Mapped 0x56557000-0x56558000
[+] Mapped 0x56558000-0x5655a000
[+] mem_start : 0x56555000
[+] mem_end : 0x5655a000
[+] Interpreter path: /mnt/d/rootfs/x86_linux/lib/ld-linux.so.2
[+] Interpreter addr: 0x47ba000
[+] Mapped 0x47ba000-0x47e0000
[+] Mapped 0x47e0000-0x47e2000
[+] mmap_address is : 0x90000000
[+] rel name b'_ITM_deregisterTMCloneTable'
[+] rel name b'__cxa_finalize'
[+] rel name b'__gmon_start__'
[+] rel name b'_ITM_registerTMCloneTable'
[+] rel name b'__libc_start_main'
[+] rel name b'printf'
[+] Received interrupt: 0x80
[+] 0x047d32c7: brk(inp = 0x0) = 0x5655c000
[+] Received interrupt: 0x80
[+] 0x047d484d: uname(buf = 0x7ff3caca) = 0x0
[+] Received interrupt: 0x80
[+] No such file or directory: /etc/ld.so.nohwcap
[+] 0x047c8946: access(path = 0x47d7203, mode = 0x0) = -0x1 (EPERM)
[+] Received interrupt: 0x80
[+] No such file or directory: /etc/ld.so.preload
[+] 0x047d468b: access(path = 0x47d891c, mode = 0x4) = -0x1 (EPERM)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /etc/ld.so.cache, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x47d759b, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/tls/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/tls/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/tls/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/tls/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/tls/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/tls/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/tls/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/tls", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i386-linux-gnu/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i386-linux-gnu", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/tls/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/tls/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/tls/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/tls/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/tls/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/tls/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/tls/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/tls", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /usr/lib/i386-linux-gnu/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/usr/lib/i386-linux-gnu", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/tls/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/tls/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/tls/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/tls/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/tls/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/tls/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/tls/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/tls", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i686/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i686/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/i686/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/i686", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/sse2/libc.so.6, mode = 0o0) = -2
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] stat64("/lib/sse2", 0x7ff3c770) read/write fail
[+] 0x047d43db: stat64(path = 0x7ff3c6f0, buf_ptr = 0x7ff3c770) = -0x2 (ENOENT)
[+] Received interrupt: 0x80
[+] openat(fd = -100, path = /lib/libc.so.6, mode = 0o0) = 3
[+] 0x047d44b7: openat(fd = 0xffffff9c, path = 0x7ff3c6f0, flags = 0x80000, mode = 0x0) = 0x3
[+] Received interrupt: 0x80
[+] read() CONTENT: b'\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00`\x17\x02\x004\x00\x00\x00\x90j"\x00\x00\x00\x00\x004\x00 \x00\r\x00(\x00?\x00>\x00\x06\x00\x00\x004\x00\x00\x004\x00\x00\x004\x00\x00\x00\xa0\x01\x00\x00\xa0\x01\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\xa08\x1c\x00\xa08\x1c\x00\xa08\x1c\x00\x13\x00\x00\x00\x13\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00d\xf8\x01\x00d\xf8\x01\x00\x04\x00\x00\x00\x00\x10\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\xe2\xdc\x17\x00\xe2\xdc\x17\x00\x05\x00\x00\x00\x00\x10\x00\x00\x01\x00\x00\x00\x00\xe0\x19\x00\x00\xe0\x19\x00\x00\xe0\x19\x00\xfcJ\x08\x00\xfcJ\x08\x00\x04\x00\x00\x00\x00\x10\x00\x00\x01\x00\x00\x00\x143"\x00\x14C"\x00\x14C"\x00\x04,\x00\x00\xa8\xc4\x00\x00\x06\x00\x00\x00\x00\x10\x00\x00\x02\x00\x00\x00\xacM"\x00\xac]"\x00\xac]"\x00\xe8\x00\x00\x00\xe8\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\xd4\x01\x00\x00\xd4\x01\x00\x00\xd4\x01\x00\x00`\x00\x00\x00`\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x07\x00\x00\x00\x143"\x00\x14C"\x00\x14C"\x00\x08\x00\x00\x00T\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00S\xe5td\x18\x02\x00\x00\x18\x02\x00\x00\x18\x02\x00\x00\x1c\x00\x00\x00\x1c\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00P\xe5td\xb48\x1c\x00\xb48\x1c\x00\xb48\x1c\x00\xec{\x00\x00\xec{\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00Q\xe5td\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x10\x00\x00\x00R\xe5td\x143"\x00\x14C"\x00\x14C"\x00\xec\x1c\x00\x00\xec\x1c\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x14\x00\x00\x00\x03\x00\x00\x00GNU\x00\xf1\xd0\x8a9\x18\xf1\xa3\x8e\x9f\x08]\xfa\xdb9\xcf\x8a\xc2u\x0cj\x04\x00\x00\x00\x10\x00\x00\x00'
[+] 0x047d4580: read(fd = 0x3, buf = 0x7ff3c840, length = 0x200) = 0x200
[+] Received interrupt: 0x80
[+] 0x047d4619: _llseek(fd = 0x3, offset_high = 0x0, offset_low = 0x1d4, result = 0x7ff3c5f0, whence = 0x0) = 0x0
[+] Received interrupt: 0x80
[+] read() CONTENT: b'\x04\x00\x00\x00\x14\x00\x00\x00\x03\x00\x00\x00GNU\x00\xf1\xd0\x8a9\x18\xf1\xa3\x8e\x9f\x08]\xfa\xdb9\xcf\x8a\xc2u\x0cj\x04\x00\x00\x00\x10\x00\x00\x00\x01\x00\x00\x00GNU\x00\x00\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x0c\x00\x00\x00\x05\x00\x00\x00GNU\x00\x02\x00\x00\xc0\x04\x00\x00\x00\x03\x00\x00\x00'
[+] 0x047d4580: read(fd = 0x3, buf = 0x7ff3c620, length = 0x60) = 0x60
[+] Received interrupt: 0x80
[+] 0x047d441b: fstat64(fd = 0x3, buf_ptr = 0x7ff3c770) = 0x0
[+] Received interrupt: 0x80
[+] mmap2 - mapping needed for 0x90000000
[+] mmap2 - addr range 0x90000000 - 0x90001fff:
[+] 0x047d47b0: mmap2(addr = 0x0, length = 0x2000, prot = 0x3, flags = 0x22, fd = 0xffffffff, pgoffset = 0x0) = 0x90000000
[+] Received interrupt: 0x80
[+] mmap2 - mapping needed for 0x90002000
[+] mmap2 - addr range 0x90002000 - 0x90232fff:
[+] mem write : 0x227468
[+] mem mmap : /mnt/d/rootfs/x86_linux/lib/libc.so.6
[+] 0x047d47b0: mmap2(addr = 0x0, length = 0x2307bc, prot = 0x1, flags = 0x802, fd = 0x3, pgoffset = 0x0) = 0x90002000
[+] Received interrupt: 0x80
[+] 0x047d4824: mprotect(start = 0x90022000, mlen = 0x204000, prot = 0x0) = 0x0
[+] Received interrupt: 0x80
[+] mmap2 - MAP_FIXED, mapping not needed
[+] mem write : 0x17e000
[+] mem mmap : /mnt/d/rootfs/x86_linux/lib/libc.so.6
[+] 0x047d47b0: mmap2(addr = 0x90022000, length = 0x17e000, prot = 0x5, flags = 0x812, fd = 0x3, pgoffset = 0x20) = 0x90022000
[+] Received interrupt: 0x80
[+] mmap2 - MAP_FIXED, mapping not needed
[+] mem write : 0x85000
[+] mem mmap : /mnt/d/rootfs/x86_linux/lib/libc.so.6
[+] 0x047d47b0: mmap2(addr = 0x901a0000, length = 0x85000, prot = 0x1, flags = 0x812, fd = 0x3, pgoffset = 0x19e) = 0x901a0000
[+] Received interrupt: 0x80
[+] mmap2 - MAP_FIXED, mapping not needed
[+] mem write : 0x3000
[+] mem mmap : /mnt/d/rootfs/x86_linux/lib/libc.so.6
[+] 0x047d47b0: mmap2(addr = 0x90226000, length = 0x3000, prot = 0x3, flags = 0x812, fd = 0x3, pgoffset = 0x223) = 0x90226000
[+] Received interrupt: 0x80
[+] mmap2 - MAP_FIXED, mapping not needed
[+] 0x047d47b0: mmap2(addr = 0x90229000, length = 0x97bc, prot = 0x3, flags = 0x32, fd = 0xffffffff, pgoffset = 0x0) = 0x90229000
[+] Received interrupt: 0x80
[+] 0x047d4757: close(fd = 0x3) = 0x0
[+] Received interrupt: 0x80
[+] set_thread_area base : 0x90001000 limit is : 0xfffff
[+] 0x047babdb: set_thread_area(u_info_addr = 0x7ff3cc50) = 0x0
[+] Received interrupt: 0x80
[+] 0x047d4824: mprotect(start = 0x90226000, mlen = 0x2000, prot = 0x1) = 0x0
[+] Received interrupt: 0x80
[+] 0x047d4824: mprotect(start = 0x56558000, mlen = 0x1000, prot = 0x1) = 0x0
[+] Received interrupt: 0x80
[+] 0x047d4824: mprotect(start = 0x47e0000, mlen = 0x1000, prot = 0x1) = 0x0
[+] Received interrupt: 0x80
[+] getrandom() CONTENT: ff 68 9b be
[+] 0x047bac52: getrandom(buf = 0x9022bb50, buflen = 0x4, flags = 0x1) = 0x4
[+] Received interrupt: 0x80
[+] mmap2 - mapping needed for 0x90233000
[+] mmap2 - addr range 0x90233000 - 0x90332fff:
[+] 0x047bac52: mmap2(addr = 0x0, length = 0x100000, prot = 0x3, flags = 0x22, fd = 0xffffffff, pgoffset = 0x0) = 0x90233000
[x] CPU Context:
[x] ah : 0x0
[x] al : 0x0
[x] ch : 0x75
[x] cl : 0x20
[x] dh : 0x75
[x] dl : 0x89
[x] bh : 0x80
[x] bl : 0x0
[x] ax : 0x0
[x] cx : 0x7520
[x] dx : 0x7589
[x] bx : 0x8000
[x] sp : 0xcda0
[x] bp : 0x7156
[x] si : 0x7156
[x] di : 0x7589
[x] ip : 0xc92d
[x] eax : 0x0
[x] ecx : 0x90237520
[x] edx : 0x90237589
[x] ebx : 0x90228000
[x] esp : 0x7ff0cda0
[x] ebp : 0x47d7156
[x] esi : 0x47d7156
[x] edi : 0x90237589
[x] eip : 0x9016c92d
[x] cr0 : 0x11
[x] cr1 : 0x0
[x] cr2 : 0x0
[x] cr3 : 0x0
[x] cr4 : 0x0
[x] cr8 : 0x0
[x] st0 : 0x0
[x] st1 : 0x0
[x] st2 : 0x0
[x] st3 : 0x0
[x] st4 : 0x0
[x] st5 : 0x0
[x] st6 : 0x0
[x] st7 : 0x0
[x] eflags : 0x6
[x] cs : 0x1b
[x] ss : 0x28
[x] ds : 0x28
[x] es : 0x28
[x] fs : 0x0
[x] gs : 0x63
[x] Hexdump:
[x] 81 c3 d3 b6 0b 00 81 ec
[x] Disassembly:
[=] 9016c92d [[mmap2] libc.so.6 + 0x14a92d] 81 c3 d3 b6 0b 00 add ebx, 0xbb6d3
[=] 9016c933 [[mmap2] libc.so.6 + 0x14a933] 81 ec 2c 04 00 00 sub esp, 0x42c
[=] 9016c939 [[mmap2] libc.so.6 + 0x14a939] 8b 8c 24 40 04 00 00 mov ecx, dword ptr [esp + 0x440]
[=] 9016c940 [[mmap2] libc.so.6 + 0x14a940] 89 4c 24 0c mov dword ptr [esp + 0xc], ecx
[=] 9016c944 [[mmap2] libc.so.6 + 0x14a944] 65 8b 15 14 00 00 00 mov edx, dword ptr gs:[0x14]
[=] 9016c94b [[mmap2] libc.so.6 + 0x14a94b] 89 94 24 1c 04 00 00 mov dword ptr [esp + 0x41c], edx
[=] 9016c952 [[mmap2] libc.so.6 + 0x14a952] 31 d2 xor edx, edx
[=] 9016c954 [[mmap2] libc.so.6 + 0x14a954] 8d 93 a7 2e f9 ff lea edx, [ebx - 0x6d159]
[=] 9016c95a [[mmap2] libc.so.6 + 0x14a95a] 89 54 24 08 mov dword ptr [esp + 8], edx
[=] 9016c95e [[mmap2] libc.so.6 + 0x14a95e] 85 c0 test eax, eax
[=] 9016c960 [[mmap2] libc.so.6 + 0x14a960] 75 4a jne 0x9016c9ac
[=] 9016c962 [[mmap2] libc.so.6 + 0x14a962] 80 3f 00 cmp byte ptr [edi], 0
[=] 9016c965 [[mmap2] libc.so.6 + 0x14a965] 8d 8b 1c 31 f9 ff lea ecx, [ebx - 0x6cee4]
[=] 9016c96b [[mmap2] libc.so.6 + 0x14a96b] 75 06 jne 0x9016c973
[x] PC = 0x9016c92d
[x] Memory map:
[x] Start End Perm Label Image
[x] 0000030000 - 0000031000 rwx [GDT]
[x] 00047ba000 - 00047e0000 r-x ld-linux.so.2 /mnt/d/rootfs/x86_linux/lib/ld-linux.so.2
[x] 00047e0000 - 00047e1000 r-- ld-linux.so.2 /mnt/d/rootfs/x86_linux/lib/ld-linux.so.2
[x] 00047e1000 - 00047e2000 rw- ld-linux.so.2 /mnt/d/rootfs/x86_linux/lib/ld-linux.so.2
[x] 0056555000 - 0056556000 r-- test /mnt/d/scripts/test
[x] 0056556000 - 0056557000 r-x test /mnt/d/scripts/test
[x] 0056557000 - 0056558000 r-- test /mnt/d/scripts/test
[x] 0056558000 - 0056559000 r-- test /mnt/d/scripts/test
[x] 0056559000 - 005655a000 rw- test /mnt/d/scripts/test
[x] 005655a000 - 005655c000 rwx [hook_mem]
[x] 007ff0d000 - 007ff3d000 rwx [stack]
[x] 0090000000 - 0090002000 rw- [syscall_mmap2]
[x] 0090002000 - 0090022000 r-- [mmap2] libc.so.6
[x] 0090022000 - 00901a0000 r-x [mmap2] libc.so.6
[x] 00901a0000 - 0090225000 r-- [mmap2] libc.so.6
[x] 0090225000 - 0090226000 --- [mmap2] libc.so.6
[x] 0090226000 - 0090228000 r-- [mmap2] libc.so.6
[x] 0090228000 - 0090229000 rw- [mmap2] libc.so.6
[x] 0090229000 - 0090233000 rw- [mmap2] libc.so.6
[x] 0090233000 - 0090333000 rw- [syscall_mmap2]
Traceback (most recent call last):
File "/mnt/d/scripts/test.py", line 7, in <module>
ql.run()
File "~/.local/lib/python3.10/site-packages/qiling/core.py", line 574, in run
self.os.run()
File "~/.local/lib/python3.10/site-packages/qiling/os/linux/linux.py", line 177, in run
self.ql.emu_start(self.ql.loader.elf_entry, self.exit_point, self.ql.timeout, self.ql.count)
File "~/.local/lib/python3.10/site-packages/qiling/core.py", line 713, in emu_start
self.uc.emu_start(begin, end, timeout, count)
File "~/.local/lib/python3.10/site-packages/unicorn/unicorn.py", line 547, in emu_start
raise UcError(status)
unicorn.unicorn.UcError: Invalid memory write (UC_ERR_WRITE_UNMAPPED)