Commit Graph

378 Commits

Author SHA1 Message Date
weishu
f87d6eb97d kernel: fix incorrect umount for apps 2023-06-22 15:17:32 +08:00
weishu
a0abe9db68 Revert "kernel: use vfs_fstatat on kernel 5.10+, vfs_statx may have cfi."
This reverts commit d2647b2f4d.
2023-06-22 14:37:17 +08:00
weishu
fc4f0b285a kernel: don't alloc groups for default groups 2023-06-22 13:42:28 +08:00
weishu
22e3e1fc0e Revert "kernel: getname might sleep in kprobe handler (#670)"
This reverts commit 7fa7b5b875.
2023-06-22 12:54:30 +08:00
weishu
7fa7b5b875 kernel: getname might sleep in kprobe handler (#670) 2023-06-22 10:54:50 +08:00
weishu
d2647b2f4d kernel: use vfs_fstatat on kernel 5.10+, vfs_statx may have cfi. 2023-06-20 18:42:41 +08:00
Ikko Eltociear Ashimine
3863d19745 kernel: fix typo in allowlist.c (#663)
creat -> create
2023-06-20 11:03:09 +08:00
Coconut
29169ddeb9 kernel:Fix the issue of incompatible __maybe_unused in the GCC compiler kernel used in versions 4.4. x to 4.9. x. (#660) 2023-06-20 10:35:07 +08:00
weishu
f8346380f6 kernel: Enforcement of Manager Signature Verification 2023-06-19 17:57:19 +08:00
weishu
0eb960826d kernel: allow uid 1000(system_uid) to grant root. close #645 2023-06-18 13:00:37 +08:00
weishu
f2d9900c45 kernel: fix compile err. close #647 2023-06-18 12:51:34 +08:00
Juhyung Park
9fa6a0ce85 Hook improvements (take 2) (#563)
Hi @tiann.

Thanks for the great project, I had great fun playing around with it.

This PR mainly tries to further minimize the possible delays caused by
KernelSU hooking.

There are 3 major changes:
- Processes with 0 < UID < 2000 are blocked straight-up before going
through the allow_list.
I don't see any need for such processes to be interested in root, and
this allows returning early before going through a more expensive
lookup.
If there's an expected breakage due to this change, I'll remove it. Let
me know.
- A page-sized (4K) bitmap is added.
This allows O(1) lookup for UID <= 32767.
This speeds up `ksu_is_allow_uid()` by about 4.8x by sacrificing a 4K
memory. IMHO, a good trade-off.
Most notably, this reduces the 99.999% result previously from worrying
milliseconds scale to microseconds scale.
For UID > 32767, another page-sized (4K) sequential array is used to
cache allow_list.

Compared to the previous PR #557, this new approach gives another nice
25% performance boost in average, 63-96% boost in worst cases.

Benchmark results are available at
https://docs.google.com/spreadsheets/d/1w_tO1zRLPNMFRer49pL1TQfL6ndEhilRrDU1XFIcWXY/edit?usp=sharing

Thanks!

---------

Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
2023-06-16 19:53:15 +08:00
weishu
6b326ffbff kernel: fix warning on x86_64, close #637 2023-06-16 19:32:48 +08:00
Fiqri Ardyansyah
3fffcde59d Fix error build when using GCC 12.0.0 (#609)
Signed-off-by: Fiqri Ardyansyah <fiqri0927936@gmail.com>
2023-06-09 10:35:16 +08:00
weishu
ba229c9e4d kernel: use macro for default domain 2023-06-06 21:07:25 +08:00
weishu
109472ae22 kernel: Fix shell permission under KSU_DEBUG 2023-06-06 21:05:37 +08:00
weishu
6a11cb706d kernel: bump format version to force clear allowlist, prepare to release a new version 2023-06-06 20:49:39 +08:00
weishu
19e00ac4eb kernel: fix set groups for kernel 4.9- 2023-06-06 20:45:42 +08:00
Soo-Hwan Na
8a134bad28 kernel/selinux: Need to force include errno.h sometimes (#572)
- Seen with Linux 4.14 kernel with error message:

In file included from ../drivers/android/kernelsu/selinux/sepolicy.c:1:
In file included from ../drivers/android/kernelsu/selinux/sepolicy.h:6:
In file included from ../security/selinux/ss/policydb.h:30: In file
included from ../security/selinux/ss/avtab.h:26:
../security/selinux/include/security.h:240:10: error: use of undeclared
identifier 'EIDRM'
        return -EIDRM;
                ^
  CC      drivers/base/transport_class.o
  CC      kernel/rcu/update.o
../security/selinux/include/security.h:246:10: error: use of undeclared
identifier 'ENOENT'
        return -ENOENT;
                ^
2023-06-06 16:42:45 +08:00
weishu
bacd16a68c kernel: support setting selinux context for profile 2023-06-06 16:35:25 +08:00
weishu
893aebca4f kernel: support settings supplementary groups for profile 2023-06-06 13:19:11 +08:00
weishu
1c8bd90fdf ci: respect the CONFIG_KSU options (#599)
close #596, #597
2023-06-06 12:12:27 +08:00
weishu
1a6e99bcc8 kernel: prevent root process to exec su, which makes app can escape root profile by exec it twice 2023-06-06 11:08:57 +08:00
weishu
9dcc9225d7 kernel: fix incorrect prune uid for work profile app, close #587 2023-06-05 17:41:41 +08:00
weishu
fc96172655 kernel: make the profile uid, gid, capabilities really work 2023-06-04 17:29:12 +08:00
weishu
115e412cdc kernel: add more capailities 2023-06-04 16:09:27 +08:00
weishu
9abe9687ab kernel: fix set app profile may override other user's 2023-06-04 13:59:22 +08:00
weishu
27cca2a264 kernel: Fixing the issue of a delay in updating the default profile. 2023-06-04 09:47:31 +08:00
weishu
20a9c6ec0f kernel: use uid instead of package to compare allowlist, fix #580 2023-06-04 09:18:39 +08:00
diphons
da45d90605 Fixup: build under linux 4.14 (#581)
Split compiler_types.h from compiler.h only available for linux 4.14
2023-06-04 09:15:03 +08:00
weishu
395711c942 kernel: dont prune uid used for app profile 2023-06-04 01:01:39 +08:00
weishu
bc9e3da5ce kernel: respect the app profile's umount modules field for kernel umounting 2023-06-04 00:03:56 +08:00
weishu
3a9e29f1ee kernel: Add version field for struct app_profile 2023-06-03 23:57:05 +08:00
weishu
0e539ccee1 kernel: support load/restore default profiles 2023-06-03 23:57:05 +08:00
weishu
14b1386879 kernel: support CMD_IS_UID_GRANTED_ROOT and CMD_IS_UID_SHOULD_UMOUNT 2023-06-03 22:44:01 +08:00
weishu
e030ca48db kernel: fix CMD_GET_ALLOW_LIST error 2023-06-03 19:23:51 +08:00
weishu
b4f6302262 kernel: don't copy profile when not found 2023-06-03 17:26:00 +08:00
weishu
f8b18c06c8 kernel: minor fixes for profiles 2023-06-03 10:18:11 +08:00
weishu
cb5cd08098 kernel: don't fill default value for app profile 2023-06-03 00:06:58 +08:00
weishu
e8d234ae66 kernel: baby version of profile 2023-06-03 00:01:00 +08:00
dabao1955
9faa207646 Kconfig:Update text information (#567)
![Screenshot_2023-05-31-12-56-27-57_84d3000e3f4017145260f7618db1d683](https://github.com/tiann/KernelSU/assets/79307765/84ab8d8e-c034-4567-b815-ebeccde1fdbc)

![Screenshot_2023-05-31-12-56-09-68_84d3000e3f4017145260f7618db1d683](https://github.com/tiann/KernelSU/assets/79307765/a4209212-997f-4e2f-bbcb-2c5136ab6e71)
2023-06-02 10:41:40 +08:00
dabao1955
7428ee02d7 change warning about disable kprobes (#549)
#479


Co-authored-by: dabao1955 <195328750@qq.com>
2023-05-23 10:24:18 +08:00
weishu
a3fdcdd901 kernel: remove no-macro-redefined 2023-05-22 10:50:04 +08:00
weishu
976f2610cb kernel: fix format warnning 2023-05-22 10:39:54 +08:00
weishu
a1daacaa97 kernel: fix incorrect prune uid in allowlist for work profile app. close #535 2023-05-22 10:32:20 +08:00
Aquarius223
2a73743527 kernel: Modify and adjust KernelSU Kconfig (#538)
1. List KSU as a "KernelSU" menu
2. Overlayfs[1] may be disabled for some early kernels(4.4.y), so
choosing depends on OVERLAY_FS here is useless.
3. KSU_DEBUG is a bool option, it is not a module, fixed from tristate
to bool.
4. Adjust the config order

[1]: github.com/LineageOS/android_kernel_xiaomi_msm8998/commit/dcc27641

Change-Id: I49c77ba30f0a8ed00efc44afef8a12f9ad039d7e

Co-authored-by: admin <paper@localhost>
2023-05-21 20:28:59 +08:00
tiann
dc8e63421d Revert "Add option to enable global namespace (#497)"
This reverts commit 00a459a91b.
2023-05-16 22:27:01 +08:00
Vayruz Rafli
4d5592e5a4 Fix little typo in setup script. (#505) 2023-05-16 18:12:16 +08:00
Hikari-no-Tenshi
00a459a91b Add option to enable global namespace (#497)
Disabled by default.
To enable/disable use terminal with root.

To enable:
echo 1 > /sys/module/ksu/parameters/global_namespace_enable

To disable:
echo 0 > /sys/module/ksu/parameters/global_namespace_enable

Value will be reset to 0 (disabled) on reboot.
2023-05-16 11:39:48 +08:00
浅秋枫影
5b4655f827 Revert 052a3d3 (#500)
确实会导致卡住问题,一旦卡住,其他程序就无法正确卸载。
可能是,卸载目录那里一直在等待前面的空闲后再卸载,然后把后面的事件全部阻塞了?
2023-05-15 23:18:34 +08:00