Commit Graph

2432 Commits

Author SHA1 Message Date
fc5b87cf
7782c00275 kernel: handle seccomp_filter_release compat (#203)
* It's actually very excessive that we provide this thing
- Stale: https://github.com/rsuntk/KernelSU/pull/199

Signed-off-by: TwinbornPlate75 <3342733415@qq.com>
Signed-off-by: fc5b87cf <rissu.ntk@gmail.com>
Co-authored-by: TwinbornPlate75 <3342733415@qq.com>
2025-11-18 15:21:50 +08:00
fc5b87cf
dc3de58aa6 kernel: fix compatibility with 5.10
Signed-off-by: fc5b87cf <rissu.ntk@gmail.com>
2025-11-18 15:20:43 +08:00
fc5b87cf
83db28b262 kernel: add close_fd helper, debloat dmesg log
Signed-off-by: fc5b87cf <rissu.ntk@gmail.com>
2025-11-18 15:20:35 +08:00
backslashxx
6e44090e57 RELAND: kernel: throne_tracker: always cleanup
sometimes crowning fails especially when you replace managers.
it is likely due to using different manager hashes. this will
initialize this dynamically and then clear out unconditionally,
manager or not, to try avoid stale data.

while that is a good thing, this will cause a lot of repetetive
work, especially when nothing is crowned.

but ehh, I'd take the reliability and simplicity.

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: fc5b87cf <rissu.ntk@gmail.com>
2025-11-18 15:19:13 +08:00
fc5b87cf
c93cf58f48 kernel: Syncronize upstream changes (#198)
* Cherry-picked range: (kernel)
ebea31daa8..6915b62b9a

* Also merged unmerged pr:
https://github.com/tiann/KernelSU/pull/ 2909

Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-authored-by: u9521 <63995396+u9521@users.noreply.github.com>
Co-authored-by: Wang Han <416810799@qq.com>
2025-11-17 20:57:05 +08:00
ShirkNeko
edeff936ce kernel: fix build 2025-11-11 18:25:21 +08:00
AlexLiuDev233
d918e016bc fix: fix 5.0- users can't build (#551)
my mistake, forget old kernel's access_ok has 3 params,
so i switch to ksu_access_ok
2025-11-11 15:49:37 +08:00
Faris
a4d642bf50 kernel: fix log typo
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-11 15:39:22 +08:00
Wang Han
d36371580b kernel: add missing kfree, use proper return code
* This is half picked from 559be41482
* We haven't sync latest upstream changes yet

Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-11 15:39:15 +08:00
Faris
a2211e2909 kernel, manager: Track upstream changes (#195)
* These commits are carefully picked from upstream (tiann/KernelSU)

- Picked range:
8c5f485f27..e5f43a3427

Signed-off-by: Faris <rissu.ntk@gmail.com>
Co-authored-by: Wang Han <416810799@qq.com>
Co-authored-by: TwinbornPlate75 <3342733415@qq.com>
Co-authored-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: weishu <twsxtd@gmail.com>
2025-11-11 15:38:53 +08:00
ShirkNeko
00ea078da7 kernel: Remove redundant #if __SULOG_GATE 2025-11-11 15:21:21 +08:00
ShirkNeko
25e5c0aacb kernel & ksud: Syncronize changes from upstreams 2025-11-08 21:56:32 +08:00
Faris
d22f1bdcc4 kernel: add missing goto
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 21:53:31 +08:00
Faris
a473707c10 kernel: fix anon_get_inode_* compat
* Yes, we don't have fancy secure fd thing on older kernels.

Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 21:53:21 +08:00
5ec1cff
cc0dfc44ac kernel: fdwrapper: use anon_inode_getfd_secure to make new inode
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 21:53:09 +08:00
Faris
f87c4e077a kernel: pass arg variable
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 21:50:03 +08:00
Faris
76ca0050a7 kernel: Add header guard and support Official KernelSU fd wrapper
* Based on unmerged pull-request
https://github.com/tiann/KernelSU/pull/ 2285

Co-authored-by: Ylarod <me@ylarod.cn>
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 21:49:47 +08:00
ShirkNeko
2f2d6aeecf kernel: bump KPM version
Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-11-08 18:33:36 +08:00
ShirkNeko
f6657fdbfd clean 2025-11-08 12:54:13 +08:00
Azyr Ruthless
5782afe481 kernel: add __poll_t compat for pre-4.16 and backported kernels (#194)
__poll_t was introduced in v4.16-rc1. Add Makefile header check to detect and provide fallback for older kernels and those with backports.

Signed-off-by: AzyrRuthless <azyrruthless@tutamail.com>
2025-11-08 12:11:35 +08:00
Faris
2ab373d146 kernel: Clean up mess
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 12:11:29 +08:00
Faris
eba286ef7e kernel: fix redeclared __poll_t
* Probably useful in Ultra-Legacy kernel.

Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 12:10:54 +08:00
ShirkNeko
2a89159a3d fix build 2025-11-08 12:10:12 +08:00
Faris
29c6e2dbcc kernel, ksud: clean headers and add fd wrapper for devpts (#193)
* Now Official KernelSU devpts compat is questionable
Squashed commits:
4893fad235
e7c3d4a6a6
4bb2dae3f5

Signed-off-by: Faris <rissu.ntk@gmail.com>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-11-08 12:08:54 +08:00
Faris
968c3f7d57 kernel: sepolicy: fix incompatible pointer type
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 11:54:22 +08:00
Faris
a8cdd014dc kernel: fix wrong non-kprobe sucompat handler
* Oops, i should read the code correctly..

Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 11:54:05 +08:00
Faris
4d7dd32b11 kernel: selinux: Use switch-case instead of if-else
Signed-off-by: Faris <rissu.ntk@gmail.com>
2025-11-08 11:51:45 +08:00
Fanuel Berhanu
97b57de3d0 Update sucompat.c (#535) 2025-11-08 01:42:43 +08:00
ShirkNeko
c53cb0afb1 fix 2025-11-08 01:22:31 +08:00
Ylarod
699852009c ksud, kernel: fix sepolicy patch hint (#2872) 2025-11-07 17:30:08 +08:00
ShirkNeko
a8302120c4 fix 2025-11-07 17:28:13 +08:00
ShirkNeko
8d535fa03a kernel: Resolve compilation errors 2025-11-06 04:07:43 +08:00
ShirkNeko
2b97c77a6d Use a more appropriate minor version number 2025-11-06 03:56:52 +08:00
ShirkNeko
68f3be2cbe kernel, ksud, manager: New supercalls implementations
* This commit squashes new supercall impl:
3138651a38..562a3b9be7

Thanks to these people below:

Official KernelSU:
Co-authored-by: Wang Han <416810799@qq.com>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>

xxKSU maintainer:
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
MMRL maintainer:
Co-authored-by: Der_Googler <54764558+dergoogler@users.noreply.github.com>
KSUN maintainer:
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
KOWSU maintainer:
Co-authored-by: KOWX712 <leecc0503@gmail.com>
2025-11-06 03:54:44 +08:00
ShirkNeko
c55a918957 Kernel(Makefile): Add KSU_SRC to set path correctly #483
try Fix version define for 6.12 Kernel

Co-authored-by: YC酱luyancib <luyancib@qq.com>
2025-10-21 16:38:59 +08:00
Sultan Alsawaf
3cdb8fd057 kernel: Fix kernel panics caused by thread info flag corruption
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2025-10-21 16:38:53 +08:00
ShirkNeko
2fdb933acc Kernel: Add support for 6.12
Filtered from tiann/KernelSU #2793

Co-authored-by: libingxuan <84086386+aaaaaaaa-815@users.noreply.github.com>
2025-10-08 15:00:44 +08:00
ShirkNeko
cd05d49a7a kernel: Simplified Logic 2025-10-08 14:37:25 +08:00
unknow-tech
bcb38274f9 Add support for 6.13 (#454)
Fiz issue https://github.com/SukiSU-Ultra/SukiSU-Ultra/issues/364

cdd30ebb1b
2025-10-08 14:34:59 +08:00
backslashxx
1f468f35f4 kernel: align prctl harden commit from backslashxx/KernelSU
SQUASHED:
* kernel: harden barriers for arm/arm64
* kernel: core_hook: harden prctl handler

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:50:37 +08:00
rsuntk
1d4d23d2c9 kernel: add guard for avoiding LKM being builded on Linux 6.8+
* Due to numerous changes on LSM (Linux Security Module) in Linux 6.8+
* This is temporary guard until a working solution exist.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:50:01 +08:00
rsuntk
994999c8ce kernel: refine prctl harden
* I am not sure if this gonna defeats the main purpose or not,
but it fix prctl issue.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:49:52 +08:00
Faris
f05b20dbce [skip ci] kernel: restore original from_root logic 2025-10-07 16:48:56 +08:00
backslashxx
6af2da13ae kernel: migrate barriers to spec barriers and code style thing
overkill, but yeah, might as well move on to the real deal.

[ rsuntk: Rename original variable name ]
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:48:38 +08:00
Huy Minh
fd8e3c35bb kernel: add initial 6.8+/6.14 kernel support
* This is a squashed of un-merged pull requests of Official KernelSU
* LKM support are not available.
* Require this additional patch to avoid kernel panic because of "Too many LSMs registered":
7042991a5c

* Un-merged pull requests of Official KernelSU:
https://github.com/tiann/KernelSU/pull/1785
https://github.com/tiann/KernelSU/pull/2662

* This commit probably not 100% completed.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:47:46 +08:00
rsuntk
04586ccb96 kernel: make apk_sign_key as a typedef instead
Style preference.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:47:34 +08:00
backslashxx
b537b957bd kernel: harden prctl check
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
2025-10-07 16:46:04 +08:00
rifsxd
c02b42d7de kernel: handle throned UID change if manager is reinstall or changed
drop old UID and throne the new one when the manager is reinstalled or changed

- Add dynamic manager lock

Co-authored-by: rifsxd <rifat.44.azad.rifs@gmail.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
2025-10-07 00:06:47 +08:00
Natsume324
3f4293e69a Fixed an error in the SukiSU integration of the Kirin 970 HarmonyOS2 kernel source code:
- Error: In the Kirin 970 HarmonyOS2 kernel source code, integrating SukiSU requires disabling the CONFIG_HKIP_SELINUX_PROT configuration option. Disabling this option will enable the use of flex_array. However, in the add_type and add_typeattribute_raw functions in kernel/selinux/sepolicy.c, if a Huawei HISI device is detected, ebitmap not flex_array is used, causing an error.

- Fix: Added conditional checks to the add_type and add_typeattribute_raw functions in kernel/selinux/sepolicy.c. Because the Kirin 970 EMUI10 kernel source code does not use flex_array, an option defined only in the EMUI10 kernel configuration is added to determine the kernel source code version.
2025-10-02 01:18:57 +08:00
ShirkNeko
8943bab810 kernel: Revert partial changes 2025-09-27 23:02:40 +08:00