-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qiling fails to run /bin/ls #1349
Comments
This is most likely caused due to a mismatch between the binary and the rootfs that is used to load it. |
I set my def null_rseq_impl(ql: Qiling, abi: int, length: int, flags: int, sig: int):
# do nothing
pass
ql.os.set_syscall('rseq', null_rseq_impl, QL_INTERCEPT.CALL) |
I believe this one is caused due to from qiling.const import QL_INTERCEPT
def __no_cet(ql: Qiling, code: int, addr: int, retval: int):
# intercept arch_prctl syscall after it exits. if code was set to ARCH_CET_STATUS,
# then return an error value. otherwise, return the value originally returned by
# the syscall.
#
# note: if -1 doesn't work, maybe should use -22 (-EINVAL) instead
return -1 if code == 0x3001 else retval
ql.os.set_syscall('arch_prctl', __no_cet, QL_INTERCEPT.EXIT) |
I tried on a 2.35 libc, and the patch I found in previous issues and here: https://cloud.tencent.com/developer/article/2144036 worked well, I still get a warning for the prctl syscall but it's running with no crash. But on newer libc the patchs are not working probably due to the hardcoded offsets which are maybe not the sames. |
The snippet above just patches the returned value, so you'll still be seeing the warning message. I guess we can fix that though, should be a straightforward one. Newer libc on Intel-based systems attempt to enable Intel CET, if it is supported. The problem with The long-term fix will be allowing users to select the emulated CPU (say, Icelake, or equivalent) so the feature will be supported. The short-term fix is just let libc know the feature is not supported, and that is what the snippet above does: it patches the returned value to a "not supported" value when the system is queried about CET. |
Running Qiling on a simple binary is crashing, it throws something about the libc version and in this case a problem about an
Operation not permitted
which is really weird|
v
The text was updated successfully, but these errors were encountered: