qilingframework / qiling

A True Instrumentable Binary Emulation Framework
https://qiling.io
GNU General Public License v2.0
5.06k stars 737 forks source link

Problem syscall_mmap_impl #1444

Open R3n3r0 opened 7 months ago

R3n3r0 commented 7 months ago

*Describe the bug I wanted to try to run an Android shellcode with Qiling, but during execution I get the following error

Sample Code

shellcode = open("./t.sc", "rb").read()
    rootfs = "examples/rootfs/arm64_android6.0"
    ostype = "android"
    archtype = "arm64"
    output = "default"

    ql = Qiling(
        code=shellcode,
        rootfs=rootfs,
        archtype=QL_ARCH.ARM64, ostype=QL_OS.LINUX, verbose=QL_VERBOSE.DEBUG
    )

Error:

[+]     Profile: default
[+]     Received interrupt: 0x2
[x]     Syscall ERROR: ql_syscall_mmap DEBUG: 'QlLoaderELF' object has no attribute 'mmap_address'
Traceback (most recent call last):
  File "qiling/qiling/os/posix/posix.py", line 213, in load_syscall
    retval = syscall_hook(self.ql, *params)
  File "qiling/qiling/os/posix/syscall/mman.py", line 220, in ql_syscall_mmap
    return syscall_mmap_impl(ql, addr, length, prot, flags, fd, pgoffset, 1)
  File "qiling/qiling/os/posix/syscall/mman.py", line 137, in syscall_mmap_impl
    addr = ql.mem.find_free_space(mapping_size, max(addr, ql.loader.mmap_address))
AttributeError: 'QlLoaderELF' object has no attribute 'mmap_address'