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 4 commits 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

@hamjin hamjin force-pushed the main branch 2 times, most recently from 5fb13c1 to c228c23 Compare September 22, 2024 02:00
@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]>
rsuntk pushed a commit to rsuntk/KernelSU that referenced this pull request Feb 11, 2025
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.

Rissu's note: "I still thinking about this comment tiann#2084 (comment), i'll drop it if this changed."

Co-authored-by: hamjin <[email protected]>
Signed-off-by: Rissu <[email protected]>
Thereache pushed a commit to Thereache/android_kernel_xiaomi_redwood that referenced this pull request Feb 12, 2025
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.

Rissu's note: "I still thinking about this comment tiann/KernelSU#2084 (comment), i'll drop it if this changed."

Co-authored-by: hamjin <[email protected]>
Signed-off-by: Rissu <[email protected]>
ChiseWaguri added a commit to ChiseWaguri/android_kernel_xiaomi_marble that referenced this pull request Feb 24, 2025
This commit integrates manual hooks for KernelSU, replacing the kprobe-based approach.
This refactors original KSU hooks to replace deep kernel function hooks with targeted hooks.
This backports KernelSU pr#1657 and having pr#2084 elements (32-bit sucompat).
This transition minimizes the scope of kernel function interception while still maintaining full functionality.

references: tiann/KernelSU#1657, tiann/KernelSU#2084
	https://kernelsu.org/guide/how-to-integrate-for-non-gki.html

Co-Authored-by: backslashxx <[email protected]>
ChiseWaguri added a commit to ChiseWaguri/android_kernel_xiaomi_marble that referenced this pull request Feb 24, 2025
This commit integrates manual hooks for KernelSU, replacing the kprobe-based approach.
This refactors original KSU hooks to replace deep kernel function hooks with targeted hooks.
This backports KernelSU pr#1657 and having pr#2084 elements (32-bit sucompat).
This transition minimizes the scope of kernel function interception while still maintaining full functionality.

references: tiann/KernelSU#1657, tiann/KernelSU#2084, backslashxx/KernelSU#5
	https://kernelsu.org/guide/how-to-integrate-for-non-gki.html

Co-Authored-by: backslashxx <[email protected]>
ChiseWaguri added a commit to ChiseWaguri/android_kernel_xiaomi_marble that referenced this pull request Feb 24, 2025
This refactors original KSU hooks to replace deep kernel function hooks with targeted hooks.
This backports KernelSU pr#1657 and having pr#2084 elements (32-bit sucompat).
This transition reduces the scope of kernel function interception while still maintaining full functionality.

references:  backslashxx/KernelSU#5, tiann/KernelSU#1657, tiann/KernelSU#2084
	https://kernelsu.org/guide/how-to-integrate-for-non-gki.html

Co-Authored-by: backslashxx <[email protected]>
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Feb 25, 2025
bachnxuan pushed a commit to bachnxuan/kernel_new that referenced this pull request Feb 27, 2025
This commit integrates manual hooks for KernelSU, replacing the kprobe-based approach.
This refactors original KSU hooks to replace deep kernel function hooks with targeted hooks.
This backports KernelSU pr#1657 and having pr#2084 elements (32-bit sucompat).
This transition minimizes the scope of kernel function interception while still maintaining full functionality.

references: tiann/KernelSU#1657, tiann/KernelSU#2084, backslashxx/KernelSU#5
	https://kernelsu.org/guide/how-to-integrate-for-non-gki.html

Co-Authored-by: backslashxx <[email protected]>
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Mar 2, 2025
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Mar 2, 2025
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Mar 2, 2025
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Mar 3, 2025
pascua28 added a commit to pascua28/android_kernel_samsung_sm7150 that referenced this pull request Mar 3, 2025
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