Commit Graph

360 Commits

Author SHA1 Message Date
weishu dc5f911e43 kernel: remove become_manager and minor refactors 2024-03-24 11:20:43 +08:00
weishu b5cc931d00 kernel: Fix format error 2024-03-24 00:03:59 +08:00
weishu e1f9900b2f kernel: simplify prctl 2024-03-23 23:11:47 +08:00
weishu a5e3cab177 kernel: Fix compile error above 6.1 2024-03-23 23:11:47 +08:00
weishu 9a04211051 kernel: Let the kernel choose who is qualified to be the manager. 2024-03-23 21:48:03 +08:00
weishu e38a5e52d2 kernel: we should take ownership over fd 2024-03-21 14:15:11 +08:00
weishu b3a15e2b6b kernel: Fix the incorrect judgment condition. 2024-03-21 11:48:02 +08:00
weishu c5d423c4eb kernel: ignore all non application uid 2024-03-21 11:45:44 +08:00
weishu 4511d4b7bf kernel: remove unused module_api 2024-03-21 11:36:36 +08:00
weishu 64908583e9 kernel: Fix compile warning 2024-03-21 11:32:30 +08:00
weishu c408710b11 kernel: minor fixes 2024-03-21 11:24:56 +08:00
weishu bc1e03feb1 kernel: remove unused headers 2024-03-20 23:14:30 +08:00
weishu 808342bf04 kernel: Fix sepolicy on ColorOS14 2024-03-20 17:43:37 +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 2a64784a33 kernel: hook syscall instead of unstable symbol 2024-03-20 14:21:19 +08:00
Fede2782 1fc1ffe2ab 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 97faab6be4 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 247aa877e4 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 ce0c397a65 kernel: support query working mode 2024-03-19 11:52:17 +08:00
weishu 4bad691ec8 kernel: don't remove from sysfs when debug is enabled 2024-03-18 19:12:56 +08:00
weishu fefb02e578 kernel: remove it from sysfs 2024-03-18 18:50:53 +08:00
Soo-Hwan Na d6770467fa 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 b4cfc2f298 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 cf210d629f ci: Fix avd build (#1457) 2024-03-17 09:07:52 +08:00
Ylarod 7568d55be1 Build KernelSU as LKM (#1254)
Co-authored-by: weishu <twsxtd@gmail.com>
2024-03-15 18:53:24 +08:00
Coconut e3998c0744 kernel:Compatible with devices based on Huawei EMUI10 (#1447)
EMUI 10 kernel version is 4.14.xxx.  
The SELinux of Huawei's modified EMUI10 kernel is still similar to the
EMUI 9 version. This commit not support HarmonyOS 2 based EMUI 10.
2024-03-14 15:18:59 +08:00
Wang Han 3e2de84a81 Guard a few logprint in prctl path with KSU_DEBUG (#1402) 2024-02-29 13:47:22 +08:00
weishu 796f8a448a kernel: fix bazel build 2024-02-26 16:54:14 +08:00
weishu afe0e691aa kernel: Unshallow the repo in Makefile. close #1365 2024-02-26 12:23:51 +08:00
那年雪落 2820779947 kernel: Add back Makefile new line with posix compatible (#1372) 2024-02-23 16:55:22 +08:00
weishu 01b685ce58 kernel: Allow system_server to kill su process 2024-02-20 18:16:43 +08:00
weishu 07e475c5dc kernel: prevent become manager when failed. close #1328 2024-02-03 20:03:26 +08:00
weishu e934bfb648 kernel: Add init selinux rules. 2024-01-15 20:28:53 +08:00
Ylarod 5b920f8230 kernel: fix secctx mem leak (#1283)
Co-authored-by: weishu <twsxtd@gmail.com>
2024-01-14 11:15:52 +08:00
weishu e9997a07c1 kernel: avoding umount when there isn't any module. close #556 2024-01-08 12:55:08 +08:00
Ylarod e3e4d2eed4 Try umount /sbin in kernel (#1257) 2024-01-06 08:59:30 +08:00
Ylarod f37cc16117 Correctly handle is_ksu_domain, close #972 (#1246)
fix #972
2024-01-04 14:14:31 +08:00
weishu 32b3ec9844 kernel: truncate allowlist before save 2023-12-29 18:32:45 +08:00
weishu d6cbda49aa kernel: fix out of bound reading. close #1227 2023-12-27 20:19:21 +08:00
weishu fe7f509f9d kernel: optimize uid list reading 2023-12-27 19:33:25 +08:00
Nullptr 706cd1e73e Mount temp dir at /debug_ramdisk (#1226) 2023-12-23 21:05:26 +08:00
The_second_Tom dcd9d65c92 kernel: adapt to kernel above 6.4 (#1196)
Above kernel 6.4, there is no struct_avc member in selinux_state.
2023-12-11 00:13:06 +08:00
weishu c560d603e6 kernel: Add mitigation to avoid placing manager in lib to bypass check 2023-12-08 14:48:49 +08:00
weishu b7f937b7f9 kernel: fix su not working in shell for 6.1 kernel 2023-11-13 15:06:25 +08:00
4qwerty7 1b67c1b153 kernel: fix null pointer dereference for some case (#1075)
#973 __never_use_envp 被改名为 envp 并使用。

这导致 GKI 版本一旦代码运行到
[213](https://github.com/tiann/KernelSU/blob/344c08bb79ba12b692016750cda363f9f3500182/kernel/ksud.c#L213)
行(或许只有 WSA 等类似情况会跑到这?),就会触发一个空指针解引用。

此PR意在修复此问题,且已在WSA上测试。
2023-10-24 07:00:52 +08:00
weishu bf823a29e8 kernel: fix incorrect strcmp 2023-10-23 22:22:47 +08:00
weishu d24813b2c3 Merge pull request from GHSA-86cp-3prf-pwqq
* kernel: deny v2 signature blocks with incorrect number

* kernel: reject v1 signature

* kernel: enforce manager package name at compile time

* kernel: don't specific package name in source code, use it in ci
2023-10-23 12:59:30 +08:00
kevios12 7a1767b4c9 kernel: fix Modules install stuck on kernel 4.4 (#1059) 2023-10-22 23:40:53 +08:00
weishu 344c08bb79 kernel: make compiler happy 2023-10-21 22:43:58 +08:00