qiling
qiling copied to clipboard
IOCTL returns EPERM with Multithread=True
IOCTL returns EPERM with Multithread=True Hello, I'm trying to emulate an IoT software that performs an ioctl to a specific interface.
I obtain the error EPERM with ioctl and bind syscall. I tried to emulate the software just with qemu-user and it works fine.
Sample Code
ql = Qiling(path, rootfs, multithread=True)
ql.run()
Output
[=] [Thread 2000] open(filename = 0x291b4, flags = 0x20000, mode = 0x1b6) = 0x4
[=] [Thread 2000] read(fd = 0x4, buf = 0x293b0, length = 0x1fff) = 0x79
[=] [Thread 2000] read(fd = 0x4, buf = 0x293b0, length = 0x1fff) = 0x0
[=] [Thread 2000] close(fd = 0x4) = 0x0
[=] [Thread 2000] flock(fd = 0x3, operation = 0x8) = 0x0
[=] [Thread 2000] clock_gettime(clock_id = 0x1, tp = 0x7ff3ca28) = 0x0
2231626.040 evt 1:1, code=20002,p=0
[=] [Thread 2000] write(fd = 0x1, buf = 0x900e5000, count = 0x24) = 0x24
[=] [Thread 2000] socket(domain = 0x1d, type = 0x3, protocol = 0x1) = 0x4
[=] [Thread 2000] ioctl(fd = 0x4, cmd = 0x8933, arg = 0x7ff3ca68) = -0x1 (EPERM)
I tried with root permission and with this profile file:
[KERNEL]
uid = 0
gid = 0
[NETWORK]
# To use IPv6 or not, to avoid binary double bind. ipv6 and ipv4 bind the same port at the same time
bindtolocalhost = True
# Bind to localhost
ipv6 = True
Thanks