64 Commits

Author SHA1 Message Date
Rifat Azad d61de07c21 kernel: implement v2_signature size/hash override from userspace through kernel module parameter
- /sys/module/kernelsu/parameters/expected_manager_*
2025-07-19 23:10:48 +06:00
Rifat Azad bd03c296a1 kernel/Makefile: remove redundant get_cred_rcu backports 2025-07-14 20:11:13 +06:00
Rifat Azad b97fc2bec2 Revert "kernel/Makefile: check kernelsu driver version from online git repo first, if fails then check local .git and if that also fails then use hardcoded fallback"
This reverts commit a37f398cc7.

- this is a very flawed logic for when we try to build with release tags or specific commit hashes instead of latest commit, the online logic will always append latest version instead of the actual version of code (i.e release tags or commit hashes)
2025-07-05 17:35:25 +06:00
Rifat Azad a37f398cc7 kernel/Makefile: check kernelsu driver version from online git repo first, if fails then check local .git and if that also fails then use hardcoded fallback 2025-06-14 22:52:10 +06:00
rifsxd 5435992911 kernel: KernelSU-Next version fallback set to 11998 2025-02-06 17:58:00 +06:00
backslashxx ae36e2085c kernel: handle optional backports (#99)
Cherry pick from https://github.com/backslashxx/KernelSU/commit/8bb9518060b06152b99f11465e20febc45359d3c https://github.com/backslashxx/KernelSU/commit/a4a7db7f40556287bfe53b65e998283c06363dd9

Backporting is cool, but not everyone has the skills for it.
This commit does NOT make it required, but it will allow compiler
to use whats in-kernel if it exists.

The following are backportable:
 - kernel_read / kernel_write
 	< 4.14, backport chain, tested on 4.9
 	https://github.com/torvalds/linux/commit/e13ec939e96b13e664bb6cee361cc976a0ee621a
	https://github.com/torvalds/linux/commit/bdd1d2d3d251c65b74ac4493e08db18971c09240
	https://github.com/torvalds/linux/commit/c41fbad015dabb0a40ecca50c3ff5658eb6471ff
	https://github.com/torvalds/linux/commit/ac452acae1caa1a451142a30b4e1ea09cfac4410

 - strncpy_from_user_nofault
 	for 5.4, apply: https://github.com/torvalds/linux/commit/bd88bb5d4007949be7154deae7cef7173c751a95
 	for 4.x, apply: https://github.com/xiaomi-sdm678/android_kernel_xiaomi_mojito/commit/424e21f3b01ddaeb86cef7efd3f519a7e342fb67
 	for any failures, just SKIP THIS or check dependency chain of, https://github.com/gregkh/linux/commit/3d7081822f7f9eab867d9bcc8fd635208ec438e0
 		this got backported to v4.4.236, v4.9.236, v4.14.197, v4.19.144

- hint, `curl $url.patch | git am`

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-01-28 14:53:35 +06:00
Rifat Azad 14624ea966 kernel: dynamic get_cred_rcu patch for appropriate atomic function and apply patch accordingly 2025-01-17 15:34:34 +06:00
Rifat Azad 6f6dd29306 kernel: auto backport get_cred_rcu 2025-01-16 19:42:38 +06:00
rsuntk 0ada4ee5d4 kernel: improve get_cred_rcu guard
Signed-off-by: rsuntk <rissu.ntk@gmail.com>
2025-01-16 14:32:04 +06:00
rsuntk 3b045f6c16 kernel: Add entries
Signed-off-by: rsuntk <rissu.ntk@gmail.com>
2025-01-16 14:31:31 +06:00
rifsxd 5982cdb61d source: minor cleanup 2025-01-01 21:19:50 +06:00
rifsxd 4a07ce7d0b kernel: removed KSU (official) v2 signature size/hash 2024-12-31 11:02:34 +06:00
Rifat Azad 79d4f99cf4 kernel: small adjustment 2024-12-24 23:31:25 +06:00
Rifat Azad af5496de80 kernel: auto backport path_umount and can_umount 2024-12-24 08:25:46 +06:00
Rifat Azad 8fbddc959a Revert "kernel: added susfs v1.5.3"
This reverts commit bdf81c0880.
2024-12-24 08:21:10 +06:00
Rifat Azad bdf81c0880 kernel: added susfs v1.5.3 2024-12-24 07:34:30 +06:00
Rifat Azad 1f58c7bf12 kernel: KSU_NEXT v2 signature size/hash added 2024-12-24 06:59:24 +06:00
Rifat Azad 1a84f69f5c Revert "[1.0] Drop Non-GKI Support (#1483)"
This reverts commit 97d70b40fc.
2024-12-24 06:54:08 +06:00
Rifat Azad 8d2b017c96 kernel: sync with upstream 2024-12-24 06:53:54 +06:00
Rifat Azad 3fd1cf6329 kernel: rename KernelSU -> KernelSU-Next 2024-12-21 02:12:29 +06:00
Rifat Azad fd1f829db6 kernel: auto backport path_umount to fs/namespace.c at build time 2024-12-18 21:34:04 +06:00
Rifat Azad 629d878558 kernel: New KSU_NEXT size/hash 2024-12-18 18:03:25 +06:00
rifsxd 57bffb5e7c kernel: fix missing endif in Makefile 2024-12-18 02:26:09 +06:00
backslashxx 36fb6085ef kernel: require path_umount backporting
Most kernel builders have to touch their kernel source code anyway so
we might as well tell them to backport path_umount to achieve some sort
of feature parity.

This enforces a path_umount backport, not a suggestion.
Its a requirement from now on.

You will backport path_umount and you will like it.
2024-12-17 22:45:23 +06:00
Rifat Azad c5847b480c kernel: KSU_VERSION fallback version bumped -> 11998 2024-12-15 06:09:31 +06:00
Rifat Azad 98a692370f kernel: Removed SuSFS Patch 2024-12-13 06:21:40 +06:00
Rifat Azad c1d4f38c19 kernel: added SuSFS version 2024-12-13 06:21:38 +06:00
Rifat Azad e15516040d Revert "kernel: susfs: CONFIG_KSU_SUSFS_INFO syscall to get susfs version & variant"
This reverts commit b78c9adf49.
2024-12-13 06:21:38 +06:00
Rifat Azad b78c9adf49 kernel: susfs: CONFIG_KSU_SUSFS_INFO syscall to get susfs version & variant 2024-12-06 22:48:14 +06:00
Rifat Azad 68c9317885 kernel: additional custom v2_signature size/hash 2024-12-04 16:52:55 +06:00
Rifat Azad e1d30d55af kernel: implement SuSFS v1.5.2 2024-12-04 16:30:28 +06:00
Ylarod 97d70b40fc [1.0] Drop Non-GKI Support (#1483)
Co-authored-by: weishu <twsxtd@gmail.com>
2024-06-01 14:50:46 +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 478fda6712 kernel: remove become_manager and minor refactors 2024-03-24 11:20:43 +08:00
weishu 97e8842000 kernel: remove unused module_api 2024-03-21 11:36:36 +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 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
Ylarod 3f5d6ca54a Build KernelSU as LKM (#1254)
Co-authored-by: weishu <twsxtd@gmail.com>
2024-03-15 18:53:24 +08:00
weishu cfc3e73c45 kernel: fix bazel build 2024-02-26 16:54:14 +08:00
weishu 09b6c219e9 kernel: Unshallow the repo in Makefile. close #1365 2024-02-26 12:23:51 +08:00
weishu 4a5cdf25f1 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
weishu 02def78124 kernel: harden the signature check (#1027) 2023-10-11 02:53:11 -05:00
セリカ・シルフィル 76685769f3 CI: Support set manager signature size and hash (#757)
close #739, close #745, close #752
2023-07-18 12:38:44 +08:00
Aquarius223 68a670ad63 kernel: Modify KERNEL_SU_VERSION logic and behavior (#696)
This patch modifies the following:
- Move the version addition logic in ksu.h to Makefile processing
- Print the current version number of KernelSU during make build

build test (normal):
 buildlog:
HOSTCC scripts/basic/bin2c Using .. as source for kernel -- KernelSU
version: 11055
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h

 KernelSU software:
  KernelSU Working Version: 11055 (v) Superusers: 0 Modules: 0


![11055](https://github.com/tiann/KernelSU/assets/47409494/10506289-04d2-41c0-bd48-bad9f0dbdec5)

build test (missing .git file):
 buildlog:
HOSTCC scripts/basic/bin2c Using .. as source for kernel
../drivers/kernelsu/Makefile:23: "KSU_GIT_VERSION not defined! It is
better to make KernelSU a git submodule!"
  CHK     include/generated/utsrelease.h
  CHK     scripts/mod/devicetable-offsets.h

 KernelSU software:
  KernelSU Working Version: 16 (v) Superusers: 0 Modules: 0

The current kernel version 16 is too low for the manager to function
properly. Please upgrade to version 10977 or higher!


![16](https://github.com/tiann/KernelSU/assets/47409494/9ea877a7-7b91-4a27-b6ab-58ce6e1b386f)

(cherry picked from commit 0c38a1614a77d80de752aba20908e3f9d21660a8)
Change-Id: I570f2ee33db224e1a36770f847137f290ba9bcfd

Co-authored-by: stic-server-open <1138705738@qq.com>
2023-06-28 21:45:36 +08:00
weishu a3fdcdd901 kernel: remove no-macro-redefined 2023-05-22 10:50:04 +08:00
5ec1cff a2bf1440fd kernel: fix search git in path (#363)
Prevent failing to get KSU_GIT_VERSION when PATH contains space.


[Details](https://github.com/5ec1cff/my-notes/blob/master/mi-kernel.md#%E4%B8%80%E4%B8%AA%E7%BC%BA%E5%B0%91%E5%BC%95%E5%8F%B7%E5%BC%95%E5%8F%91%E7%9A%84%E8%A1%80%E6%A1%88)
2023-04-09 17:16:35 +08:00
Shatyuka a79a8c2423 kernel: use git from PATH (#316)
One should have git in PATH in order to build Android kernel.
Also it's weird that git is used in `setup.sh` without absolute path.
2023-03-23 15:01:24 +08:00
f19 b2b4ca9f78 fix KSU_GIT_VERSION is not defined while importing KSU by 'git submodule add' (#224)
.git is a text file while the module is imported by 'git submodule add'.
2023-02-10 16:34:47 +08:00