CallMESuper
8fe19d3876
kernel: fix issue with dfd parameter retrieval ( #1543 )
...
Although in most cases, this system call might not be used, or when
called, AT_FDCWD(-100) is passed in.
2024-03-27 16:29:53 +08:00
weishu
858ec910fd
kernel: clean memory when exit
2024-03-24 16:41:53 +08:00
weishu
bc1e03feb1
kernel: remove unused headers
2024-03-20 23:14:30 +08:00
weishu
71b56ba700
kernel: fix panic cast
2024-03-20 15:39:07 +08:00
weishu
815f4d0428
kernel: hook newfstatat/faccessat syscall instead of unstable symbol
2024-03-20 15:15:26 +08:00
weishu
b7f937b7f9
kernel: fix su not working in shell for 6.1 kernel
2023-11-13 15:06:25 +08:00
Levi Zim
cbb98a1de9
Copy one extra byte from userspace filename ( #958 )
...
Otherwise we will rewrite paths for filenames that begins with
`/system/bin/su`.
This fix copies one extra byte from userspace filename so that when we
encounter filenames like `/system/bin/suasf`,
`/system/bin/su\0` gets compared with `/system/bin/sua`, which correctly
prevents the `su -> sh` path rewriting.
Close #957
2023-09-16 12:23:04 +08:00
4qwerty7
f4d2b0feab
Distinguish different PT_REGS_PARM4 under x86 ( #711 )
...
1. `PT_REGS_CCALL_PARM4` 表示存放C调用约定的第4个参数的寄存器
2. `PT_REGS_SYSCALL_PARM4` 表示存放linux syscall调用约定的第4个参数的寄存器
3. 将原有 `PT_REGS_PARM4` 改为上述之一
4. 将原有 `ksu_handle_execveat_ksud` 和 `ksu_handle_execveat_sucompat` 可能被
kprobe 传递错误实参、且不使用的形参标记为 never_used 并传递 `NULL`
5. 为 `ksu_handle_execveat_ksud` 提供正确的 argv 参数用以在 x86 下也能正确识别 `init
second_stage`
---------
Co-authored-by: weishu <twsxtd@gmail.com>
2023-07-06 09:01:35 +08:00
weishu
da959b4e17
kernel: fix compile err on lower kernel
2023-06-27 20:46:09 +08:00
weishu
b644c124e3
kernel: copy filename ourself instead of getname
2023-06-26 19:28:40 +08:00
weishu
e17f3eab96
Revert "kernel: use vfs_fstatat on kernel 5.10+, vfs_statx may have cfi."
...
This reverts commit cd3e29248979fb41b6edc34395033726716c5cf5.
2023-06-22 14:37:17 +08:00
weishu
5f1d70dabb
Revert "kernel: getname might sleep in kprobe handler ( #670 )"
...
This reverts commit 79bb9813efbb8e56bdf9fc2a64088f40f2425faf.
2023-06-22 12:54:30 +08:00
weishu
79bb9813ef
kernel: getname might sleep in kprobe handler ( #670 )
2023-06-22 10:54:50 +08:00
weishu
cd3e292489
kernel: use vfs_fstatat on kernel 5.10+, vfs_statx may have cfi.
2023-06-20 18:42:41 +08:00
Juhyung Park
bd8434f4f4
Hook improvements (take 2) ( #563 )
...
Hi @tiann.
Thanks for the great project, I had great fun playing around with it.
This PR mainly tries to further minimize the possible delays caused by
KernelSU hooking.
There are 3 major changes:
- Processes with 0 < UID < 2000 are blocked straight-up before going
through the allow_list.
I don't see any need for such processes to be interested in root, and
this allows returning early before going through a more expensive
lookup.
If there's an expected breakage due to this change, I'll remove it. Let
me know.
- A page-sized (4K) bitmap is added.
This allows O(1) lookup for UID <= 32767.
This speeds up `ksu_is_allow_uid()` by about 4.8x by sacrificing a 4K
memory. IMHO, a good trade-off.
Most notably, this reduces the 99.999% result previously from worrying
milliseconds scale to microseconds scale.
For UID > 32767, another page-sized (4K) sequential array is used to
cache allow_list.
Compared to the previous PR #557 , this new approach gives another nice
25% performance boost in average, 63-96% boost in worst cases.
Benchmark results are available at
https://docs.google.com/spreadsheets/d/1w_tO1zRLPNMFRer49pL1TQfL6ndEhilRrDU1XFIcWXY/edit?usp=sharing
Thanks!
---------
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
2023-06-16 19:53:15 +08:00
tiann
a3874dd089
kernel: use ksud as root shell instead of /system/bin/sh
2023-04-03 20:29:10 +08:00
小さい猫
199f5cc223
fix some typos introduced in #166 ( #181 )
...
Signed-off-by: Ookiineko <chiisaineko@protonmail.com>
Co-authored-by: f19 <58457605+F-19-F@users.noreply.github.com>
Co-authored-by: Scirese <nuclearlight91@gmail.com>
2023-02-02 23:38:04 +08:00
f19
4f2b8b7077
kernel: backport to 4.4 ( #166 )
...
These changes make KernelSU work on kernel4.4
[link](https://github.com/F-19-F/android_kernel_oneplus_msm8998 ).
LINUX_VERSION_CODE macro changes have been vertied on 4.4 4.9 4.14.
For kernel 4.4,just pick two commits
* [introduce
KernelSU](2993524f2f
)
* [allow init exec ksud under
nosuid](3df9df42a6
)
2023-02-01 19:48:36 +08:00
Ylarod
06aaae1335
kernel: fix missing log tag ( #117 )
2023-01-25 22:24:00 +08:00
Ylarod
2f970f7ab8
kernel: refact ( #113 )
...
* refact
* sort inlude
* update
* unregister execve kprobe
* update log
* don't unregister if not in kprobe
* opt for no kprobe
* opt for no kprobe
* stop debug
* don't forget to call ksu_uid_observer_exit
* rename core to core_hook
* direct call do_persistent_allow_list
* add prefix
* use getter, add warn
* add wrapper
* run clang-format
clang-format --style="{BasedOnStyle: InheritParentConfig, SortIncludes: true}" -i kernel/**/*.[ch]
* try fix wsa x64 build
2023-01-25 21:53:19 +08:00
SlightlyLookAround
fe11fcd6c6
kernel: Migrate the reference of task_stack() ( #102 )
...
- task_stack() had been separated when it was in Linux 4.11, so let's do
our migration when KernelSU facing the old version of kernel.
- See f3ac606719
Signed-off-by: Calling <KeternalGithub@163.com>
Signed-off-by: Calling <KeternalGithub@163.com>
2023-01-22 11:32:28 +08:00
weishu
deac6163d6
kernel: 1. use prctl lsm hook; 2. refine sucompat hook
2023-01-19 13:31:55 +07:00
Ylarod
fb73a7f83e
kernel: fix typo
2023-01-16 12:42:40 +08:00
weishu
00b1d7538d
kernel: support ksud services
2023-01-16 11:19:59 +07:00
weishu
886c7d97a6
kernel: fix stack frame size exceeds
2023-01-16 10:21:10 +07:00
Ylarod
a30aab1da6
[skip ci] minor fixup ( #72 )
...
1. update README_CN.md
2. indent fixup
2023-01-15 17:05:08 +08:00
chen2021-web
2359b16526
backport to 4.14 ( #59 )
2023-01-15 15:34:15 +08:00
weishu
0e0a812a9c
kernel: backport to 4.19 ( #36 )
2023-01-10 23:20:32 +08:00
weishu
35d6e27cd5
kernel: change vold.rc to atrace.rc temporarily
2023-01-04 21:42:50 +07:00
weishu
91ec16310c
kernel: Add boot_completed init event
2023-01-04 13:43:37 +07:00
weishu
b3f7d1f070
kernel: use exec instead of init service
2023-01-03 09:21:21 +07:00
weishu
5229b8158e
kernel: make injected init service name random
2023-01-02 22:19:01 +07:00
weishu
2e8645b50e
kernel: unregister vfs_read hook to avoid read performance
2023-01-02 21:43:02 +07:00
weishu
ae18ab2b5e
kernel: inject userspace init events
2023-01-01 23:54:54 +07:00
weishu
b427c86ab3
misc: code format(use kernel code stype: https://www.kernel.org/doc/html/v6.1/process/coding-style.html
2022-12-27 18:21:10 +07:00
weishu
3196731545
kernel: improve selinux for su context
2022-12-22 22:10:17 +07:00
weishu
758c8eb845
kernel: fix compile errors & warnings on android13-5.15 gki
2022-12-20 10:51:40 +07:00
Huy Minh
96139986b3
kernel: Include task_stack.h in sucompat.c ( #6 )
...
Fixed the following error when compiling
ld.lld: error: undefined symbol: task_stack_page
>>> referenced by ld-temp.o
>>> vmlinux.o:(sh_user_path)
2022-12-19 20:38:20 +08:00
weishu
223f5588df
kernel: always disable seccomp
2022-12-19 17:14:38 +07:00
weishu
91f3b3ef1c
kernel: load_allow_list when /data prepared
2022-12-15 16:06:07 +07:00
weishu
fc497546cc
kernel: fix free kmem err
2022-12-14 16:41:47 +07:00
weishu
c6300ccf94
kernel: fix memory leaks and x86_64 args
2022-12-14 16:26:53 +07:00
weishu
e9ed28077f
kernel: add su compat mode
2022-12-14 14:55:29 +07:00