* refactor: replace throne tracker with ksud token
* use snprintf
* refactor: new supercall impl
- Import the sukisu command
* disable seccomp for supercall users
* kernel: fmt clear
* kernel: Enable macro protection for sulog
- Only enabled on kernel versions greater than 5.10.245
* kernel: Refactor kprobe hooks and implement LSM hooks for improved security handling
* debug mode
* kernel: Add functionality to generate and validate authentication tokens for cmd_su
* kernel: Simplified manual SU command processing for code
* kernel: replace renameat hook with fsnotify
* Revert "refactor: replace throne tracker with ksud token"
This reverts commit aa2cbbf.
* kernel: fix compile
* kernel: fix compile below 6.0
* Fix compile err; Add become_manager
* kernel: install fd for manager automaticlly
- extend to import the corresponding command
* manager: new supercall impl
* temp changes for ksud
* ksud: fix compile
* fix wrong opcode
* kernel: fix compile
* kernel: Fixed hook type and KPM status retrieval errors
* kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10
When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
* ksud: fix cargo check
* manager: Fixed an issue where the KSUD release and user-mode scanning switch failed to function correctly.
- kernel: fix spin lock mutual
kernel: Fixed potential null pointer issue with current->mm in kernel version 5.10
When calling get_full_comm() within system call hooks, current->mm may be null (prctl). A fallback mechanism for current->comm must be added beforehand to prevent null pointer dereferences when accessing mm->arg_start/arg_end.
kernel: try introduce like susfs's method to fix prctl delay
* seccomp: allow reboot
* use u32
* update clang-format
* 4 spaces save the world
* ksud: Fix build on macOS
* manager: bump minimal supported kernel.
- When get_hook_type is empty, display “Unknown”.
* Fix ksud build (#2841)
* try fix ksud
* fix for macos
* remove any
* Fix ksud build, take 3
* try fix allowlist
* bring lsm hook back
* fix: a lot again
* Fix ksud build, take 4 (#2846)
Remove init_driver_fd function for non-linux/android targets
* manager: Return to the native method via KSUd installation
* Merge with susfs-mian format
---------
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: weishu <twsxtd@gmail.com>
Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Co-authored-by: Wang Han <416810799@qq.com>
118 lines
2.5 KiB
C
118 lines
2.5 KiB
C
#ifndef __KSU_H_KSU
|
|
#define __KSU_H_KSU
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#define KERNEL_SU_VERSION KSU_VERSION
|
|
#define KERNEL_SU_OPTION 0xDEADBEEF
|
|
|
|
extern bool ksu_uid_scanner_enabled;
|
|
|
|
#ifdef CONFIG_KSU_MANUAL_SU
|
|
#define CMD_MANUAL_SU_REQUEST 50
|
|
#endif
|
|
|
|
#define EVENT_POST_FS_DATA 1
|
|
#define EVENT_BOOT_COMPLETED 2
|
|
#define EVENT_MODULE_MOUNTED 3
|
|
|
|
#define KSU_APP_PROFILE_VER 2
|
|
#define KSU_MAX_PACKAGE_NAME 256
|
|
// NGROUPS_MAX for Linux is 65535 generally, but we only supports 32 groups.
|
|
#define KSU_MAX_GROUPS 32
|
|
#define KSU_SELINUX_DOMAIN 64
|
|
|
|
// SukiSU Ultra kernel su version full strings
|
|
#ifndef KSU_VERSION_FULL
|
|
#define KSU_VERSION_FULL "v3.x-00000000@unknown"
|
|
#endif
|
|
#define KSU_FULL_VERSION_STRING 255
|
|
|
|
#define DYNAMIC_MANAGER_OP_SET 0
|
|
#define DYNAMIC_MANAGER_OP_GET 1
|
|
#define DYNAMIC_MANAGER_OP_CLEAR 2
|
|
|
|
#define UID_SCANNER_OP_GET_STATUS 0
|
|
#define UID_SCANNER_OP_TOGGLE 1
|
|
#define UID_SCANNER_OP_CLEAR_ENV 2
|
|
|
|
struct dynamic_manager_user_config {
|
|
unsigned int operation;
|
|
unsigned int size;
|
|
char hash[65];
|
|
};
|
|
|
|
struct manager_list_info {
|
|
int count;
|
|
struct {
|
|
uid_t uid;
|
|
int signature_index;
|
|
} managers[2];
|
|
};
|
|
|
|
struct root_profile {
|
|
int32_t uid;
|
|
int32_t gid;
|
|
|
|
int32_t groups_count;
|
|
int32_t groups[KSU_MAX_GROUPS];
|
|
|
|
// kernel_cap_t is u32[2] for capabilities v3
|
|
struct {
|
|
u64 effective;
|
|
u64 permitted;
|
|
u64 inheritable;
|
|
} capabilities;
|
|
|
|
char selinux_domain[KSU_SELINUX_DOMAIN];
|
|
|
|
int32_t namespaces;
|
|
};
|
|
|
|
struct non_root_profile {
|
|
bool umount_modules;
|
|
};
|
|
|
|
struct app_profile {
|
|
// It may be utilized for backward compatibility, although we have never explicitly made any promises regarding this.
|
|
u32 version;
|
|
|
|
// this is usually the package of the app, but can be other value for special apps
|
|
char key[KSU_MAX_PACKAGE_NAME];
|
|
int32_t current_uid;
|
|
bool allow_su;
|
|
|
|
union {
|
|
struct {
|
|
bool use_default;
|
|
char template_name[KSU_MAX_PACKAGE_NAME];
|
|
|
|
struct root_profile profile;
|
|
} rp_config;
|
|
|
|
struct {
|
|
bool use_default;
|
|
|
|
struct non_root_profile profile;
|
|
} nrp_config;
|
|
};
|
|
};
|
|
|
|
bool ksu_queue_work(struct work_struct *work);
|
|
|
|
static inline int startswith(char *s, char *prefix)
|
|
{
|
|
return strncmp(s, prefix, strlen(prefix));
|
|
}
|
|
|
|
static inline int endswith(const char *s, const char *t)
|
|
{
|
|
size_t slen = strlen(s);
|
|
size_t tlen = strlen(t);
|
|
if (tlen > slen)
|
|
return 1;
|
|
return strcmp(s + slen - tlen, t);
|
|
}
|
|
|
|
#endif |