458 Commits

Author SHA1 Message Date
rifsxd
7a08683c74 kernel: remove unnecessary umount calls for configuration directories (evil modifications) 2025-02-25 19:48:20 +06:00
rifsxd
487e7d0012 kernel: simplify umount calls for configuration files 2025-02-25 15:37:12 +06:00
Wang Han
0038ba6566 Fix reference count leak in nuke_ext4_sysfs() (#2467)
We need to call path_put() to decrease the refcount.
2025-02-24 02:48:39 +06:00
rifsxd
e8c080ba09 src: adapt git links to KernelSU-Next org 2025-02-24 02:18:02 +06:00
Rifat Azad
785d8143fb kernel: remove KSU_WITH_KPROBES definition since it's already defined by Kconfig 2025-02-24 01:29:28 +06:00
backslashxx
cd0031e8a5 kernel: expose variables used by manual hooks always 2025-02-23 22:58:00 +06:00
backslashxx
15371bb1d6 kernel: add non-kprobe support for sucompat disable/enable
I have no idea if this is needed or any useful for manual fs hooks users.
Upstream, this is likely to, well, simply disable hooking of those functions,
to remove and mitigate timing issues as some detection methods can actually
differentiate these.

This is done like how vfs_read_hook, input_hook and execve_hook is disabled.
While this is not exactly the same thing, this *CAN* achieve the same results.
The complete disabling of all KernelSU hooks.

While this is probably not so useful for us, honestly, I have no idea for shit
what I am doing, but lets still port it for the sake of feature parity.

cherry pick from:
	kernel: backport support for sucompat disable/enable
	https://github.com/backslashxx/KernelSU/commit/20ffabb

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-02-23 22:11:50 +06:00
backslashxx
097451d578 kernel: guard functionality that requires kprobes
Since upstream is now making kprobes a requirement, we adapt this tree to still allow
building with manual hooks in an easier way. Furthermore, this also allows a user to
build with manual hooks even with kprobes enabled.

Offending commit:
	kernel: remove unused CONFIG guard becuase GKI kernel enable kprobe by default
	upstream: https://github.com/tiann/KernelSU/commit/500ff9b

Other changes:
	ksud.c, stop_input_hook(), short-circuit redundant logic left by this change.
	cherry pick from: https://github.com/backslashxx/KernelSU/commit/a3d3e93

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
2025-02-23 21:00:59 +06:00
weishu
85866848ea kernel: Allow to re-enable sucompat 2025-02-23 20:37:34 +06:00
weishu
bb6c20339c kernel: add support for disable sucompat 2025-02-23 20:05:55 +06:00
Wang Han
a89985f33e Allow toggling unmount setting for all apps (#2450)
This fixes https://github.com/tiann/KernelSU/issues/2416.
2025-02-22 04:48:44 +06:00
rifsxd
42896dfab1 kernel: add umount calls for pixelify gphotos spoof configs and lsposed dex2oat bin 2025-02-22 04:40:28 +06:00
weishu
74171a2930 kernel: unregister sysfs for module's ext4 image 2025-02-21 17:02:33 +06:00
rifsxd
a2fcd157a2 Revert "kernel: do not umount modules by default"
This reverts commit bbb05b292a.
2025-02-14 21:32:43 +06:00
rifsxd
bbb05b292a kernel: do not umount modules by default 2025-02-14 19:45:19 +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 8bb9518060 a4a7db7f40

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
 	e13ec939e9
	bdd1d2d3d2
	c41fbad015
	ac452acae1

 - strncpy_from_user_nofault
 	for 5.4, apply: bd88bb5d40
 	for 4.x, apply: 424e21f3b0
 	for any failures, just SKIP THIS or check dependency chain of, 3d7081822f
 		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
5ec1cff
87fc6b2784 kernel: clear securebits
fix adb shell cannot escape to root after https://github.com/tiann/KernelSU/pull/2381
2025-01-27 20:05:54 +06:00
Wang Han
a05b790da6 Avoid unnecessarily overriding capabilities (#2381)
Previously all capabilities were overridden with 0xffffffffffffffff,
which is
not what normal processes have. This causes PR_CAPBSET_DROP prctl
fail because it is dropping invalid caps. Fix it.

This fixes
https://gitlab.com/kalilinux/nethunter/apps/kali-nethunter-app/-/issues/378.

Co-Authored-By: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>

Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
2025-01-25 20:54:06 +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
rsuntk
95584df023 kernel: Add fallback if user didn't implement 'get_cred_rcu'
https://github.com/tiann/KernelSU/pull/2320

Signed-off-by: rsuntk <rissu.ntk@gmail.com>
2025-01-16 14:26:52 +06:00
SsageParuders
b18c39e911 Improve seccomp disable && Add locking to protect cred modifications in escape_to_root (#2320)
- When disabling Seccomp, ensure that current->sighand->siglock is held
during the operation.
- Locking to ensure safe access and modification of the `cred` structure
within the `escape_to_root` function.

---

I think this issue described in #2236 may have been caused by concurrent
read-write access without proper locking.

---------

Signed-off-by: SsageParuders<qinqingqing1025@gmail.com>
Signed-off-by: SsageParuders <qinqingqing1025@gmail.com>"
2025-01-16 14:18:26 +06:00
ExtremeXT
72739facc8 kernel: expose allowlist workaround as Kconfig option
Useful for situations where the SU allowlist is not kept after a reboot.
As per upstream this is only used for < 4.10 and Huawei HiSilicon devices.
but theres user reports having issues even on 4.14/4.19 samsung kernels.
Expose this option so users affected can opt-in.

Discussion:
	tiann#1249
	tiann#1346

References:
	tiann@f57d351
	tiann@b61cb30

Credits to respective authors:
	rhjdvsgsgks
	ExtremeXT
2025-01-07 04:59:09 +06:00
rifsxd
5982cdb61d source: minor cleanup 2025-01-01 21:19:50 +06:00
rifsxd
7ea1579bce kernel: try umount /system/etc/hosts & /system_ext 2024-12-31 11:14:39 +06:00
rifsxd
4a07ce7d0b kernel: removed KSU (official) v2 signature size/hash 2024-12-31 11:02:34 +06:00
Loukious
a5f12ffe96 fix: reset ambient capabilities to resolve D-Bus permission issues 2024-12-27 22:39:38 +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
a17ef5634f setup: rename KernelSU -> KernelSU-Next 2024-12-21 02:07:51 +06:00
Rifat Azad
9911795aa3 setup: fixed set-up script 2024-12-18 22:55:30 +06:00
Rifat Azad
868db22b8d setup: changed repo link 2024-12-18 21:55:25 +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
ExtremeXT
5f2c1eef9c kernel: expose allowlist workaround as Kconfig option
Useful for situations where the SU allowlist is not kept after a reboot.
As per upstream this is only used for < 4.10 and Huawei HiSilicon devices.
but theres user reports having issues even on 4.14/4.19 samsung kernels.
Expose this option so users affected can opt-in.

Discussion:
	tiann#1249
	tiann#1346

References:
	tiann@f57d351
	tiann@b61cb30

Credits to respective authors:
	rhjdvsgsgks
	ExtremeXT
2024-12-17 20:33:55 +06:00
Rifat Azad
a545a3e81c kernel: slightly polish up code 2024-12-16 02:42:33 +06:00
Rifat Azad
f2fcb3687b kernel: cleaned up remaining susfs code 2024-12-16 00:14:07 +06:00
Rifat Azad
c5847b480c kernel: KSU_VERSION fallback version bumped -> 11998 2024-12-15 06:09:31 +06:00
Rifat Azad
f57d52437c kernel: delete unknown file error 2024-12-13 06:21:41 +06:00