Commit Graph

335 Commits

Author SHA1 Message Date
weishu 2efefcea72 kernel: use library import 2024-04-27 09:55:24 +08:00
weishu cd73307cd4 kernel: refactor PR_REAL_REGS 2024-04-26 13:25:29 +08:00
weishu 425c326cb5 kernel: fix setup script. close #1625, close #1647 2024-04-26 13:12:57 +08:00
buildbot 714990b7c6 kernel: no need to hook 2024-04-26 12:10:58 +08:00
buildbot 2dc2dbfd45 kernel: use syscall hook for all version, remove code next version if works well 2024-04-26 11:42:24 +08:00
Another Guy e2b0721af5 Hook syscalls and stable symbols (#1657)
1. Replace `do_execveat_common` with `sys_execve` and `sys_execveat`
2. Replace `input_handle_event` with `input_event` and
`input_inject_event`

Tested on android12-5.10-2024-04, android13-5.15-2024-04.
android14-6.1-2024-04
2024-04-26 11:27:48 +08:00
Heiler Bemerguy e0c684c5ab throne_tracker: Fix Manager sometimes not detecting KSU and optimize it (#1586)
The original logic was wrong and used 3 strlen()s for every file found,
wasting cpu.

Optimize it by first comparing only the filename length, given we
already know it,
and then strncmp() to compare with "base.apk"

Tested successfully on my Bandido Kernel (4.19)
2024-04-03 14:33:10 +08:00
P. Thịnh 68622eb79f Fixed link typo in kernel/Makefile (#1564)
I spotted this typo when building the Kernel.
2024-03-30 22:16:46 +08:00
weishu 5dd356d8b0 kernel: fix potential dead loop
Co-Authored-by: qwerty472123
2024-03-30 16:13:11 +08:00
weishu e8f633c003 Revert "kernel: deny all unexpected signature block"
This reverts commit 89eaf009c8.
2024-03-30 16:05:31 +08:00
weishu c0270b52c6 Revert "kernel: deny unexpected offset value for signing check"
This reverts commit d5cd579b60.
2024-03-30 16:05:31 +08:00
weishu d5cd579b60 kernel: deny unexpected offset value for signing check 2024-03-29 14:28:51 +08:00
weishu 89eaf009c8 kernel: deny all unexpected signature block 2024-03-29 14:14:17 +08:00
5ec1cff a93a35668b kernel: no need to umount and mark as root for manager uid (#1549)
Co-authored-by: LoveSy <shana@zju.edu.cn>
2024-03-29 09:15:18 +08:00
D8G Official ae8ffe2c10 Fix missing semicolon (#1551)
Fix build non gki kernel
2024-03-28 20:22:00 +08:00
Coconut 4584aa7f4e kernel:Add Huawei hisi check (#1545)
Use huawei_hisi_check.h to determine whether it is an old Huawei
HiSilicon device.
Solve:  
1. Compatible with non-GKI Huawei HiSilicon devices
2. Solve different bugs in EMUI of different system versions
3. Does not affect other devices
2024-03-28 14:20:00 +08:00
weishu ba9580e4d0 kernel: fix debug set manager 2024-03-27 17:58:47 +08:00
weishu ea0ee0563a kernel: Fix misleading log 2024-03-27 17:29:03 +08:00
CallMESuper 2cc2312409 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 1b71aa2c78 kernel: Fix wrong kfree 2024-03-27 13:49:09 +08:00
weishu 4841c2123a kernel: alloc path on stack; don't follow symlink 2024-03-27 11:51:41 +08:00
weishu d87bbfa652 kernel: continue search when open some dir failed 2024-03-26 22:56:59 +08:00
Jprimero15 37410f85a4 kernel: guard "umount for uid" logprint with CONFIG_KSU_DEBUG (#1519)
Its too spammy to be on non-debug mode.
2024-03-24 21:42:23 +08:00
weishu d8671b14d1 kernel: clean memory when exit 2024-03-24 16:41:53 +08:00
Jprimero15 0710032928 kernel: make for loop compatible (#1517) 2024-03-24 15:04:57 +08:00
weishu 478fda6712 kernel: remove become_manager and minor refactors 2024-03-24 11:20:43 +08:00
weishu ba66c10ec5 kernel: Fix format error 2024-03-24 00:03:59 +08:00
weishu a91690eabe kernel: simplify prctl 2024-03-23 23:11:47 +08:00
weishu 218d57ddc2 kernel: Fix compile error above 6.1 2024-03-23 23:11:47 +08:00
weishu a9b310876f kernel: Let the kernel choose who is qualified to be the manager. 2024-03-23 21:48:03 +08:00
weishu 1ccb61c0fa kernel: we should take ownership over fd 2024-03-21 14:15:11 +08:00
weishu c0254fdb18 kernel: Fix the incorrect judgment condition. 2024-03-21 11:48:02 +08:00
weishu 91204e713e kernel: ignore all non application uid 2024-03-21 11:45:44 +08:00
weishu 97e8842000 kernel: remove unused module_api 2024-03-21 11:36:36 +08:00
weishu 7713b7ce41 kernel: Fix compile warning 2024-03-21 11:32:30 +08:00
weishu 4c9f201c21 kernel: minor fixes 2024-03-21 11:24:56 +08:00
weishu 895ad601d2 kernel: remove unused headers 2024-03-20 23:14:30 +08:00
weishu 585ea48904 kernel: Fix sepolicy on ColorOS14 2024-03-20 17:43:37 +08:00
weishu fdb6b6a88a kernel: fix panic cast 2024-03-20 15:39:07 +08:00
weishu f69abf1e51 kernel: hook newfstatat/faccessat syscall instead of unstable symbol 2024-03-20 15:15:26 +08:00
weishu 2fdcdb2b4b kernel: hook syscall instead of unstable symbol 2024-03-20 14:21:19 +08:00
Fede2782 072021c322 Docs: add backport notice in module umount docs (#1476)
This aims to uniform the documentation since the official introduction
of pre-GKI modules umount feature
2024-03-19 15:41:22 +08:00
dabao1955 051e7e23e8 kernel: Use CONFIG_KSU=m to compile lkm (#1468)
before:
CONFIG_KSU=y
CONFIG_KSU_MODULE=y

after:
CONFIG_KSU=m

---------

Signed-off-by: dabao1955 <dabao1955@163.com>
Co-authored-by: weishu <twsxtd@gmail.com>
2024-03-19 15:40:38 +08:00
backslashxx 65bda4b5a8 fixup! Suggest non-gki kernel users to backport path_umount (#1477)
My bad.

as reported by @AzusaHana on tg

![image](https://github.com/tiann/KernelSU/assets/118538522/a67f97c2-20f7-4ee6-9ae1-9f9089376857)
2024-03-19 15:39:54 +08:00
weishu ae049019d6 kernel: support query working mode 2024-03-19 11:52:17 +08:00
weishu 68bee049a7 kernel: don't remove from sysfs when debug is enabled 2024-03-18 19:12:56 +08:00
weishu 85e2cd49c8 kernel: remove it from sysfs 2024-03-18 18:50:53 +08:00
Soo-Hwan Na 8a36c36e3e kernel: Make it compile on 3.18 (maybe older) kernels (#1460)
input-event-codes.h:

Input: add input-event-codes header file
(https://github.com/torvalds/linux/commit/f902dd893427eade90f7eaf858e5ff8b150a5a12)
This was in 4.4-rc, so 4.4.0 or above has it else no.

aio.h:
fs: move struct kiocb to fs.h
(https://github.com/torvalds/linux/commit/e2e40f2c1ed433c5e224525c8c862fd32e5d3df2)

Below this version, we need to explicitly include aio.h for struct kiocb
This was in 4.1-rc, so 4.0 or below should do the include

uaccess.h, sched.h was present for long times, but 4.10 splited out to
include/sched/ but the current ifdef is not including uaccess.h for
lower versions than 4.4. Fix it.
2024-03-18 13:13:00 +08:00
backslashxx cbb215ea81 Suggest non-gki kernel users to backport path_umount (#1464)
Most kernel builders have to touch their kernel source code anyway, why
not also tell them to backport path_umount so even non-gki users can
benefit from this?

I know this might be a bit controversial as this will raise the barrier
of entry, but the benefits are just so high.

Idea was from OnlyTomInSecond on KernelSU group chat way back, and it
has been on the discussions for some time

references:
https://t.me/KernelSU_group/27237/176515
https://t.me/KernelSU_group/3249/184908

https://github.com/tiann/KernelSU/discussions/955#discussioncomment-7617166

https://github.com/OnlyTomInSecond/android_kernel_xiaomi_sdm845/commit/03d233db8bbe9fe101509430bfa09d1899168aa7
https://github.com/tiann/KernelSU/pull/1060 


https://elixir.bootlin.com/linux/v5.9.1/source/fs/namespace.c#L1728
https://elixir.bootlin.com/linux/v5.10.9/source/fs/namespace.c#L1730
https://elixir.bootlin.com/linux/v6.5/source/fs/namespace.c#L1887
https://github.com/tiann/KernelSU/pull/1464#issuecomment-2002492107


Kernel side change examples
5.4
https://github.com/natsumerinchan/kernel_oneplus_sm8350/commit/961d9788624e88c3c58918b3781b9fbdd19ecbeb
4.19
https://github.com/backslashxx/android_karnol_ximi_fog/commit/164917f56d0e75ab51bb9f1bdf489acac7a6d3db
4.14
https://github.com/crdroidandroid/android_kernel_xiaomi_sm6150/commit/c07c70a0c59fb46ac0c1c812c3e993022e375cd5
4.9
https://github.com/backslashxx/msm8953-los21/commit/195f07593ae9769a992f3945bcdc43ff7fc99827
4.4
https://github.com/riarumoda/android_kernel_samsung_a9y18qlte/commit/21ea33fe41ce079ec1d663c0bd2201bc00a8084a
https://github.com/tiann/KernelSU/pull/1464#issuecomment-2002424069
ofcourse having someone on 3.18 confirm this will be nice.

**PROS**: umount modules for everyone
**CONS**: barrier of entry +1

---------

Co-authored-by: Christoph Hellwig <hch@lst.de>
Co-authored-by: Fede2782 <78815152+Fede2782@users.noreply.github.com>
Co-authored-by: Tom <31297720+onlytominsecond@users.noreply.github.com>
2024-03-18 10:27:31 +08:00
weishu bb94ad6d4b ci: Fix avd build (#1457) 2024-03-17 09:07:52 +08:00