kernel: add wrapper for creds, refine disable_seccomp, revert some changes (#131)

1. Wrapper for creds:
* Some older kernel does not have {.val}, so, for nicer compatibility support and clean code,
make some wrapper for credential use.
* After this change, do not use current_uid().val, instead, use ksu_current_uid(). For more
info, check kernel/include/ksu_creds.h.

2. Refine disable_seccomp (need to add k6.11+ support)
https://github.com/tiann/KernelSU/pull/2708
https://github.com/tiann/KernelSU/issues/2706

3. Revert "Handle unmount for isolated process correctly"
Reason: https://github.com/tiann/KernelSU/pull/2696#issuecomment-3181866301

Co-authored-by: Wang Han <416810799@qq.com>
Co-authored-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
ShirkNeko
2025-08-16 14:25:17 +08:00
parent 69a13ff999
commit 8a0d52a2ee
5 changed files with 151 additions and 140 deletions

View File

@@ -3,6 +3,7 @@
#include <linux/cred.h>
#include <linux/types.h>
#include "include/ksu_creds.h"
#define KSU_INVALID_UID -1
@@ -20,7 +21,7 @@ static inline bool ksu_is_manager_uid_valid()
static inline bool ksu_is_manager()
{
return unlikely(ksu_is_any_manager(current_uid().val) || ksu_manager_uid == current_uid().val);
return unlikely(ksu_is_any_manager(ksu_current_uid()) || ksu_manager_uid == ksu_current_uid());
}
static inline uid_t ksu_get_manager_uid()