Skip to content
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

kernel: Fix compatibility with old and 32bit programs #2084

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hamjin
Copy link

@hamjin hamjin commented Sep 21, 2024

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(#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.
image
image

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

@tiann
Copy link
Owner

tiann commented Sep 22, 2024

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.

@hamjin
Copy link
Author

hamjin commented Sep 22, 2024

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. :(

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 NetHunter Terminal compat_execve is directly called, but `fstatat64`
is called before it in JuiceSSH bash-4.2. So add these two hooks back to
fix them.

Signed-off-by: hamjin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kernelSU内核在0.9.3之后无法正确授权按键精灵root权限
2 participants