KernelSU
KernelSU copied to clipboard
kernel: Fix compatibility with old and 32bit programs
In v0.9.3 and v0.9.4, we replaced vfs_statx and do_execveat_common with syscall hooks. But we missed fstatat64 and compat_execve and break compatibility with old and 32bit programs.
In one of the origin pull request(https://github.com/tiann/KernelSU/pull/1657), @tiann says "The compat_ series is not needed; because we don't support 32-bit ourselves; for the case of "kernel is 64-bit, but system is 32-bit", this situation did exist, but we have never provided a 32-bit manager, so it has never been supported, too." In fact, some 32bit binaries are still using compat syscalls to exec other programs.
In kali(NetHunter Terminal) __arm64_compat_sys_execve is directly called, while __arm64_sys_fstatat64 is called before it in JuiceSSH libcom_sonelli_bash.so(32bit bash-4.2) like the strace in #1813.
So add these two hooks back to fix them.
Fixes #2045, #1813
In order to be compatible with these applications that do not upgrade to 64-bit, we have to intercept these system calls on the devices of most users who probably won't even use these applications, which is very frustrating.
In order to be compatible with these applications that do not upgrade to 64-bit, we have to intercept these system calls on the devices of most users who probably won't even use these applications, which is very frustrating.
NetHunter Terminal is an 64bit app but using 32bit binaries. By the way, binaries in official Anykernl3 project are still 32bit and I have to replace them manually. :(