diff --git a/kernel-5.10/KernelSU/kernel/Makefile b/kernel-5.10/KernelSU/kernel/Makefile index 669297563b..04082b9b90 100644 --- a/kernel-5.10/KernelSU/kernel/Makefile +++ b/kernel-5.10/KernelSU/kernel/Makefile @@ -17,25 +17,17 @@ ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm- obj-$(CONFIG_KSU) += kernelsu.o # .git is a text file while the module is imported by 'git submodule add'. -ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0) -$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow) -KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD) +#ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0) +#$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow) +KSU_GIT_VERSION := 1695 # ksu_version: major * 10000 + git version + 200 for historical reasons $(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200)) $(info -- KernelSU version: $(KSU_VERSION)) ccflags-y += -DKSU_VERSION=$(KSU_VERSION) -else # If there is no .git file, the default version will be passed. -$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!") -ccflags-y += -DKSU_VERSION=16 -endif - -ifeq ($(shell grep -q " current_sid(void)" $(srctree)/security/selinux/include/objsec.h; echo $$?),0) -ccflags-y += -DKSU_COMPAT_HAS_CURRENT_SID -endif - -ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/include/security.h; echo $$?),0) -ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE -endif +#else # If there is no .git file, the default version will be passed. +#$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!") +#ccflags-y += -DKSU_VERSION=16 +#endif ifndef KSU_EXPECTED_SIZE KSU_EXPECTED_SIZE := 0x033b @@ -56,13 +48,6 @@ $(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH)) ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE) ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\" -ifeq ($(shell grep -q "int path_umount" $(srctree)/fs/namespace.c; echo $$?),0) -ccflags-y += -DKSU_UMOUNT -else -$(info -- Did you know you can backport path_umount to fs/namespace.c from 5.9?) -$(info -- Read: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount) -endif - ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat ccflags-y += -Wno-declaration-after-statement -Wno-unused-function diff --git a/kernel-5.10/KernelSU/kernel/allowlist.c b/kernel-5.10/KernelSU/kernel/allowlist.c index 4fbba93559..9daceef201 100644 --- a/kernel-5.10/KernelSU/kernel/allowlist.c +++ b/kernel-5.10/KernelSU/kernel/allowlist.c @@ -7,9 +7,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) #include -#endif #include "ksu.h" #include "klog.h" // IWYU pragma: keep diff --git a/kernel-5.10/KernelSU/kernel/arch.h b/kernel-5.10/KernelSU/kernel/arch.h index f36ec5f509..eec38c289e 100644 --- a/kernel-5.10/KernelSU/kernel/arch.h +++ b/kernel-5.10/KernelSU/kernel/arch.h @@ -18,19 +18,11 @@ #define __PT_SP_REG sp #define __PT_IP_REG pc -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) #define PRCTL_SYMBOL "__arm64_sys_prctl" #define SYS_READ_SYMBOL "__arm64_sys_read" #define SYS_NEWFSTATAT_SYMBOL "__arm64_sys_newfstatat" #define SYS_FACCESSAT_SYMBOL "__arm64_sys_faccessat" #define SYS_EXECVE_SYMBOL "__arm64_sys_execve" -#else -#define PRCTL_SYMBOL "sys_prctl" -#define SYS_READ_SYMBOL "sys_read" -#define SYS_NEWFSTATAT_SYMBOL "sys_newfstatat" -#define SYS_FACCESSAT_SYMBOL "sys_faccessat" -#define SYS_EXECVE_SYMBOL "sys_execve" -#endif #elif defined(__x86_64__) @@ -47,19 +39,11 @@ #define __PT_RC_REG ax #define __PT_SP_REG sp #define __PT_IP_REG ip -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) #define PRCTL_SYMBOL "__x64_sys_prctl" #define SYS_READ_SYMBOL "__x64_sys_read" #define SYS_NEWFSTATAT_SYMBOL "__x64_sys_newfstatat" #define SYS_FACCESSAT_SYMBOL "__x64_sys_faccessat" #define SYS_EXECVE_SYMBOL "__x64_sys_execve" -#else -#define PRCTL_SYMBOL "sys_prctl" -#define SYS_READ_SYMBOL "sys_read" -#define SYS_NEWFSTATAT_SYMBOL "sys_newfstatat" -#define SYS_FACCESSAT_SYMBOL "sys_faccessat" -#define SYS_EXECVE_SYMBOL "sys_execve" -#endif #else #error "Unsupported arch" @@ -83,10 +67,6 @@ #define PT_REGS_SP(x) (__PT_REGS_CAST(x)->__PT_SP_REG) #define PT_REGS_IP(x) (__PT_REGS_CAST(x)->__PT_IP_REG) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) #define PT_REAL_REGS(regs) ((struct pt_regs *)PT_REGS_PARM1(regs)) -#else -#define PT_REAL_REGS(regs) ((regs)) -#endif #endif diff --git a/kernel-5.10/KernelSU/kernel/core_hook.c b/kernel-5.10/KernelSU/kernel/core_hook.c index 71265736d5..b63ea0b1d6 100644 --- a/kernel-5.10/KernelSU/kernel/core_hook.c +++ b/kernel-5.10/KernelSU/kernel/core_hook.c @@ -98,11 +98,7 @@ static void setup_groups(struct root_profile *profile, struct cred *cred) put_group_info(group_info); return; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) group_info->gid[i] = kgid; -#else - GROUP_AT(group_info, i) = kgid; -#endif } groups_sort(group_info); @@ -219,6 +215,14 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3, return 0; } + // TODO: find it in throne tracker! + uid_t current_uid_val = current_uid().val; + uid_t manager_uid = ksu_get_manager_uid(); + if (current_uid_val != manager_uid && + current_uid_val % 100000 == manager_uid) { + ksu_set_manager_uid(current_uid_val); + } + bool from_root = 0 == current_uid().val; bool from_manager = is_manager(); @@ -441,14 +445,12 @@ static bool should_umount(struct path *path) return false; } -static int ksu_umount_mnt(struct path *path, int flags) +static void ksu_umount_mnt(struct path *path, int flags) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_UMOUNT) - return path_umount(path, flags); -#else - // TODO: umount for non GKI kernel - return -ENOSYS; -#endif + int err = path_umount(path, flags); + if (err) { + pr_info("umount %s failed: %d\n", path->dentry->d_iname, err); + } } static void try_umount(const char *mnt, bool check_mnt, int flags) @@ -469,10 +471,7 @@ static void try_umount(const char *mnt, bool check_mnt, int flags) return; } - err = ksu_umount_mnt(&path, flags); - if (err) { - pr_warn("umount %s failed: %d\n", mnt, err); - } + ksu_umount_mnt(&path, flags); } int ksu_handle_setuid(struct cred *new, const struct cred *old) @@ -549,14 +548,8 @@ static int handler_pre(struct kprobe *p, struct pt_regs *regs) int option = (int)PT_REGS_PARM1(real_regs); unsigned long arg2 = (unsigned long)PT_REGS_PARM2(real_regs); unsigned long arg3 = (unsigned long)PT_REGS_PARM3(real_regs); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) // PRCTL_SYMBOL is the arch-specificed one, which receive raw pt_regs from syscall unsigned long arg4 = (unsigned long)PT_REGS_SYSCALL_PARM4(real_regs); -#else - // PRCTL_SYMBOL is the common one, called by C convention in do_syscall_64 - // https://elixir.bootlin.com/linux/v4.15.18/source/arch/x86/entry/common.c#L287 - unsigned long arg4 = (unsigned long)PT_REGS_CCALL_PARM4(real_regs); -#endif unsigned long arg5 = (unsigned long)PT_REGS_PARM5(real_regs); return ksu_handle_prctl(option, arg2, arg3, arg4, arg5); @@ -616,23 +609,7 @@ static int ksu_task_prctl(int option, unsigned long arg2, unsigned long arg3, ksu_handle_prctl(option, arg2, arg3, arg4, arg5); return -ENOSYS; } -// kernel 4.4 and 4.9 -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI) -static int ksu_key_permission(key_ref_t key_ref, const struct cred *cred, - unsigned perm) -{ - if (init_session_keyring != NULL) { - return 0; - } - if (strcmp(current->comm, "init")) { - // we are only interested in `init` process - return 0; - } - init_session_keyring = cred->session_keyring; - pr_info("kernel_compat: got init_session_keyring\n"); - return 0; -} -#endif + static int ksu_inode_rename(struct inode *old_inode, struct dentry *old_dentry, struct inode *new_inode, struct dentry *new_dentry) { @@ -650,19 +627,11 @@ static struct security_hook_list ksu_hooks[] = { LSM_HOOK_INIT(task_prctl, ksu_task_prctl), LSM_HOOK_INIT(inode_rename, ksu_inode_rename), LSM_HOOK_INIT(task_fix_setuid, ksu_task_fix_setuid), -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI) - LSM_HOOK_INIT(key_permission, ksu_key_permission) -#endif }; void __init ksu_lsm_hook_init(void) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) security_add_hooks(ksu_hooks, ARRAY_SIZE(ksu_hooks), "ksu"); -#else - // https://elixir.bootlin.com/linux/v4.10.17/source/include/linux/lsm_hooks.h#L1892 - security_add_hooks(ksu_hooks, ARRAY_SIZE(ksu_hooks)); -#endif } #else diff --git a/kernel-5.10/KernelSU/kernel/kernel_compat.c b/kernel-5.10/KernelSU/kernel/kernel_compat.c index b242bc6373..d4ee546d6e 100644 --- a/kernel-5.10/KernelSU/kernel/kernel_compat.c +++ b/kernel-5.10/KernelSU/kernel/kernel_compat.c @@ -1,39 +1,10 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) #include -#else -#include -#endif #include #include "klog.h" // IWYU pragma: keep -#include "kernel_compat.h" // Add check Huawei Device - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI) -#include -#include -#include -struct key *init_session_keyring = NULL; - -static inline int install_session_keyring(struct key *keyring) -{ - struct cred *new; - int ret; - - new = prepare_creds(); - if (!new) - return -ENOMEM; - - ret = install_session_keyring_to_cred(new, keyring); - if (ret < 0) { - abort_creds(new); - return ret; - } - - return commit_creds(new); -} -#endif +#include "kernel_compat.h" extern struct task_struct init_task; @@ -79,13 +50,6 @@ void ksu_android_ns_fs_check() struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI) - if (init_session_keyring != NULL && !current_cred()->session_keyring && - (current->flags & PF_WQ_WORKER)) { - pr_info("installing init session keyring for older kernel\n"); - install_session_keyring(init_session_keyring); - } -#endif // switch mnt_ns even if current is not wq_worker, to ensure what we open is the correct file in android mnt_ns, rather than user created mnt_ns struct ksu_ns_fs_saved saved; if (android_context_saved_enabled) { @@ -108,69 +72,17 @@ struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode) ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count, loff_t *pos) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) return kernel_read(p, buf, count, pos); -#else - loff_t offset = pos ? *pos : 0; - ssize_t result = kernel_read(p, offset, (char *)buf, count); - if (pos && result > 0) { - *pos = offset + result; - } - return result; -#endif } ssize_t ksu_kernel_write_compat(struct file *p, const void *buf, size_t count, loff_t *pos) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) return kernel_write(p, buf, count, pos); -#else - loff_t offset = pos ? *pos : 0; - ssize_t result = kernel_write(p, buf, count, offset); - if (pos && result > 0) { - *pos = offset + result; - } - return result; -#endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, long count) { return strncpy_from_user_nofault(dst, unsafe_addr, count); } -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0) -long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, - long count) -{ - return strncpy_from_unsafe_user(dst, unsafe_addr, count); -} -#else -// Copied from: https://elixir.bootlin.com/linux/v4.9.337/source/mm/maccess.c#L201 -long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, - long count) -{ - mm_segment_t old_fs = get_fs(); - long ret; - - if (unlikely(count <= 0)) - return 0; - - set_fs(USER_DS); - pagefault_disable(); - ret = strncpy_from_user(dst, unsafe_addr, count); - pagefault_enable(); - set_fs(old_fs); - - if (ret >= count) { - ret = count; - dst[ret - 1] = '\0'; - } else if (ret > 0) { - ret++; - } - - return ret; -} -#endif diff --git a/kernel-5.10/KernelSU/kernel/kernel_compat.h b/kernel-5.10/KernelSU/kernel/kernel_compat.h index ba9981857f..4bcfbf3893 100644 --- a/kernel-5.10/KernelSU/kernel/kernel_compat.h +++ b/kernel-5.10/KernelSU/kernel/kernel_compat.h @@ -24,10 +24,6 @@ extern long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, long count); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI) -extern struct key *init_session_keyring; -#endif - extern void ksu_android_ns_fs_check(); extern struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode); diff --git a/kernel-5.10/KernelSU/kernel/ksu.c b/kernel-5.10/KernelSU/kernel/ksu.c index 3639edc215..d517c3b543 100644 --- a/kernel-5.10/KernelSU/kernel/ksu.c +++ b/kernel-5.10/KernelSU/kernel/ksu.c @@ -94,7 +94,4 @@ module_exit(kernelsu_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("weishu"); MODULE_DESCRIPTION("Android KernelSU"); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); -#endif diff --git a/kernel-5.10/KernelSU/kernel/ksud.c b/kernel-5.10/KernelSU/kernel/ksud.c index 68e4735242..98fee107bf 100644 --- a/kernel-5.10/KernelSU/kernel/ksud.c +++ b/kernel-5.10/KernelSU/kernel/ksud.c @@ -6,14 +6,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) #include -#else -#include -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) -#include -#endif #include #include #include @@ -470,27 +463,6 @@ bool ksu_is_safe_mode() #ifdef CONFIG_KPROBES -// https://elixir.bootlin.com/linux/v5.10.158/source/fs/exec.c#L1864 -static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs) -{ - int *fd = (int *)&PT_REGS_PARM1(regs); - struct filename **filename_ptr = - (struct filename **)&PT_REGS_PARM2(regs); - struct user_arg_ptr argv; -#ifdef CONFIG_COMPAT - argv.is_compat = PT_REGS_PARM3(regs); - if (unlikely(argv.is_compat)) { - argv.ptr.compat = PT_REGS_CCALL_PARM4(regs); - } else { - argv.ptr.native = PT_REGS_CCALL_PARM4(regs); - } -#else - argv.ptr.native = PT_REGS_PARM3(regs); -#endif - - return ksu_handle_execveat_ksud(fd, filename_ptr, &argv, NULL, NULL); -} - static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct pt_regs *real_regs = PT_REAL_REGS(regs); @@ -514,18 +486,6 @@ static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs) NULL); } -// remove this later! -__maybe_unused static int vfs_read_handler_pre(struct kprobe *p, - struct pt_regs *regs) -{ - struct file **file_ptr = (struct file **)&PT_REGS_PARM1(regs); - char __user **buf_ptr = (char **)&PT_REGS_PARM2(regs); - size_t *count_ptr = (size_t *)&PT_REGS_PARM3(regs); - loff_t **pos_ptr = (loff_t **)&PT_REGS_CCALL_PARM4(regs); - - return ksu_handle_vfs_read(file_ptr, buf_ptr, count_ptr, pos_ptr); -} - static int sys_read_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct pt_regs *real_regs = PT_REAL_REGS(regs); @@ -545,35 +505,16 @@ static int input_handle_event_handler_pre(struct kprobe *p, return ksu_handle_input_handle_event(type, code, value); } -#if 1 static struct kprobe execve_kp = { .symbol_name = SYS_EXECVE_SYMBOL, .pre_handler = sys_execve_handler_pre, }; -#else -static struct kprobe execve_kp = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) - .symbol_name = "do_execveat_common", -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) - .symbol_name = "__do_execve_file", -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - .symbol_name = "do_execveat_common", -#endif - .pre_handler = execve_handler_pre, -}; -#endif -#if 1 static struct kprobe vfs_read_kp = { .symbol_name = SYS_READ_SYMBOL, .pre_handler = sys_read_handler_pre, }; -#else -static struct kprobe vfs_read_kp = { - .symbol_name = "vfs_read", - .pre_handler = vfs_read_handler_pre, -}; -#endif + static struct kprobe input_event_kp = { .symbol_name = "input_event", diff --git a/kernel-5.10/KernelSU/kernel/selinux/rules.c b/kernel-5.10/KernelSU/kernel/selinux/rules.c index 1ba6d853f2..b4e6eae0c1 100644 --- a/kernel-5.10/KernelSU/kernel/selinux/rules.c +++ b/kernel-5.10/KernelSU/kernel/selinux/rules.c @@ -9,9 +9,7 @@ #include "linux/lsm_audit.h" #include "xfrm.h" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) #define SELINUX_POLICY_INSTEAD_SELINUX_SS -#endif #define KERNEL_SU_DOMAIN "su" #define KERNEL_SU_FILE "ksu_file" @@ -21,18 +19,8 @@ static struct policydb *get_policydb(void) { struct policydb *db; -// selinux_state does not exists before 4.19 -#ifdef KSU_COMPAT_USE_SELINUX_STATE -#ifdef SELINUX_POLICY_INSTEAD_SELINUX_SS struct selinux_policy *policy = rcu_dereference(selinux_state.policy); db = &policy->policydb; -#else - struct selinux_ss *ss = rcu_dereference(selinux_state.ss); - db = &ss->policydb; -#endif -#else - db = &policydb; -#endif return db; } @@ -181,8 +169,7 @@ static int get_object(char *buf, char __user *user_object, size_t buf_sz, // reset avc cache table, otherwise the new rules will not take effect if already denied static void reset_avc_cache() { -#if ((!defined(KSU_COMPAT_USE_SELINUX_STATE)) || \ - LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)) avc_ss_reset(0); selnl_notify_policyload(0); selinux_status_update_policyload(0); diff --git a/kernel-5.10/KernelSU/kernel/selinux/selinux.c b/kernel-5.10/KernelSU/kernel/selinux/selinux.c index c333e8a800..17a25dae5c 100644 --- a/kernel-5.10/KernelSU/kernel/selinux/selinux.c +++ b/kernel-5.10/KernelSU/kernel/selinux/selinux.c @@ -2,9 +2,6 @@ #include "objsec.h" #include "linux/version.h" #include "../klog.h" // IWYU pragma: keep -#ifndef KSU_COMPAT_USE_SELINUX_STATE -#include "avc.h" -#endif #define KERNEL_SU_DOMAIN "u:r:su:s0" @@ -55,32 +52,20 @@ if (!is_domain_permissive) { void setenforce(bool enforce) { #ifdef CONFIG_SECURITY_SELINUX_DEVELOP -#ifdef KSU_COMPAT_USE_SELINUX_STATE selinux_state.enforcing = enforce; -#else - selinux_enforcing = enforce; -#endif #endif } bool getenforce() { #ifdef CONFIG_SECURITY_SELINUX_DISABLE -#ifdef KSU_COMPAT_USE_SELINUX_STATE if (selinux_state.disabled) { -#else - if (selinux_disabled) { -#endif return false; } #endif #ifdef CONFIG_SECURITY_SELINUX_DEVELOP -#ifdef KSU_COMPAT_USE_SELINUX_STATE return selinux_state.enforcing; -#else - return selinux_enforcing; -#endif #else return true; #endif @@ -131,7 +116,7 @@ bool is_zygote(void *sec) return result; } -#define DEVPTS_DOMAIN "u:object_r:devpts:s0" +#define DEVPTS_DOMAIN "u:object_r:ksu_file:s0" u32 ksu_get_devpts_sid() { @@ -142,4 +127,4 @@ u32 ksu_get_devpts_sid() pr_info("get devpts sid err %d\n", err); } return devpts_sid; -} \ No newline at end of file +} diff --git a/kernel-5.10/KernelSU/kernel/selinux/selinux.h b/kernel-5.10/KernelSU/kernel/selinux/selinux.h index 07120c2532..88f1e7d309 100644 --- a/kernel-5.10/KernelSU/kernel/selinux/selinux.h +++ b/kernel-5.10/KernelSU/kernel/selinux/selinux.h @@ -4,10 +4,6 @@ #include "linux/types.h" #include "linux/version.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || defined(KSU_COMPAT_HAS_SELINUX_STATE) -#define KSU_COMPAT_USE_SELINUX_STATE -#endif - void setup_selinux(const char *); void setenforce(bool); diff --git a/kernel-5.10/KernelSU/kernel/selinux/sepolicy.c b/kernel-5.10/KernelSU/kernel/selinux/sepolicy.c index acdc45ad81..7759602c76 100644 --- a/kernel-5.10/KernelSU/kernel/selinux/sepolicy.c +++ b/kernel-5.10/KernelSU/kernel/selinux/sepolicy.c @@ -524,7 +524,6 @@ static bool add_filename_trans(struct policydb *db, const char *s, return false; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) struct filename_trans_key key; key.ttype = tgt->value; key.tclass = cls->value; @@ -532,13 +531,8 @@ static bool add_filename_trans(struct policydb *db, const char *s, struct filename_trans_datum *last = NULL; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) struct filename_trans_datum *trans = policydb_filenametr_search(db, &key); -#else - struct filename_trans_datum *trans = - hashtab_search(&db->filename_trans, &key); -#endif while (trans) { if (ebitmap_get_bit(&trans->stypes, src->value - 1)) { // Duplicate, overwrite existing data and return @@ -567,39 +561,6 @@ static bool add_filename_trans(struct policydb *db, const char *s, db->compat_filename_trans_count++; return ebitmap_set_bit(&trans->stypes, src->value - 1, 1) == 0; -#else // < 5.7.0, has no filename_trans_key, but struct filename_trans - - struct filename_trans key; - key.ttype = tgt->value; - key.tclass = cls->value; - key.name = (char *)o; - - struct filename_trans_datum *trans = - hashtab_search(db->filename_trans, &key); - - if (trans == NULL) { - trans = (struct filename_trans_datum *)kcalloc(sizeof(*trans), - 1, GFP_ATOMIC); - if (!trans) { - pr_err("add_filename_trans: Failed to alloc datum\n"); - return false; - } - struct filename_trans *new_key = - (struct filename_trans *)kmalloc(sizeof(*new_key), - GFP_ATOMIC); - if (!new_key) { - pr_err("add_filename_trans: Failed to alloc new_key\n"); - return false; - } - *new_key = key; - new_key->name = kstrdup(key.name, GFP_ATOMIC); - trans->otype = def->value; - hashtab_insert(db->filename_trans, new_key, trans); - } - - return ebitmap_set_bit(&db->filename_trans_ttypes, src->value - 1, 1) == - 0; -#endif } static bool add_genfscon(struct policydb *db, const char *fs_name, @@ -626,7 +587,6 @@ static void *ksu_realloc(void *old, size_t new_size, size_t old_size) static bool add_type(struct policydb *db, const char *type_name, bool attr) { -#ifdef KSU_SUPPORT_ADD_TYPE struct type_datum *type = symtab_search(&db->p_types, type_name); if (type) { pr_warn("Type %s already exists\n", type_name); @@ -656,7 +616,6 @@ static bool add_type(struct policydb *db, const char *type_name, bool attr) return false; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) struct ebitmap *new_type_attr_map_array = ksu_realloc(db->type_attr_map_array, value * sizeof(struct ebitmap), @@ -703,171 +662,6 @@ static bool add_type(struct policydb *db, const char *type_name, bool attr) } return true; -#elif defined(CONFIG_IS_HW_HISI) - /* - * Huawei use type_attr_map and type_val_to_struct. - * And use ebitmap not flex_array. - */ - size_t new_size = sizeof(struct ebitmap) * db->p_types.nprim; - struct ebitmap *new_type_attr_map = - (krealloc(db->type_attr_map, new_size, GFP_ATOMIC)); - - struct type_datum **new_type_val_to_struct = - krealloc(db->type_val_to_struct, - sizeof(*db->type_val_to_struct) * db->p_types.nprim, - GFP_ATOMIC); - - if (!new_type_attr_map) { - pr_err("add_type: alloc type_attr_map failed\n"); - return false; - } - - if (!new_type_val_to_struct) { - pr_err("add_type: alloc type_val_to_struct failed\n"); - return false; - } - - char **new_val_to_name_types = - krealloc(db->sym_val_to_name[SYM_TYPES], - sizeof(char *) * db->symtab[SYM_TYPES].nprim, - GFP_KERNEL); - if (!new_val_to_name_types) { - pr_err("add_type: alloc val_to_name failed\n"); - return false; - } - - db->type_attr_map = new_type_attr_map; - ebitmap_init(&db->type_attr_map[value - 1], HISI_SELINUX_EBITMAP_RO); - ebitmap_set_bit(&db->type_attr_map[value - 1], value - 1, 1); - - db->type_val_to_struct = new_type_val_to_struct; - db->type_val_to_struct[value - 1] = type; - - db->sym_val_to_name[SYM_TYPES] = new_val_to_name_types; - db->sym_val_to_name[SYM_TYPES][value - 1] = key; - - int i; - for (i = 0; i < db->p_roles.nprim; ++i) { - ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1, - 1); - } - - return true; -#else - // flex_array is not extensible, we need to create a new bigger one instead - struct flex_array *new_type_attr_map_array = - flex_array_alloc(sizeof(struct ebitmap), db->p_types.nprim, - GFP_ATOMIC | __GFP_ZERO); - - struct flex_array *new_type_val_to_struct = - flex_array_alloc(sizeof(struct type_datum *), db->p_types.nprim, - GFP_ATOMIC | __GFP_ZERO); - - struct flex_array *new_val_to_name_types = - flex_array_alloc(sizeof(char *), db->symtab[SYM_TYPES].nprim, - GFP_ATOMIC | __GFP_ZERO); - - if (!new_type_attr_map_array) { - pr_err("add_type: alloc type_attr_map_array failed\n"); - return false; - } - - if (!new_type_val_to_struct) { - pr_err("add_type: alloc type_val_to_struct failed\n"); - return false; - } - - if (!new_val_to_name_types) { - pr_err("add_type: alloc val_to_name failed\n"); - return false; - } - - // preallocate so we don't have to worry about the put ever failing - if (flex_array_prealloc(new_type_attr_map_array, 0, db->p_types.nprim, - GFP_ATOMIC | __GFP_ZERO)) { - pr_err("add_type: prealloc type_attr_map_array failed\n"); - return false; - } - - if (flex_array_prealloc(new_type_val_to_struct, 0, db->p_types.nprim, - GFP_ATOMIC | __GFP_ZERO)) { - pr_err("add_type: prealloc type_val_to_struct_array failed\n"); - return false; - } - - if (flex_array_prealloc(new_val_to_name_types, 0, - db->symtab[SYM_TYPES].nprim, - GFP_ATOMIC | __GFP_ZERO)) { - pr_err("add_type: prealloc val_to_name_types failed\n"); - return false; - } - - int j; - void *old_elem; - // copy the old data or pointers to new flex arrays - for (j = 0; j < db->type_attr_map_array->total_nr_elements; j++) { - old_elem = flex_array_get(db->type_attr_map_array, j); - if (old_elem) - flex_array_put(new_type_attr_map_array, j, old_elem, - GFP_ATOMIC | __GFP_ZERO); - } - - for (j = 0; j < db->type_val_to_struct_array->total_nr_elements; j++) { - old_elem = flex_array_get_ptr(db->type_val_to_struct_array, j); - if (old_elem) - flex_array_put_ptr(new_type_val_to_struct, j, old_elem, - GFP_ATOMIC | __GFP_ZERO); - } - - for (j = 0; j < db->symtab[SYM_TYPES].nprim; j++) { - old_elem = - flex_array_get_ptr(db->sym_val_to_name[SYM_TYPES], j); - if (old_elem) - flex_array_put_ptr(new_val_to_name_types, j, old_elem, - GFP_ATOMIC | __GFP_ZERO); - } - - // store the pointer of old flex arrays first, when assigning new ones we - // should free it - struct flex_array *old_fa; - - old_fa = db->type_attr_map_array; - db->type_attr_map_array = new_type_attr_map_array; - if (old_fa) { - flex_array_free(old_fa); - } - - ebitmap_init(flex_array_get(db->type_attr_map_array, value - 1)); - ebitmap_set_bit(flex_array_get(db->type_attr_map_array, value - 1), - value - 1, 1); - - old_fa = db->type_val_to_struct_array; - db->type_val_to_struct_array = new_type_val_to_struct; - if (old_fa) { - flex_array_free(old_fa); - } - flex_array_put_ptr(db->type_val_to_struct_array, value - 1, type, - GFP_ATOMIC | __GFP_ZERO); - - old_fa = db->sym_val_to_name[SYM_TYPES]; - db->sym_val_to_name[SYM_TYPES] = new_val_to_name_types; - if (old_fa) { - flex_array_free(old_fa); - } - flex_array_put_ptr(db->sym_val_to_name[SYM_TYPES], value - 1, key, - GFP_ATOMIC | __GFP_ZERO); - - int i; - for (i = 0; i < db->p_roles.nprim; ++i) { - ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1, - 1); - } - return true; -#endif - -#else - return false; -#endif } static bool set_type_state(struct policydb *db, const char *type_name, @@ -902,18 +696,7 @@ static bool set_type_state(struct policydb *db, const char *type_name, static void add_typeattribute_raw(struct policydb *db, struct type_datum *type, struct type_datum *attr) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) struct ebitmap *sattr = &db->type_attr_map_array[type->value - 1]; -#elif defined(CONFIG_IS_HW_HISI) - /* - * HISI_SELINUX_EBITMAP_RO is Huawei's unique features. - */ - struct ebitmap *sattr = &db->type_attr_map[type->value - 1], - HISI_SELINUX_EBITMAP_RO; -#else - struct ebitmap *sattr = - flex_array_get(db->type_attr_map_array, type->value - 1); -#endif ebitmap_set_bit(sattr, attr->value - 1, 1); struct hashtab_node *node; diff --git a/kernel-5.10/KernelSU/kernel/sucompat.c b/kernel-5.10/KernelSU/kernel/sucompat.c index 3541741462..966cbf8fa8 100644 --- a/kernel-5.10/KernelSU/kernel/sucompat.c +++ b/kernel-5.10/KernelSU/kernel/sucompat.c @@ -8,11 +8,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include -#else -#include -#endif #include "objsec.h" #include "allowlist.h" @@ -184,15 +180,9 @@ int ksu_handle_devpts(struct inode *inode) return 0; if (ksu_devpts_sid) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) struct inode_security_struct *sec = selinux_inode(inode); -#else - struct inode_security_struct *sec = (struct inode_security_struct *) inode->i_security; -#endif if (sec) { sec->sid = ksu_devpts_sid; - inode->i_uid.val = 0; - inode->i_gid.val = 0; } } @@ -201,18 +191,6 @@ int ksu_handle_devpts(struct inode *inode) #ifdef CONFIG_KPROBES -__maybe_unused static int faccessat_handler_pre(struct kprobe *p, - struct pt_regs *regs) -{ - int *dfd = (int *)&PT_REGS_PARM1(regs); - const char __user **filename_user = (const char **)&PT_REGS_PARM2(regs); - int *mode = (int *)&PT_REGS_PARM3(regs); - // Both sys_ and do_ is C function - int *flags = (int *)&PT_REGS_CCALL_PARM4(regs); - - return ksu_handle_faccessat(dfd, filename_user, mode, flags); -} - static int sys_faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct pt_regs *real_regs = PT_REAL_REGS(regs); @@ -224,43 +202,16 @@ static int sys_faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs) return ksu_handle_faccessat(dfd, filename_user, mode, NULL); } -__maybe_unused static int newfstatat_handler_pre(struct kprobe *p, - struct pt_regs *regs) -{ - int *dfd = (int *)&PT_REGS_PARM1(regs); - const char __user **filename_user = (const char **)&PT_REGS_PARM2(regs); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - // static int vfs_statx(int dfd, const char __user *filename, int flags, struct kstat *stat, u32 request_mask) - int *flags = (int *)&PT_REGS_PARM3(regs); -#else - // int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,int flag) - int *flags = (int *)&PT_REGS_CCALL_PARM4(regs); -#endif - - return ksu_handle_stat(dfd, filename_user, flags); -} - static int sys_newfstatat_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct pt_regs *real_regs = PT_REAL_REGS(regs); int *dfd = (int *)&PT_REGS_PARM1(real_regs); - const char __user **filename_user = - (const char **)&PT_REGS_PARM2(real_regs); + const char __user **filename_user = (const char **)&PT_REGS_PARM2(real_regs); int *flags = (int *)&PT_REGS_SYSCALL_PARM4(real_regs); return ksu_handle_stat(dfd, filename_user, flags); } -// https://elixir.bootlin.com/linux/v5.10.158/source/fs/exec.c#L1864 -static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs) -{ - int *fd = (int *)&PT_REGS_PARM1(regs); - struct filename **filename_ptr = - (struct filename **)&PT_REGS_PARM2(regs); - - return ksu_handle_execveat_sucompat(fd, filename_ptr, NULL, NULL, NULL); -} - static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs) { struct pt_regs *real_regs = PT_REAL_REGS(regs); @@ -271,72 +222,34 @@ static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs) NULL); } -#if 1 static struct kprobe faccessat_kp = { .symbol_name = SYS_FACCESSAT_SYMBOL, .pre_handler = sys_faccessat_handler_pre, }; -#else -static struct kprobe faccessat_kp = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) - .symbol_name = "do_faccessat", -#else - .symbol_name = "sys_faccessat", -#endif - .pre_handler = faccessat_handler_pre, -}; -#endif -#if 1 static struct kprobe newfstatat_kp = { .symbol_name = SYS_NEWFSTATAT_SYMBOL, .pre_handler = sys_newfstatat_handler_pre, }; -#else -static struct kprobe newfstatat_kp = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - .symbol_name = "vfs_statx", -#else - .symbol_name = "vfs_fstatat", -#endif - .pre_handler = newfstatat_handler_pre, -}; -#endif -#if 1 static struct kprobe execve_kp = { .symbol_name = SYS_EXECVE_SYMBOL, .pre_handler = sys_execve_handler_pre, }; -#else -static struct kprobe execve_kp = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) - .symbol_name = "do_execveat_common", -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) - .symbol_name = "__do_execve_file", -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - .symbol_name = "do_execveat_common", -#endif - .pre_handler = execve_handler_pre, -}; -#endif -static int devpts_get_priv_pre(struct kprobe *p, struct pt_regs *regs) +static int pts_unix98_lookup_pre(struct kprobe *p, struct pt_regs *regs) { struct inode *inode; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) - struct dentry *dentry = (struct dentry *)PT_REGS_PARM1(regs); - inode = dentry->d_inode; -#else - inode = (struct inode *)PT_REGS_PARM1(real_regs); -#endif + struct file *file = (struct file *)PT_REGS_PARM2(regs); + inode = file->f_path.dentry->d_inode; return ksu_handle_devpts(inode); } -static struct kprobe devpts_get_priv_kp = { .symbol_name = "devpts_get_priv", - .pre_handler = - devpts_get_priv_pre }; +static struct kprobe pts_unix98_lookup_kp = { .symbol_name = + "pts_unix98_lookup", + .pre_handler = + pts_unix98_lookup_pre }; #endif @@ -351,7 +264,7 @@ void ksu_sucompat_init() pr_info("sucompat: newfstatat_kp: %d\n", ret); ret = register_kprobe(&faccessat_kp); pr_info("sucompat: faccessat_kp: %d\n", ret); - ret = register_kprobe(&devpts_get_priv_kp); + ret = register_kprobe(&pts_unix98_lookup_kp); pr_info("sucompat: devpts_kp: %d\n", ret); #endif } @@ -362,6 +275,6 @@ void ksu_sucompat_exit() unregister_kprobe(&execve_kp); unregister_kprobe(&newfstatat_kp); unregister_kprobe(&faccessat_kp); - unregister_kprobe(&devpts_get_priv_kp); + unregister_kprobe(&pts_unix98_lookup_kp); #endif } diff --git a/kernel-5.10/KernelSU/kernel/throne_tracker.c b/kernel-5.10/KernelSU/kernel/throne_tracker.c index 665ee3bf2b..d7c1dae14a 100644 --- a/kernel-5.10/KernelSU/kernel/throne_tracker.c +++ b/kernel-5.10/KernelSU/kernel/throne_tracker.c @@ -5,7 +5,6 @@ #include #include #include -#include #include "allowlist.h" #include "klog.h" // IWYU pragma: keep @@ -16,8 +15,7 @@ uid_t ksu_manager_uid = KSU_INVALID_UID; -#define SYSTEM_PACKAGES_LIST_PATH "/data/system/packages.list" -static struct work_struct ksu_update_uid_work; +#define SYSTEM_PACKAGES_LIST_PATH "/data/system/packages.list.tmp" struct uid_data { struct list_head list; @@ -94,8 +92,25 @@ static void crown_manager(const char *apk, struct list_head *uid_data) } } +#define DATA_PATH_LEN 384 // 384 is enough for /data/app//base.apk + +struct data_path { + char dirpath[DATA_PATH_LEN]; + int depth; + struct list_head list; +}; + +struct apk_path_hash { + unsigned int hash; + bool exists; + struct list_head list; +}; + +static struct list_head apk_path_hash_list = LIST_HEAD_INIT(apk_path_hash_list); + struct my_dir_context { struct dir_context ctx; + struct list_head *data_path_list; char *parent_dir; void *private_data; int depth; @@ -119,8 +134,7 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name, { struct my_dir_context *my_ctx = container_of(ctx, struct my_dir_context, ctx); - struct file *file; - char dirpath[384]; // 384 is enough for /data/app//base.apk + char dirpath[DATA_PATH_LEN]; if (!my_ctx) { pr_err("Invalid context\n"); @@ -134,8 +148,8 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name, if (!strncmp(name, "..", namelen) || !strncmp(name, ".", namelen)) return FILLDIR_ACTOR_CONTINUE; // Skip "." and ".." - if (snprintf(dirpath, sizeof(dirpath), "%s/%.*s", my_ctx->parent_dir, - namelen, name) >= sizeof(dirpath)) { + if (snprintf(dirpath, DATA_PATH_LEN, "%s/%.*s", my_ctx->parent_dir, + namelen, name) >= DATA_PATH_LEN) { pr_err("Path too long: %s/%.*s\n", my_ctx->parent_dir, namelen, name); return FILLDIR_ACTOR_CONTINUE; @@ -143,29 +157,44 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name, if (d_type == DT_DIR && my_ctx->depth > 0 && (my_ctx->stop && !*my_ctx->stop)) { - struct my_dir_context sub_ctx = { .ctx.actor = my_actor, - .parent_dir = dirpath, - .private_data = - my_ctx->private_data, - .depth = my_ctx->depth - 1, - .stop = my_ctx->stop }; - file = ksu_filp_open_compat(dirpath, O_RDONLY | O_NOFOLLOW, 0); - if (IS_ERR(file)) { - pr_err("Failed to open directory: %s, err: %ld\n", - dirpath, PTR_ERR(file)); + struct data_path *data = kmalloc(sizeof(struct data_path), GFP_ATOMIC); + + if (!data) { + pr_err("Failed to allocate memory for %s\n", dirpath); return FILLDIR_ACTOR_CONTINUE; } - iterate_dir(file, &sub_ctx.ctx); - filp_close(file, NULL); + strscpy(data->dirpath, dirpath, DATA_PATH_LEN); + data->depth = my_ctx->depth - 1; + list_add_tail(&data->list, my_ctx->data_path_list); } else { if ((namelen == 8) && (strncmp(name, "base.apk", namelen) == 0)) { + struct apk_path_hash *pos, *n; + unsigned int hash = full_name_hash(NULL, dirpath, strlen(dirpath)); + list_for_each_entry(pos, &apk_path_hash_list, list) { + if (hash == pos->hash) { + pos->exists = true; + return FILLDIR_ACTOR_CONTINUE; + } + } + bool is_manager = is_manager_apk(dirpath); - pr_info("Found base.apk at path: %s, is_manager: %d\n", + pr_info("Found new base.apk at path: %s, is_manager: %d\n", dirpath, is_manager); if (is_manager) { crown_manager(dirpath, my_ctx->private_data); *my_ctx->stop = 1; + + // Manager found, clear APK cache list + list_for_each_entry_safe(pos, n, &apk_path_hash_list, list) { + list_del(&pos->list); + kfree(pos); + } + } else { + struct apk_path_hash *apk_data = kmalloc(sizeof(struct apk_path_hash), GFP_ATOMIC); + apk_data->hash = hash; + apk_data->exists = true; + list_add_tail(&apk_data->list, &apk_path_hash_list); } } } @@ -175,22 +204,58 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name, void search_manager(const char *path, int depth, struct list_head *uid_data) { - struct file *file; - int stop = 0; - struct my_dir_context ctx = { .ctx.actor = my_actor, - .parent_dir = (char *)path, - .private_data = uid_data, - .depth = depth, - .stop = &stop }; + int i, stop = 0; + struct list_head data_path_list; + INIT_LIST_HEAD(&data_path_list); - file = ksu_filp_open_compat(path, O_RDONLY | O_NOFOLLOW, 0); - if (IS_ERR(file)) { - pr_err("Failed to open directory: %s\n", path); - return; + // Initialize APK cache list + struct apk_path_hash *pos, *n; + list_for_each_entry(pos, &apk_path_hash_list, list) { + pos->exists = false; } - iterate_dir(file, &ctx.ctx); - filp_close(file, NULL); + // First depth + struct data_path data; + strscpy(data.dirpath, path, DATA_PATH_LEN); + data.depth = depth; + list_add_tail(&data.list, &data_path_list); + + for (i = depth; i > 0; i--) { + struct data_path *pos, *n; + + list_for_each_entry_safe(pos, n, &data_path_list, list) { + struct my_dir_context ctx = { .ctx.actor = my_actor, + .data_path_list = &data_path_list, + .parent_dir = pos->dirpath, + .private_data = uid_data, + .depth = pos->depth, + .stop = &stop }; + struct file *file; + + if (!stop) { + file = ksu_filp_open_compat(pos->dirpath, O_RDONLY | O_NOFOLLOW, 0); + if (IS_ERR(file)) { + pr_err("Failed to open directory: %s, err: %ld\n", pos->dirpath, PTR_ERR(file)); + goto skip_iterate; + } + + iterate_dir(file, &ctx.ctx); + filp_close(file, NULL); + } +skip_iterate: + list_del(&pos->list); + if (pos != &data) + kfree(pos); + } + } + + // Remove stale cached APK entries + list_for_each_entry_safe(pos, n, &apk_path_hash_list, list) { + if (!pos->exists) { + list_del(&pos->list); + kfree(pos); + } + } } static bool is_uid_exist(uid_t uid, char *package, void *data) @@ -209,14 +274,13 @@ static bool is_uid_exist(uid_t uid, char *package, void *data) return exist; } -static void do_update_uid(struct work_struct *work) +void track_throne() { struct file *fp = ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0); if (IS_ERR(fp)) { - pr_err("do_update_uid, open " SYSTEM_PACKAGES_LIST_PATH - " failed: %ld\n", - PTR_ERR(fp)); + pr_err("%s: open " SYSTEM_PACKAGES_LIST_PATH " failed: %ld\n", + __func__, PTR_ERR(fp)); return; } @@ -303,14 +367,9 @@ out: } } -void track_throne() -{ - ksu_queue_work(&ksu_update_uid_work); -} - void ksu_throne_tracker_init() { - INIT_WORK(&ksu_update_uid_work, do_update_uid); + // nothing to do } void ksu_throne_tracker_exit() diff --git a/kernel-5.10/KernelSU/manager/app/build.gradle.kts b/kernel-5.10/KernelSU/manager/app/build.gradle.kts index e0f49ba8d9..1c85d8af7e 100644 --- a/kernel-5.10/KernelSU/manager/app/build.gradle.kts +++ b/kernel-5.10/KernelSU/manager/app/build.gradle.kts @@ -3,6 +3,7 @@ import com.android.build.gradle.internal.api.BaseVariantOutputImpl plugins { alias(libs.plugins.agp.app) alias(libs.plugins.kotlin) + alias(libs.plugins.compose.compiler) alias(libs.plugins.ksp) alias(libs.plugins.lsplugin.apksign) id("kotlin-parcelize") @@ -39,10 +40,6 @@ android { jvmTarget = "21" } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } - packaging { jniLibs { useLegacyPackaging = true diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt index 3425826ef9..6ecf53a897 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt @@ -38,6 +38,7 @@ import me.weishu.kernelsu.ui.component.rememberConfirmDialog import me.weishu.kernelsu.ui.screen.destinations.InstallScreenDestination import me.weishu.kernelsu.ui.screen.destinations.SettingScreenDestination import me.weishu.kernelsu.ui.util.* +import me.weishu.kernelsu.ui.util.module.LatestVersionInfo @RootNavGraph(start = true) @Destination @@ -100,13 +101,18 @@ fun HomeScreen(navigator: DestinationsNavigator) { @Composable fun UpdateCard() { val context = LocalContext.current - val newVersion by produceState(initialValue = Triple(0, "", "")) { - value = withContext(Dispatchers.IO) { checkNewVersion() } + val latestVersionInfo = LatestVersionInfo() + val newVersion by produceState(initialValue = latestVersionInfo) { + value = withContext(Dispatchers.IO){ + checkNewVersion() + } } + + val currentVersionCode = getManagerVersion(context).second - val newVersionCode = newVersion.first - val newVersionUrl = newVersion.second - val changelog = newVersion.third + val newVersionCode = newVersion.versionCode + val newVersionUrl = newVersion.downloadUrl + val changelog = newVersion.changelog val uriHandler = LocalUriHandler.current val title = stringResource(id = R.string.module_changelog) @@ -122,7 +128,9 @@ fun UpdateCard() { message = stringResource(id = R.string.new_version_available).format(newVersionCode), MaterialTheme.colorScheme.outlineVariant ) { - if (changelog.isNotEmpty()) { + if (changelog.isEmpty()) { + uriHandler.openUri(newVersionUrl) + } else { updateDialog.showConfirm( title = title, content = changelog, diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt index 4af20bd4e7..4f970f7ee3 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt @@ -1,11 +1,17 @@ package me.weishu.kernelsu.ui.screen +import android.content.ContentResolver import android.content.Context import android.content.Intent +import android.database.Cursor import android.net.Uri +import android.provider.OpenableColumns +import android.util.Log import android.widget.Toast import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -20,25 +26,34 @@ import androidx.compose.material.icons.filled.DeleteForever import androidx.compose.material.icons.filled.DeveloperMode import androidx.compose.material.icons.filled.Fence import androidx.compose.material.icons.filled.RemoveModerator +import androidx.compose.material.icons.filled.Save +import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.filled.Update +import androidx.compose.material3.BottomSheetScaffold import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem +import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.LineHeightStyle +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.core.content.FileProvider import com.maxkeppeker.sheets.core.models.base.Header import com.maxkeppeker.sheets.core.models.base.IconSource @@ -65,12 +80,16 @@ import me.weishu.kernelsu.ui.component.rememberLoadingDialog import me.weishu.kernelsu.ui.screen.destinations.AppProfileTemplateScreenDestination import me.weishu.kernelsu.ui.screen.destinations.FlashScreenDestination import me.weishu.kernelsu.ui.util.getBugreportFile +import me.weishu.kernelsu.ui.util.getFileNameFromUri import me.weishu.kernelsu.ui.util.shrinkModules +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter /** * @author weishu * @date 2023/1/1. */ +@OptIn(ExperimentalMaterial3Api::class) @Destination @Composable fun SettingScreen(navigator: DestinationsNavigator) { @@ -151,6 +170,7 @@ fun SettingScreen(navigator: DestinationsNavigator) { enableWebDebugging = it } + var showBottomsheet by remember { mutableStateOf(false) } ListItem( leadingContent = { @@ -161,34 +181,127 @@ fun SettingScreen(navigator: DestinationsNavigator) { }, headlineContent = { Text(stringResource(id = R.string.send_log)) }, modifier = Modifier.clickable { - scope.launch { - val bugreport = loadingDialog.withLoading { - withContext(Dispatchers.IO) { - getBugreportFile(context) - } - } - - val uri: Uri = - FileProvider.getUriForFile( - context, - "${BuildConfig.APPLICATION_ID}.fileprovider", - bugreport - ) - - val shareIntent = Intent(Intent.ACTION_SEND) - shareIntent.putExtra(Intent.EXTRA_STREAM, uri) - shareIntent.setDataAndType(uri, "application/zip") - shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - - context.startActivity( - Intent.createChooser( - shareIntent, - context.getString(R.string.send_log) - ) - ) - } + showBottomsheet = true } ) + if (showBottomsheet){ + ModalBottomSheet( + onDismissRequest = { showBottomsheet = false }, + content = { + Row(modifier = Modifier.padding(10.dp) + .align(Alignment.CenterHorizontally) + + ) { + Box{ + Column( + modifier = Modifier.padding(16.dp) + .clickable { + scope.launch { + val bugreport = loadingDialog.withLoading { + withContext(Dispatchers.IO) { + getBugreportFile(context) + } + } + + val uri: Uri = + FileProvider.getUriForFile( + context, + "${BuildConfig.APPLICATION_ID}.fileprovider", + bugreport + ) + val filename = getFileNameFromUri(context , uri) + val savefile = Intent(Intent.ACTION_CREATE_DOCUMENT).apply { + addCategory(Intent.CATEGORY_OPENABLE) + type = "application/zip" + putExtra(Intent.EXTRA_STREAM, uri) + putExtra(Intent.EXTRA_TITLE, filename) + flags = Intent.FLAG_GRANT_READ_URI_PERMISSION + } + context.startActivity( + Intent.createChooser( + savefile, + context.getString(R.string.save_log) + ) + ) + } + } + ) { + Icon( + Icons.Filled.Save, + contentDescription = null, + modifier = Modifier.align(Alignment.CenterHorizontally) + ) + Text( + text = stringResource(id = R.string.save_log), + modifier = Modifier.padding(top = 16.dp), + textAlign = TextAlign.Center.also { + LineHeightStyle( + alignment = LineHeightStyle.Alignment.Center, + trim = LineHeightStyle.Trim.None + ) + } + + ) + } + + } + Box{ + Column( + modifier = Modifier.padding(16.dp) + .clickable { + scope.launch { + val bugreport = loadingDialog.withLoading { + withContext(Dispatchers.IO) { + getBugreportFile(context) + } + } + + val uri: Uri = + FileProvider.getUriForFile( + context, + "${BuildConfig.APPLICATION_ID}.fileprovider", + bugreport + ) + + val shareIntent = Intent(Intent.ACTION_SEND) + shareIntent.putExtra(Intent.EXTRA_STREAM, uri) + shareIntent.setDataAndType(uri, "application/zip") + shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + + context.startActivity( + Intent.createChooser( + shareIntent, + context.getString(R.string.send_log) + ) + ) + } + } + ) { + Icon( + Icons.Filled.Share, + contentDescription = null, + modifier = Modifier.align(Alignment.CenterHorizontally) + ) + Text( + text = stringResource(id = R.string.send_log), + modifier = Modifier.padding(top = 16.dp), + textAlign = TextAlign.Center.also { + LineHeightStyle( + alignment = LineHeightStyle.Alignment.Center, + trim = LineHeightStyle.Trim.None + ) + } + + ) + } + + } + } + } + ) + + + } val shrink = stringResource(id = R.string.shrink_sparse_image) val shrinkMessage = stringResource(id = R.string.shrink_sparse_image_message) @@ -237,7 +350,6 @@ fun SettingScreen(navigator: DestinationsNavigator) { } } } - @Composable fun UninstallItem( navigator: DestinationsNavigator, diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt index e72d70b2d0..954cac50da 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt @@ -11,6 +11,7 @@ import android.os.Build import android.os.Environment import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect +import me.weishu.kernelsu.ui.util.module.LatestVersionInfo /** * @author weishu @@ -61,9 +62,10 @@ fun download( downloadManager.enqueue(request) } -fun checkNewVersion(): Triple { +fun checkNewVersion(): LatestVersionInfo { val url = "https://api.github.com/repos/tiann/KernelSU/releases/latest" - val defaultValue = Triple(0, "", "") + // default null value if failed + val defaultValue = LatestVersionInfo() runCatching { okhttp3.OkHttpClient().newCall(okhttp3.Request.Builder().url(url).build()).execute() .use { response -> @@ -88,7 +90,11 @@ fun checkNewVersion(): Triple { val versionCode = matchResult.groupValues[2].toInt() val downloadUrl = asset.getString("browser_download_url") - return Triple(versionCode, downloadUrl, changelog) + return LatestVersionInfo( + versionCode, + downloadUrl, + changelog + ) } } diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt index a4e1066b32..108e08f2a1 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt @@ -1,10 +1,14 @@ package me.weishu.kernelsu.ui.util +import android.content.ContentResolver +import android.content.Context +import android.database.Cursor import android.net.Uri import android.os.Build import android.os.Environment import android.os.Parcelable import android.os.SystemClock +import android.provider.OpenableColumns import android.util.Log import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.Shell @@ -48,6 +52,18 @@ inline fun withNewRootShell( return createRootShell(globalMnt).use(block) } +fun getFileNameFromUri(context: Context, uri: Uri): String? { + var fileName: String? = null + val contentResolver: ContentResolver = context.contentResolver + val cursor: Cursor? = contentResolver.query(uri, null, null, null, null) + cursor?.use { + if (it.moveToFirst()) { + fileName = it.getString(it.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME)) + } + } + return fileName +} + fun createRootShell(globalMnt: Boolean = false): Shell { Shell.enableVerboseLogging = BuildConfig.DEBUG val builder = Shell.Builder.create() diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt index 5e81a73da4..19eb1df189 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt @@ -1,12 +1,16 @@ package me.weishu.kernelsu.ui.util +import android.content.ContentResolver import android.content.Context +import android.net.Uri import android.os.Build +import android.os.ParcelFileDescriptor import android.system.Os import com.topjohnwu.superuser.ShellUtils import me.weishu.kernelsu.Natives import me.weishu.kernelsu.ui.screen.getManagerVersion import java.io.File +import java.io.FileOutputStream import java.io.FileWriter import java.io.PrintWriter import java.time.LocalDateTime @@ -108,3 +112,4 @@ fun getBugreportFile(context: Context): File { return targetFile } + diff --git a/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/module/LatestVersionInfo.kt b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/module/LatestVersionInfo.kt new file mode 100644 index 0000000000..374b3853ab --- /dev/null +++ b/kernel-5.10/KernelSU/manager/app/src/main/java/me/weishu/kernelsu/ui/util/module/LatestVersionInfo.kt @@ -0,0 +1,7 @@ +package me.weishu.kernelsu.ui.util.module + +data class LatestVersionInfo( + val versionCode : Int = 0, + val downloadUrl : String = "", + val changelog : String = "" +) diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ar/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ar/strings.xml index 43a1fc9f71..c38c4fc894 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ar/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ar/strings.xml @@ -130,4 +130,5 @@ صورة lkm المحددة: %s استعادة صورة المصنع المخزنة (في حالة وجود نسخة احتياطية)، والتي تُستخدم عادة قبل OTA؛ إذا كنت بحاجة إلى إلغاء تثبيت KernelSU، فيرجى استخدام \"إلغاء التثبيت الدائم\". قم بإلغاء تثبيت KernelSU مؤقتًا، واستعد إلى حالته الأصلية بعد إعادة التشغيل التالية. + حفظ السجلات \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-az/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-az/strings.xml index d693196297..21ec189f55 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-az/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-az/strings.xml @@ -78,4 +78,5 @@ Məcburi dayandır Yenidən başlat %s görə SELinux qaydalarını güncəlləmək mümkün olmadı + Girişləri Saxla \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn-rBD/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn-rBD/strings.xml index add3777f53..078d88fee7 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn-rBD/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn-rBD/strings.xml @@ -48,4 +48,5 @@ %s আনইনস্টল করা যায়নি ভার্সন অথার + লগ সংরক্ষণ করুন \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn/strings.xml index beb0253e7d..312672c871 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bn/strings.xml @@ -64,4 +64,5 @@ আলাদাভাবে আনমাউন্ট মোডিউল ম্যানেজার সঠিকভাবে কাজ করার জন্য বর্তমান KernelSU সংস্করণ %d খুবই কম। অনুগ্রহ করে %d বা উচ্চতর সংস্করণে আপগ্রেড করুন! + লগ সংরক্ষণ করুন \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bs/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bs/strings.xml index d8b86b1090..da07863193 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-bs/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-bs/strings.xml @@ -79,4 +79,5 @@ Šablon Prilagođeno Naziv profila + Sačuvaj Dnevnike \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-da/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-da/strings.xml index 4767311c65..6ab022567f 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-da/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-da/strings.xml @@ -79,4 +79,5 @@ Regler Genstart Den nuværende KernelSU version %d er for lav til manageren for at fungere ordentligt. Opgrader til version %d eller højere! + Gem Logfiler \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-de/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-de/strings.xml index d6482f0a0f..e87577420f 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-de/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-de/strings.xml @@ -117,4 +117,9 @@ Öffnen Updates suchen Automatisch nach Updates suchen beim Öffnen der App + Temporär deinstallieren + Deinstallieren + KernelSU (Root und alle Module) vollständig und dauerhaft deinstallieren. + Ändert die Größe des Sparse-Images, in dem sich das Modul befindet, auf seine tatsächliche Größe. Beachten Sie, dass dies dazu führen kann, dass das Modul nicht ordnungsgemäß funktioniert; verwenden Sie es daher nur, wenn es notwendig ist (z. B. für ein Backup). + Protokolle Speichern \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-es/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-es/strings.xml index b69aa6f198..5623b47a29 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-es/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-es/strings.xml @@ -103,4 +103,5 @@ Eliminar El portapapeles esta vacio! Ver plantilla + Guardar Registros \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-et/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-et/strings.xml index ba16f7ad9d..d514fc6aea 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-et/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-et/strings.xml @@ -108,4 +108,5 @@ Rakenduse avamisel kontrolli automaatselt uuendusi Ava Luba WebView silumine + Salvesta Logid \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fa/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fa/strings.xml index 6a6cf2a4b5..a5cdb2f7ff 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fa/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fa/strings.xml @@ -63,4 +63,5 @@ گلوبال تکی جداکردن ماژول ها + ذخیره گزارش‌ها diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fil/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fil/strings.xml index f708f0b71c..fc527bf306 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fil/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fil/strings.xml @@ -66,4 +66,5 @@ Pangalan ng profile Minana Ang pangkalahatang default na halaga para sa \"Umount modules\" sa Mga Profile ng App. Kung pinagana, aalisin nito ang lahat ng mga pagbabago sa modyul sa system para sa mga aplikasyon na walang hanay ng Profile. + I-save ang mga Log \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fr/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fr/strings.xml index 1c3c3d5b91..6b6c45d9bd 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-fr/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-fr/strings.xml @@ -118,8 +118,8 @@ Suivant L\'image de la partition %1$s est recommandée Sélectionner une KMI - Minimiser l\'image clairsemée - Redimensionne l\'image clairsemée où se trouve le module à sa taille réelle. Notez que cela peut entraîner un dysfonctionnement du module, alors utilisez cette fonctionnalité uniquement lorsque nécessaire (pour la sauvegarde, par exemple) + Minimiser la taille de l\'image partiellement allouée + Redimensionner à sa taille réelle l\'image partiellement allouée où se trouve le module. Notez que cela peut entraîner un dysfonctionnement du module, utilisez donc cette fonctionnalité uniquement lorsque c\'est nécessaire (par exemple pour la sauvegarde de l\'appareil). Désinstaller Désinstaller temporairement Désinstaller définitivement @@ -131,4 +131,5 @@ lkm sélectionné : %s Désinstallation complète et permanente de KernelSU (root et tous les modules). Désinstaller KernelSU temporairement et rétablir l\'état original au redémarrage suivant. + Enregistrer les Journaux \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hi/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hi/strings.xml index 899b327cf2..f930446936 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hi/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hi/strings.xml @@ -80,4 +80,5 @@ %1$s पर स्रोत कोड देखें
हमारे %2$s चैनल से जुड़ें
मैनेजर वर्जन नया वर्जन: %s उपलब्ध है,अपग्रेड के लिए क्लिक करें + लॉग सहेजें \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hr/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hr/strings.xml index e57b3a201d..9fb1e4c674 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hr/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hr/strings.xml @@ -79,4 +79,5 @@ Pokrenite Prisilno Zaustavite Resetujte + Spremi Zapise \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hu/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hu/strings.xml index 71261199a5..2b52317c1b 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-hu/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-hu/strings.xml @@ -102,4 +102,5 @@ Törlés A vágólap üres! Sablon megnézése + Naplók Mentése \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-in/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-in/strings.xml index 864f9c3f2d..98698f529a 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-in/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-in/strings.xml @@ -131,4 +131,5 @@ LKM dipilih: %s Pasang Pemasangan Gagal + Simpan Log \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-it/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-it/strings.xml index 885f5d8fdf..7bd3f92473 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-it/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-it/strings.xml @@ -130,4 +130,5 @@ Installazione fallita LKM selezionato: %s Ripristina l\'immagine di fabbrica del produttore (se il backup è presente), solitamente usato prima di applicare l\'OTA; se devi disinstallare KernelSU, utilizza invece \"Disinstalla Permanentemente\". + Salva Registri \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-iw/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-iw/strings.xml index eee70a9bbc..18cfc638eb 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-iw/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-iw/strings.xml @@ -80,4 +80,5 @@ ראה את קוד המקור ב%1$s
הצטרף אלינו %2$s בערוץ
גרסת מנהל גרסה חדשה עבור: %s זמינה, לחץ כדי לשדרג + שמור יומנים \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ja/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ja/strings.xml index d210e0e19d..4ecf742044 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ja/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ja/strings.xml @@ -131,4 +131,5 @@ フラッシュ成功 フラッシュ失敗 選択された lkm: %s + ログを保存 \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-kn/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-kn/strings.xml index 564ceb544c..3c4e79fe63 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-kn/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-kn/strings.xml @@ -66,4 +66,5 @@ %1$s ನಲ್ಲಿ ಮೂಲ ಕೋಡ್ ಅನ್ನು ವೀಕ್ಷಿಸಿ
ನಮ್ಮ %2$s ಚಾನಲ್‌ಗೆ ಸೇರಿ
ಮ್ಯಾನೇಜರ್ ವರ್ಷನ್ ಹೊಸ ಆವೃತ್ತಿ: %s ಲಭ್ಯವಿದೆ, ಅಪ್‌ಗ್ರೇಡ್ ಮಾಡಲು ಕ್ಲಿಕ್ ಮಾಡಿ + ಲಾಗ್ಗಳನ್ನು ಉಳಿಸಿ \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ko/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ko/strings.xml index 75de3a0f2c..7c29cc02f3 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ko/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ko/strings.xml @@ -78,4 +78,5 @@ 도메인 실행 다음 앱에 대한 SELinux 규칙 업데이트 실패: %s + 로그 저장 \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-lt/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-lt/strings.xml index a5ba9efca6..cba5f5b18c 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-lt/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-lt/strings.xml @@ -80,4 +80,5 @@ Visuotinė numatytoji „Modulių atjungimo“ reikšmė programų profiliuose. Jei įjungta, ji pašalins visus sistemos modulio pakeitimus programoms, kurios neturi profilio. Keitimų žurnalas Ši KernelSU versija %d yra per žema, kad šis vadybininkas galėtų tinkamai funkcionuoti. Prašome atsinaujinti į versiją %d ar aukščiau! + Saglabāt Žurnālus \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-lv/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-lv/strings.xml index 70c2fe269e..c264b76a65 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-lv/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-lv/strings.xml @@ -130,4 +130,5 @@ Instalēšana neizdevās Samazināt reto attēlu Mainīt retā attēla izmēru, kurā atrodas modulis, līdz tā faktiskajam izmēram. Ņemiet vērā, ka tas var izraisīt moduļa neparastu darbību, tāpēc, lūdzu, izmantojiet tikai nepieciešamības gadījumā (piemēram, dublēšanai) + Išsaugoti Žurnalus \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-mr/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-mr/strings.xml index fad70307d0..eaaf2a255b 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-mr/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-mr/strings.xml @@ -78,4 +78,5 @@ सक्तीने थांबा लाँच करा पुन्हा सुरू करा + लॉग जतन करा \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ms/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ms/strings.xml index 5b93e09232..46c1539c7e 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ms/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ms/strings.xml @@ -34,4 +34,5 @@ Tidak terpasang Mulakan semula ke bootloader Versi Manager + Simpan Log \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-nl/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-nl/strings.xml index 791bf4739c..992e8f8ab6 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-nl/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-nl/strings.xml @@ -125,4 +125,8 @@ Permanent verwijderen Herstel stockafbeelding Verwijder KernelSU tijdelijk en herstel het naar de oorspronkelijke staat na de volgende herstart. + Het verwijderen van KernelSU (Root en alle modules) volledig en permanent. + Herstel de fabrieksimage (als er een back-up bestaat), meestal gebruikt vóór OTA; als u KernelSU moet verwijderen, gebruik dan \"Permanent verwijderen\". + Knipperen + Logboeken Opslaan \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pl/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pl/strings.xml index a1a17d8fa7..b4fe83f3dc 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pl/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pl/strings.xml @@ -132,4 +132,5 @@ Flashowanie ukończone pomyślnie Flashowanie nieudane Wybrano lkm: %s + Zapisz Dzienniki \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt-rBR/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt-rBR/strings.xml index 2445bd50f5..f092a45128 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt-rBR/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt-rBR/strings.xml @@ -131,4 +131,5 @@ Flash falhou Flashando Flash bem-sucedido + Salvar Logs \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt/strings.xml index 590f487f53..ea1547db49 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-pt/strings.xml @@ -79,4 +79,5 @@ Forçar parada Nova versão: %s está disponível, clique para baixar A versão atual do KernelSU %d é muito baixa para o gerenciador funcionar corretamente. Atualize para a versão %d ou superior! + Salvar Registros \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ro/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ro/strings.xml index 4a991ef727..fea3ffb695 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ro/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ro/strings.xml @@ -128,4 +128,5 @@ Instalare Instalare reușită Instalarea a eșuat + Salvează Jurnale \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ru/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ru/strings.xml index f07ef3e2eb..91dd276ff0 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-ru/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-ru/strings.xml @@ -134,4 +134,5 @@ Установка Установка не выполнена Выбран lkm: %s + Сохранить Журналы \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-sl/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-sl/strings.xml index 70bdb7c452..ae02e596c5 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-sl/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-sl/strings.xml @@ -102,4 +102,5 @@ Sinhroniziraj predloge iz spleta Uvoz/Izvoz Napaka pri pridobivanju dnevnika sprememb: %s + Shrani Dnevnike \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-sr/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-sr/strings.xml index a538ece7e9..73920b6fb5 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-sr/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-sr/strings.xml @@ -7,4 +7,5 @@ Није инсталирано Верзија: %d Ради + Сачувај Дневнике \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-te/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-te/strings.xml index e67f631f87..f609542692 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-te/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-te/strings.xml @@ -17,4 +17,5 @@ వెర్షన్: %d సూపర్‌యూజర్‌లు: %d మాడ్యూల్స్: %d + లాగ్‌లు సేవ్ చేయండి \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-th/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-th/strings.xml index 598cf4011d..50bb145e5b 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-th/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-th/strings.xml @@ -130,4 +130,5 @@ ถอนการติดตั้งชั่วคราว การถอนการติดตั้ง KernelSU (การรูทและโมดูลทั้งหมด) อย่างสมบูรณ์โดยถาวร คืนค่าโรงงานอิมเมจดั้งเดิม (หากมีข้อมูลสำรอง) ส่วนใหญ่มักใช้ก่อนทำการ OTA ซึ่งหากคุณต้องการถอนการติดตั้ง KernelSU โปรดใช้ \"ถอนการติดตั้งถาวร\" + บันทึกบันทึก \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-tr/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-tr/strings.xml index 47f7e0028a..ed0bcd0f0d 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-tr/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-tr/strings.xml @@ -132,4 +132,5 @@ Seçili lkm: %s Flaşlanıyor Flaşlama başarısız + Günlükleri Kaydet \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-uk/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-uk/strings.xml index f1a1ea11e5..919ac133c7 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-uk/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-uk/strings.xml @@ -131,4 +131,5 @@ Обрано lkm: %s Видалити KernelSU (Root і всі модулі) повністю і назавжди. Відновити стоковий заводський образ (якщо є резервна копія), зазвичай використовується перед OTA; якщо вам потрібно видалити KernelSU, використовуйте \"Назавжди видалити\". + Зберегти Журнали \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-vi/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-vi/strings.xml index 7cf1490299..04d878381f 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-vi/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-vi/strings.xml @@ -131,4 +131,5 @@ Nên sử dụng hình ảnh phân vùng %1$s Giảm thiểu hình ảnh thưa thớt Thay đổi kích thước hình ảnh thưa nơi đặt mô-đun theo kích thước thực tế của nó. Lưu ý điều này có thể khiến module hoạt động không bình thường nên vui lòng chỉ sử dụng khi cần thiết (chẳng hạn như để sao lưu) + Lưu Nhật Ký \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rCN/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rCN/strings.xml index ba93a10fa8..e854fb60bc 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rCN/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rCN/strings.xml @@ -128,4 +128,5 @@ 刷写完成 刷写失败 选择的 LKM :%s + 保存日志 \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rHK/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rHK/strings.xml index d92ff99cab..154ddac9bb 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rHK/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rHK/strings.xml @@ -120,4 +120,5 @@ 最小化稀疏影像 將模組所在的稀疏影像調整為實際大小。 請注意,這可能會導致模組工作異常,因此請僅在必要時使用(例如備份) 解除安裝 + 保存日志 \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rTW/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rTW/strings.xml index eb1a7f1861..7917ddef99 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rTW/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values-zh-rTW/strings.xml @@ -130,4 +130,5 @@ 恢復原廠映像(如果有備份),通常在OTA之前使用;如果需要解除安裝KernelSU,請使用「永久解除安裝」。 寫入失敗 選擇的 LKM :%s + 儲存日誌 \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/app/src/main/res/values/strings.xml b/kernel-5.10/KernelSU/manager/app/src/main/res/values/strings.xml index 7202b4e22c..baa152154b 100644 --- a/kernel-5.10/KernelSU/manager/app/src/main/res/values/strings.xml +++ b/kernel-5.10/KernelSU/manager/app/src/main/res/values/strings.xml @@ -35,18 +35,18 @@ Reboot to EDL About Are you sure you want to uninstall module %s? - %s is uninstalled + %s uninstalled Failed to uninstall: %s Version Author - overlayfs is not available, module cannot work! + Modules are unavailable as OverlayFS is disabled by the kernel. Refresh Show system apps Hide system apps - Report Log + Send logs Safe mode Reboot to take effect - Modules are disabled because it is conflict with Magisk\'s! + Modules are unavailable due to a conflict with Magisk! Learn KernelSU https://kernelsu.org/guide/what-is-kernelsu.html Learn how to install KernelSU and use modules @@ -69,36 +69,36 @@ Failed to update App Profile for %s The current KernelSU version %d is too low for the manager to function properly. Please upgrade to version %d or higher! Umount modules by default - The global default value for \"Umount modules\" in App Profiles. If enabled, it will remove all module modifications to the system for applications that do not have a Profile set. - Enabling this option will allow KernelSU to restore any modified files by the modules for this application. + The global default value for \"Umount modules\" in App Profile. If enabled, it will remove all module modifications to the system for apps that don\'t have a Profile set. + Enabling this option will allow KernelSU to restore any modified files by the modules for this app. Domain Rules Update Downloading module: %s Start downloading: %s - New version: %s is available, click to upgrade + New version %s is available, click to upgrade. Launch - Force Stop + Force stop Restart Failed to update SELinux rules for: %s Changelog App Profile Template Manage local and online template of App Profile - Create Template - Edit Template + Create template + Edit template id Invalid template id Name Description Save Delete - View Template + View template readonly template id already exists! Import/Export Import from clipboard Export to clipboard - Can not find local template to export! + Cannot find local template to export! Imported successfully Sync online templates Failed to save template @@ -110,24 +110,25 @@ Open Enable WebView Debugging Can be used to debug WebUI, please enable only when needed. - Direct Install (Recommended) - Select a File - Install to Inactive Slot (After OTA) + Direct install (Recommended) + Select a file + Install to inactive slot (After OTA) Your device will be **FORCED** to boot to the current inactive slot after a reboot!\nOnly use this option after OTA is done.\nContinue? Next %1$s partition image is recommended Select KMI Minimize sparse image - Resize the sparse image where the module is located to its actual size. Note that this may cause the module to work abnormally, so please only use when necessary (such as for backup) + Resize the sparse image where the module is located to its actual size. Note that this may cause the module to work abnormally, so please only use when necessary (such as for backup). Uninstall - Uninstall Temporarily - Uninstall Permanently - Restore Stock Image + Uninstall temporarily + Uninstall permanently + Restore stock image Temporarily uninstall KernelSU, restore to original state after next reboot. - Uninstalling KernelSU(Root and all modules) completely and permanently. - Restore the stock factory image (if a backup exists), usually used before OTA; if you need to uninstall KernelSU, please use \"Permanent Uninstall\". + Uninstalling KernelSU (Root and all modules) completely and permanently. + Restore the stock factory image (If a backup exists), usually used before OTA; if you need to uninstall KernelSU, please use \"Uninstall permanently\". Flashing Flash success Flash failed - Selected lkm: %s - \ No newline at end of file + Selected LKM: %s + Save logs + diff --git a/kernel-5.10/KernelSU/manager/build.gradle.kts b/kernel-5.10/KernelSU/manager/build.gradle.kts index d2c372b36c..0e503df3b6 100644 --- a/kernel-5.10/KernelSU/manager/build.gradle.kts +++ b/kernel-5.10/KernelSU/manager/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.agp.app) apply false alias(libs.plugins.agp.lib) apply false alias(libs.plugins.kotlin) apply false + alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.lsplugin.cmaker) } diff --git a/kernel-5.10/KernelSU/manager/gradle/libs.versions.toml b/kernel-5.10/KernelSU/manager/gradle/libs.versions.toml index 5fdfaa0147..2fdaa05eb7 100644 --- a/kernel-5.10/KernelSU/manager/gradle/libs.versions.toml +++ b/kernel-5.10/KernelSU/manager/gradle/libs.versions.toml @@ -1,14 +1,13 @@ [versions] -agp = "8.4.0" -kotlin = "1.9.23" -ksp = "1.9.23-1.0.20" -compose-compiler = "1.5.11" -compose-bom = "2024.05.00" -lifecycle = "2.7.0" +agp = "8.5.0" +kotlin = "2.0.0" +ksp = "2.0.0-1.0.22" +compose-bom = "2024.06.00" +lifecycle = "2.8.1" accompanist = "0.34.0" navigation = "2.7.7" activity-compose = "1.9.0" -kotlinx-coroutines = "1.8.0" +kotlinx-coroutines = "1.8.1" coil-compose = "2.6.0" compose-destination = "1.10.2" sheets-compose-dialogs = "1.3.0" @@ -25,6 +24,7 @@ agp-app = { id = "com.android.application", version.ref = "agp" } agp-lib = { id = "com.android.library", version.ref = "agp" } kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } @@ -75,4 +75,4 @@ sheet-compose-dialogs-core = { group = "com.maxkeppeler.sheets-compose-dialogs", sheet-compose-dialogs-list = { group = "com.maxkeppeler.sheets-compose-dialogs", name = "list", version.ref = "sheets-compose-dialogs" } sheet-compose-dialogs-input = { group = "com.maxkeppeler.sheets-compose-dialogs", name = "input", version.ref = "sheets-compose-dialogs" } -markdown = { group = "io.noties.markwon", name = "core", version.ref = "markdown" } +markdown = { group = "io.noties.markwon", name = "core", version.ref = "markdown" } \ No newline at end of file diff --git a/kernel-5.10/KernelSU/manager/gradlew b/kernel-5.10/KernelSU/manager/gradlew index 1aa94a4269..4b6a9cfc46 100755 --- a/kernel-5.10/KernelSU/manager/gradlew +++ b/kernel-5.10/KernelSU/manager/gradlew @@ -1,5 +1,4 @@ #!/bin/sh - # # Copyright © 2015-2021 the original authors. # diff --git a/kernel-5.10/KernelSU/userspace/ksud/Cargo.lock b/kernel-5.10/KernelSU/userspace/ksud/Cargo.lock index d3ddd289da..03d049b39b 100644 --- a/kernel-5.10/KernelSU/userspace/ksud/Cargo.lock +++ b/kernel-5.10/KernelSU/userspace/ksud/Cargo.lock @@ -84,47 +84,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys", @@ -132,9 +133,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -153,14 +154,14 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -245,12 +246,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.92" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -291,9 +293,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -301,9 +303,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -313,14 +315,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] @@ -331,9 +333,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "const_format" @@ -378,9 +380,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if 1.0.0", ] @@ -400,9 +402,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -437,9 +439,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -474,7 +476,7 @@ checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] @@ -485,7 +487,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] @@ -507,14 +509,14 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] name = "either" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "encoding_rs" @@ -573,9 +575,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys", @@ -604,9 +606,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -639,9 +641,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if 1.0.0", "libc", @@ -797,6 +799,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itoa" version = "1.0.11" @@ -816,9 +824,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -877,7 +885,7 @@ dependencies = [ "sha256", "tempdir", "which", - "zip 1.2.1", + "zip 2.1.3", "zip-extensions", ] @@ -889,9 +897,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libflate" @@ -921,9 +929,15 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] name = "log" @@ -964,9 +978,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -989,34 +1003,13 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] -[[package]] -name = "num_enum" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "object" version = "0.32.2" @@ -1079,15 +1072,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit", -] - [[package]] name = "proc-macro-hack" version = "0.5.20+deprecated" @@ -1096,9 +1080,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" dependencies = [ "unicode-ident", ] @@ -1115,7 +1099,7 @@ dependencies = [ "hex", "lazy_static", "procfs-core", - "rustix 0.38.32", + "rustix 0.38.34", ] [[package]] @@ -1227,9 +1211,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -1280,9 +1264,9 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" [[package]] name = "rust-embed" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" +checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" dependencies = [ "include-flate", "rust-embed-impl", @@ -1292,22 +1276,22 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" +checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.58", + "syn 2.0.65", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" +checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" dependencies = [ "sha2", "walkdir", @@ -1315,9 +1299,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" @@ -1325,7 +1309,7 @@ version = "0.38.30" source = "git+https://github.com/Kernel-SU/rustix.git?branch=main#0e270bce2d97466be6b987bb5f7ea5b1e8d84969" dependencies = [ "bitflags 2.5.0", - "errno 0.3.8", + "errno 0.3.9", "itoa", "libc", "linux-raw-sys", @@ -1335,12 +1319,12 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", - "errno 0.3.8", + "errno 0.3.9", "libc", "linux-raw-sys", "windows-sys", @@ -1348,9 +1332,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -1363,29 +1347,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1427,6 +1411,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "strsim" version = "0.11.1" @@ -1452,9 +1442,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" dependencies = [ "proc-macro2", "quote", @@ -1473,22 +1463,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", ] [[package]] @@ -1521,23 +1511,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - [[package]] name = "typenum" version = "1.17.0" @@ -1552,9 +1525,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "unicode-xid" @@ -1611,7 +1584,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", "wasm-bindgen-shared", ] @@ -1633,7 +1606,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.65", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1652,7 +1625,7 @@ checksum = "8211e4f58a2b2805adfbefbc07bab82958fc91e3836339b1ab7ae32465dce0d7" dependencies = [ "either", "home", - "rustix 0.38.32", + "rustix 0.38.34", "winsafe", ] @@ -1674,11 +1647,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -1707,13 +1680,14 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -1722,54 +1696,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winsafe" @@ -1799,9 +1770,9 @@ dependencies = [ [[package]] name = "zip" -version = "1.2.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006d078b7b6fc587bb25e022ad39e7086f44e5c4fef6076964ea601533241beb" +checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" dependencies = [ "arbitrary", "bzip2", @@ -1811,21 +1782,36 @@ dependencies = [ "displaydoc", "flate2", "indexmap", - "num_enum", + "memchr", "thiserror", "time", + "zopfli", "zstd 0.13.1", ] [[package]] name = "zip-extensions" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecf62554c4ff96bce01a7ef123d160c3ffe9180638820f8b4d545c65b221b8c" +checksum = "c865b4f0f43f22d1bd7ba05479b5c003e0e98e9090c3a2e4280b5eace59f62df" dependencies = [ "zip 0.6.6", ] +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] + [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/kernel-5.10/KernelSU/userspace/ksud/Cargo.toml b/kernel-5.10/KernelSU/userspace/ksud/Cargo.toml index 51bc29789a..b5486adaa8 100644 --- a/kernel-5.10/KernelSU/userspace/ksud/Cargo.toml +++ b/kernel-5.10/KernelSU/userspace/ksud/Cargo.toml @@ -10,14 +10,14 @@ rust-version = "1.77.2" anyhow = "1" clap = { version = "4", features = ["derive"] } const_format = "0.2" -zip = { version = "1.2", features = [ +zip = { version = "2", features = [ "deflate", "deflate64", "bzip2", "time", "zstd", ], default-features = false } -zip-extensions = "0.6" +zip-extensions = "0.7" java-properties = "2" log = "0.4" env_logger = { version = "0.11", default-features = false } @@ -60,4 +60,4 @@ android_logger = "0.13" [profile.release] strip = true opt-level = "z" -lto = true +lto = true \ No newline at end of file diff --git a/kernel-5.10/KernelSU/userspace/ksud/bin/aarch64/resetprop b/kernel-5.10/KernelSU/userspace/ksud/bin/aarch64/resetprop index 571363e3e2..1155e5f49a 100644 Binary files a/kernel-5.10/KernelSU/userspace/ksud/bin/aarch64/resetprop and b/kernel-5.10/KernelSU/userspace/ksud/bin/aarch64/resetprop differ diff --git a/kernel-5.10/KernelSU/userspace/ksud/bin/x86_64/resetprop b/kernel-5.10/KernelSU/userspace/ksud/bin/x86_64/resetprop index 07b216e73b..dc4d9910e9 100644 Binary files a/kernel-5.10/KernelSU/userspace/ksud/bin/x86_64/resetprop and b/kernel-5.10/KernelSU/userspace/ksud/bin/x86_64/resetprop differ diff --git a/kernel-5.10/KernelSU/userspace/ksud/src/boot_patch.rs b/kernel-5.10/KernelSU/userspace/ksud/src/boot_patch.rs index b518de09e8..c2661c68fc 100644 --- a/kernel-5.10/KernelSU/userspace/ksud/src/boot_patch.rs +++ b/kernel-5.10/KernelSU/userspace/ksud/src/boot_patch.rs @@ -159,7 +159,11 @@ pub fn restore( let workdir = tmpdir.path(); let magiskboot = find_magiskboot(magiskboot_path, workdir)?; - let (bootimage, bootdevice) = find_boot_image(&image, false, false, workdir)?; + let kmi = get_current_kmi().unwrap_or_else(|_| String::from("")); + + let skip_init = kmi.starts_with("android12-"); + + let (bootimage, bootdevice) = find_boot_image(&image, skip_init, false, false, workdir)?; println!("- Unpacking boot image"); let status = Command::new(&magiskboot) @@ -309,7 +313,16 @@ fn do_patch( let tmpdir = tempdir::TempDir::new("KernelSU").context("create temp dir failed")?; let workdir = tmpdir.path(); - let (bootimage, bootdevice) = find_boot_image(&image, ota, is_replace_kernel, workdir)?; + let kmi = if let Some(kmi) = kmi { + kmi + } else { + get_current_kmi().context("Unknown KMI, please choose LKM manually")? + }; + + let skip_init = kmi.starts_with("android12-"); + + let (bootimage, bootdevice) = + find_boot_image(&image, skip_init, ota, is_replace_kernel, workdir)?; let bootimage = bootimage.display().to_string(); @@ -330,11 +343,6 @@ fn do_patch( std::fs::copy(kmod, kmod_file).context("copy kernel module failed")?; } else { // If kmod is not specified, extract from assets - let kmi = if let Some(kmi) = kmi { - kmi - } else { - get_current_kmi().context("Unknown KMI, please choose LKM manually")? - }; println!("- KMI: {kmi}"); let name = format!("{kmi}_kernelsu.ko"); assets::copy_assets_to_file(&name, kmod_file) @@ -537,6 +545,7 @@ fn find_magiskboot(magiskboot_path: Option, workdir: &Path) -> Result

, + skip_init: bool, ota: bool, is_replace_kernel: bool, workdir: &Path, @@ -547,6 +556,10 @@ fn find_boot_image( ensure!(image.exists(), "boot image not found"); bootimage = std::fs::canonicalize(image)?; } else { + if cfg!(not(target_os = "android")) { + println!("- Current OS is not android, refusing auto bootimage/bootdevice detection"); + bail!("please specify a boot image"); + } let mut slot_suffix = utils::getprop("ro.boot.slot_suffix").unwrap_or_else(|| String::from("")); @@ -560,7 +573,7 @@ fn find_boot_image( let init_boot_exist = Path::new(&format!("/dev/block/by-name/init_boot{slot_suffix}")).exists(); - let boot_partition = if !is_replace_kernel && init_boot_exist { + let boot_partition = if !is_replace_kernel && init_boot_exist && !skip_init { format!("/dev/block/by-name/init_boot{slot_suffix}") } else { format!("/dev/block/by-name/boot{slot_suffix}") diff --git a/kernel-5.10/KernelSU/userspace/ksud/src/utils.rs b/kernel-5.10/KernelSU/userspace/ksud/src/utils.rs index 5abd6a4bfc..9bacfa3664 100644 --- a/kernel-5.10/KernelSU/userspace/ksud/src/utils.rs +++ b/kernel-5.10/KernelSU/userspace/ksud/src/utils.rs @@ -1,12 +1,13 @@ use anyhow::{bail, Context, Error, Ok, Result}; use std::{ - fs::{create_dir_all, remove_file, write, File, OpenOptions}, + fs::{self, create_dir_all, remove_file, write, File, OpenOptions}, io::{ ErrorKind::{AlreadyExists, NotFound}, Write, }, path::Path, process::Command, + sync::OnceLock, }; use crate::{assets, boot_patch, defs, ksucalls, module, restorecon}; @@ -188,14 +189,66 @@ pub fn has_magisk() -> bool { which::which("magisk").is_ok() } +fn is_ok_empty(dir: &str) -> bool { + use std::result::Result::Ok; + + match fs::read_dir(dir) { + Ok(mut entries) => entries.next().is_none(), + Err(_) => false, + } +} + +fn find_temp_path() -> String { + use std::result::Result::Ok; + + if is_ok_empty(defs::TEMP_DIR) { + return defs::TEMP_DIR.to_string(); + } + + // Try to create a random directory in /dev/ + let r = tempdir::TempDir::new_in("/dev/", ""); + match r { + Ok(tmp_dir) => { + if let Some(path) = tmp_dir.into_path().to_str() { + return path.to_string(); + } + } + Err(_e) => {} + } + + let dirs = [ + defs::TEMP_DIR, + "/patch_hw", + "/oem", + "/root", + defs::TEMP_DIR_LEGACY, + ]; + + // find empty directory + for dir in dirs { + if is_ok_empty(dir) { + return dir.to_string(); + } + } + + // Fallback to non-empty directory + for dir in dirs { + if metadata(dir).is_ok() { + return dir.to_string(); + } + } + + "".to_string() +} + pub fn get_tmp_path() -> &'static str { - if metadata(defs::TEMP_DIR_LEGACY).is_ok() { - return defs::TEMP_DIR_LEGACY; - } - if metadata(defs::TEMP_DIR).is_ok() { - return defs::TEMP_DIR; - } - "" + static CHOSEN_TMP_PATH: OnceLock = OnceLock::new(); + + CHOSEN_TMP_PATH.get_or_init(|| { + let r = find_temp_path(); + log::info!("Chosen temp_path: {}", r); + r + }) } #[cfg(target_os = "android")] @@ -233,8 +286,11 @@ pub fn uninstall(magiskboot_path: Option) -> Result<()> { module::prune_modules()?; } println!("- Removing directories.."); - std::fs::remove_dir_all(defs::WORKING_DIR)?; - std::fs::remove_file(defs::DAEMON_PATH)?; + std::fs::remove_dir_all(defs::WORKING_DIR).ok(); + std::fs::remove_file(defs::DAEMON_PATH).ok(); + crate::mount::umount_dir(defs::MODULE_DIR).ok(); + std::fs::remove_dir_all(defs::MODULE_DIR).ok(); + std::fs::remove_dir_all(defs::MODULE_UPDATE_TMP_DIR).ok(); println!("- Restore boot image.."); boot_patch::restore(None, magiskboot_path, true)?; println!("- Uninstall KernelSU manager.."); diff --git a/kernel-5.10/KernelSU/website/docs/guide/app-profile.md b/kernel-5.10/KernelSU/website/docs/guide/app-profile.md index ba90e282ff..888acb49af 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/app-profile.md +++ b/kernel-5.10/KernelSU/website/docs/guide/app-profile.md @@ -4,7 +4,7 @@ The App Profile is a mechanism provided by KernelSU for customizing the configur For applications granted root permissions (i.e., able to use `su`), the App Profile can also be referred to as the Root Profile. It allows customization of the `uid`, `gid`, `groups`, `capabilities`, and `SELinux` rules of the `su` command, thereby restricting the privileges of the root user. For example, it can grant network permissions only to firewall applications while denying file access permissions, or it can grant shell permissions instead of full root access for freeze applications: **keeping the power confined with the principle of least privilege.** -For ordinary applications without root permissions, the App Profile can control the behavior of the kernel and module system towards these applications. For instance, it can determine whether modifications resulting from modules should be addressed. The kernel and module system can make decisions based on this configuration, such as performing operations akin to "hiding" +For ordinary applications without root permissions, the App Profile can control the behavior of the kernel and module system towards these applications. For instance, it can determine whether modifications resulting from modules should be addressed. The kernel and module system can make decisions based on this configuration, such as performing operations akin to "hiding". ## Root Profile diff --git a/kernel-5.10/KernelSU/website/docs/guide/difference-with-magisk.md b/kernel-5.10/KernelSU/website/docs/guide/difference-with-magisk.md index 3892cfe116..be71543b08 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/difference-with-magisk.md +++ b/kernel-5.10/KernelSU/website/docs/guide/difference-with-magisk.md @@ -4,14 +4,14 @@ Although there are many similarities between KernelSU modules and Magisk modules ## Similarities -- Module file format: both use zip format to organize modules, and the format of modules is almost the same -- Module installation directory: both located in `/data/adb/modules` -- Systemless: both support modifying /system in a systemless way through modules -- post-fs-data.sh: the execution time and semantics are exactly the same -- service.sh: the execution time and semantics are exactly the same -- system.prop: completely the same -- sepolicy.rule: completely the same -- BusyBox: scripts are run in BusyBox with "standalone mode" enabled in both cases +- Module file format: both use zip format to organize modules, and the format of modules is almost the same. +- Module installation directory: both located in `/data/adb/modules`. +- Systemless: both support modifying /system in a systemless way through modules. +- post-fs-data.sh: the execution time and semantics are exactly the same. +- service.sh: the execution time and semantics are exactly the same. +- system.prop: completely the same. +- sepolicy.rule: completely the same. +- BusyBox: scripts are run in BusyBox with "standalone mode" enabled in both cases. ## Differences @@ -20,9 +20,9 @@ Before understanding the differences, you need to know how to differentiate whet Here are some differences: - KernelSU modules cannot be installed in Recovery mode. -- KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext). +- KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)). - The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU does not support the `.replace` method. Instead, you need to create a same-named file with `mknod filename c 0 0` to delete the corresponding file. - The directories for BusyBox are different. The built-in BusyBox in KernelSU is located in `/data/adb/ksu/bin/busybox`, while in Magisk it is in `/data/adb/magisk/busybox`. **Note that this is an internal behavior of KernelSU and may change in the future!** - KernelSU does not support `.replace` files; however, KernelSU supports the `REMOVE` and `REPLACE` variable to remove or replace files and folders. - KernelSU adds `boot-completed` stage to run some scripts on boot completed. -- KernelSU adds `post-mount` stage to run some scripts after mounting overlayfs +- KernelSU adds `post-mount` stage to run some scripts after mounting overlayfs. diff --git a/kernel-5.10/KernelSU/website/docs/guide/faq.md b/kernel-5.10/KernelSU/website/docs/guide/faq.md index 0fc7de1aff..76981c23fd 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/faq.md +++ b/kernel-5.10/KernelSU/website/docs/guide/faq.md @@ -12,11 +12,11 @@ Certainly, yes. ## Does KernelSU support modules? -Yes, check [Module Page](module.md) please. +Yes, check [Module Guide](module.md) please. ## Does KernelSU support Xposed? -Yes, you can use LSPosed on [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) +Yes, you can use LSPosed on [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext). ## Does KernelSU support Zygisk? @@ -26,7 +26,7 @@ KernelSU has no builtin Zygisk support, but you can use [ZygiskNext](https://git KernelSU's module system is conflict with Magisk's magic mount, if there is any module enabled in KernelSU, then the whole Magisk would not work. -But if you only use the `su` of KernelSU, then it will work well with Magisk: KernelSU modify the `kernel` and Magisk modify the `ramdisk`, they can work together. +But if you only use the `su` of KernelSU, then it will work well with Magisk: with KernelSU modifying the `kernel` and Magisk modifying the `ramdisk`, both of them can work together simultaneously. ## Will KernelSU substitute Magisk? @@ -38,18 +38,18 @@ It is possible. But you should download the kernel source and intergrate KernelS ## Can KernelSU support devices below Android 12? -It is device's kernel that affect KernelSU's compatability and it has nothing to do with Android version.The only restriction is that devices launched with Android 12 must be kernel 5.10+(GKI devices). So: +It is device's kernel that affect KernelSU's compatability and it has nothing to do with Android version. The only restriction is that devices launched with Android 12 must be kernel of a 5.10+ version (GKI devices). So: 1. Devices launched with Android 12 must be supported. -2. Devices which have an old kernel (Some Android 12 devices is also old kernel) are compatible (You should build kernel yourself) +2. Devices which have an old kernel (Some Android 12 devices is also old kernel) are compatible (You should build kernel yourself). ## Can KernelSU support old kernel? -It is possible, KernelSU is backported to kernel 4.14 now, for older kernel, you need to backport it manully and PRs welcome! +It is possible, KernelSU is backported to kernel 4.14 now; for older kernel, you need to backport it manually and PRs welcome! -## How to integrate KernelSU for old kernel? +## How to integrate KernelSU for an older kernel? -Please refer [Guide](how-to-integrate-for-non-gki) +Please refer to the following [Guide](how-to-integrate-for-non-gki). ## Why my Android version is 13, and the kernel shows "android12-5.10"? @@ -59,17 +59,17 @@ The Kernel version has nothing to do with Android version, if you need to flash GKI1 is completely different from GKI2, you must compile kernel by yourself. -## How can i make `/system` RW? +## How can I make `/system` RW? We do not recommend you to modify the system partition directly. You should use the [module](module.md) to modify it systemlessly. If you insist on doing this, check [magisk_overlayfs](https://github.com/HuskyDG/magic_overlayfs). -## Can KernelSU modify hosts? How can i use AdAway? +## Can KernelSU modify hosts? How can I use AdAway? -Of course. But KernelSU doesn't have builtin hosts support, you can install [systemless-hosts](https://github.com/symbuzzer/systemless-hosts-KernelSU-module) to do it. +Of course. But KernelSU doesn't have built-in hosts support, you can install [systemless-hosts](https://github.com/symbuzzer/systemless-hosts-KernelSU-module) to do it. ## Why is there a huge 1 TB file? -The 1 TB size `modules.img` is a disk image file, **don't worry about its size**, it's a special type of file known as a [sparse file](https://en.wikipedia.org/wiki/Sparse_file), its actual size is only the size of the module you use, and it will dynamically shrink after you delete the module; it does not actually occupy 1 TB of disk space (actually your mobile phone may not have that much space). +The 1 TB size `modules.img` is a disk image file, **don't worry about its size**, it's a special type of file known as a [sparse file](https://en.wikipedia.org/wiki/Sparse_file), it's actual size is only the size of the module you use, and it will dynamically shrink after you delete the module; it does not actually occupy 1 TB of disk space (your mobile phone may not actually have that much space). If you're really unhappy with the size of this file, you can use the `resize2fs -M` command to make it the actual size; but the module may not work properly at this time, and we won't provide any support for this. diff --git a/kernel-5.10/KernelSU/website/docs/guide/hidden-features.md b/kernel-5.10/KernelSU/website/docs/guide/hidden-features.md index edeb1b9d84..af365f620e 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/hidden-features.md +++ b/kernel-5.10/KernelSU/website/docs/guide/hidden-features.md @@ -4,4 +4,4 @@ By default, `/system/bin/sh` loads `/system/etc/mkshrc`. -You can make su load customized rc file by creating a `/data/adb/ksu/.ksurc` file. \ No newline at end of file +You can make su load customized rc file by creating a `/data/adb/ksu/.ksurc` file. diff --git a/kernel-5.10/KernelSU/website/docs/guide/how-to-build.md b/kernel-5.10/KernelSU/website/docs/guide/how-to-build.md index c822db3bb0..88b6c54cb4 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/how-to-build.md +++ b/kernel-5.10/KernelSU/website/docs/guide/how-to-build.md @@ -6,7 +6,7 @@ First, you should read the Android Official docs for kernel build: 2. [GKI Release Builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds) ::: warning -This page is for GKI devices, if you use an old kernel, please refer [how to integrate KernelSU for old kernel](how-to-integrate-for-non-gki) +This page is for GKI devices, if you use an old kernel, please refer [How to integrate KernelSU for non-GKI kernels](how-to-integrate-for-non-gki). ::: ## Build Kernel @@ -20,19 +20,19 @@ repo init -m manifest.xml repo sync ``` -The `` is a manifest file which can determine a build uniquely, you can use the manifest to do a re-preducable build. You should download the manifest file from [Google GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds) +The `` is a manifest file which can determine a build uniquely, you can use the manifest to do a re-preducable build. You should download the manifest file from [Google GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds). ### Build Please check the [official docs](https://source.android.com/docs/setup/build/building-kernels) first. -For example, we need to build aarch64 kernel image: +For example, to build an aarch64 kernel image: ```sh LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh ``` -Don't forget to add the `LTO=thin` flag, otherwise the build may fail if your computer's memory is less then 24Gb. +Don't forget to add the `LTO=thin` flag, otherwise the build may fail if your computer's memory is less then 24 GB. Starting from Android 13, the kernel is built by `bazel`: @@ -41,7 +41,7 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist ``` :::info -For some Android 14 Kernel, to make Wi-Fi/Bluetooth work. It may be necessary to remove all the GKI protected exports: +For some of the Android 14 kernels, to make Wi-Fi/Bluetooth work, it might be necessary to remove all the GKI protected exports: ```sh rm common/android/abi_gki_protected_exports_* @@ -50,7 +50,7 @@ rm common/android/abi_gki_protected_exports_* ## Build Kernel with KernelSU -If you can build the kernel successfully, then build KernelSU is so easy, Select any one run in Kernel source root dir: +If you're able to build the kernel successfully, then adding KernelSU support to it is relatively easy. In the root of kernel source directory, run any of the command options listed below: ::: code-group diff --git a/kernel-5.10/KernelSU/website/docs/guide/how-to-integrate-for-non-gki.md b/kernel-5.10/KernelSU/website/docs/guide/how-to-integrate-for-non-gki.md index 69e3320938..e4521cf031 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/how-to-integrate-for-non-gki.md +++ b/kernel-5.10/KernelSU/website/docs/guide/how-to-integrate-for-non-gki.md @@ -1,8 +1,8 @@ -# How to integrate KernelSU for non GKI kernels? +# How to integrate KernelSU for non-GKI kernels? -KernelSU can be integrated into non GKI kernels, and was backported to 4.14 and below. +KernelSU can be integrated into non-GKI kernels, and was backported to 4.14 and below. -Due to the fragmentization of non GKI kernels, we do not have a uniform way to build it, so we can not provide non GKI boot images. But you can build the kernel yourself with KernelSU integrated. +Due to the fragmentization of non-GKI kernels, we do not have a universal way to build it, so we cannot provide non-GKI boot images. But you can build the kernel yourself with KernelSU integrated. First, you should be able to build a bootable kernel from kernel source code. If the kernel is not open source, then it is difficult to run KernelSU for your device. @@ -18,22 +18,26 @@ KernelSU uses kprobe to do kernel hooks, if the *kprobe* runs well in your kerne First, add KernelSU to your kernel source tree: ```sh -curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash - +curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.9.5 ``` +:::info +[KernelSU 1.0 and later versions no longer support non-GKI kernels](https://github.com/tiann/KernelSU/issues/1705). The last supported version is `v0.9.5`, please make sure to use the correct version. +::: + Then, you should check if *kprobe* is enabled in your kernel config, if it is not, please add these configs to it: -``` +```txt CONFIG_KPROBES=y CONFIG_HAVE_KPROBES=y CONFIG_KPROBE_EVENTS=y ``` -And build your kernel again, KernelSU should works well. +And now when you re-build your kernel, KernelSU should work well. -If you find that KPROBES is still not activated, you can try enabling `CONFIG_MODULES`. (If it still doesn't take effect, use `make menuconfig` to search for other dependencies of KPROBES) +If you find that KPROBES is still not activated, you can try enabling `CONFIG_MODULES`. If it still doesn't take effect, use `make menuconfig` to search for other dependencies of KPROBES. -But if you encounter a boot loop when integrated KernelSU, it is maybe *kprobe is broken in your kernel*, you should fix the kprobe bug or use the second way. +But if you encounter a boot loop when integrated KernelSU, it might be because *kprobe is broken in your kernel*, which means that you should fix the kprobe bug or use another way. :::tip How to check if kprobe is broken? @@ -47,7 +51,7 @@ If your kernel is older than 5.9, you should backport `path_umount` to `fs/names ## Manually modify the kernel source -If kprobe does not work in your kernel (may be an upstream or kernel bug below 4.8), then you can try this way: +If kprobe does not work in your kernel (may be an upstream or kernel bug below 4.8), then you can try the following: First, add KernelSU to your kernel source tree: @@ -67,14 +71,14 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh ::: -Keep in mind that on some devices, your defconfig may be in `arch/arm64/configs` or in other cases `arch/arm64/configs/vendor/your_defconfig`. For example in your defconfig, Enable `CONFIG_KSU` with y to enable, or n to disable. Your path will be something like: -`arch/arm64/configs/...` -``` +Keep in mind that on some devices, your defconfig may be in `arch/arm64/configs` or in other cases `arch/arm64/configs/vendor/your_defconfig`. For whichever defconfig you're using, make sure to enable `CONFIG_KSU` with `y` to enable or `n` to disable it. For example, in case you chose to enable it, you defconfig should contain the following string: + +```txt # KernelSU CONFIG_KSU=y ``` -Then, add KernelSU calls to the kernel source, here are some patches to refer: +Then, add KernelSU calls to the kernel source, here are some patches for reference: ::: code-group @@ -200,12 +204,12 @@ index 376543199b5a..82adcef03ecc 100644 You should find the four functions in kernel source: -1. do_faccessat, usually in `fs/open.c` -2. do_execveat_common, usually in `fs/exec.c` -3. vfs_read, usually in `fs/read_write.c` -4. vfs_statx, usually in `fs/stat.c` +1. `do_faccessat`, usually in `fs/open.c` +2. `do_execveat_common`, usually in `fs/exec.c` +3. `vfs_read`, usually in `fs/read_write.c` +4. `vfs_statx`, usually in `fs/stat.c` -If your kernel does not have the `vfs_statx`, use `vfs_fstatat` instead: +If your kernel does not have the `vfs_statx` function, use `vfs_fstatat` instead: ```diff diff --git a/fs/stat.c b/fs/stat.c @@ -266,10 +270,10 @@ index 2ff887661237..e758d7db7663 100644 ### Safe Mode -To enable KernelSU's builtin SafeMode, You should also modify `input_handle_event` in `drivers/input/input.c`: +To enable KernelSU's built-in SafeMode, you should additionally modify `input_handle_event` function in `drivers/input/input.c`: :::tip -It is strongly recommended to enable this feature, it is very helpful to prevent bootloops! +It is strongly recommended to enable this feature, it is very helpful in preventing bootloops! ::: ```diff @@ -299,7 +303,7 @@ index 45306f9ef247..815091ebfca4 100755 add_input_randomness(type, code, value); ``` -:::info Entering safe mode accidiently? +:::info Entering safe mode accidentally? If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`! ::: @@ -316,7 +320,9 @@ index 32f6f1c68..d69d8eca2 100644 return dentry; } ++#ifdef CONFIG_KSU +extern int ksu_handle_devpts(struct inode*); ++#endif + /** * devpts_get_priv -- get private data for a slave @@ -325,7 +331,9 @@ index 32f6f1c68..d69d8eca2 100644 */ void *devpts_get_priv(struct dentry *dentry) { ++ #ifdef CONFIG_KSU + ksu_handle_devpts(dentry->d_inode); ++ #endif if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC) return NULL; return dentry->d_fsdata; diff --git a/kernel-5.10/KernelSU/website/docs/guide/installation.md b/kernel-5.10/KernelSU/website/docs/guide/installation.md index 8e6904a9b2..714704eb44 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/installation.md +++ b/kernel-5.10/KernelSU/website/docs/guide/installation.md @@ -4,7 +4,7 @@ Download KernelSU manager APP from [GitHub Releases](https://github.com/tiann/KernelSU/releases) and install it to your device: -- If the app shows `Unsupported`, it means **You should compile the kernel yourself**, KernelSU won't and never provide a boot image for you to flash. +- If the app shows `Unsupported`, it means **you should compile the kernel yourself**, KernelSU won't and never provide a boot image for you to flash. - If the app shows `Not installed`, then your devices is officially supported by KernelSU. :::info @@ -45,15 +45,15 @@ Note that the SubLevel in the kernel version is not part of the KMI! That means ### Security patch level {#security-patch-level} -Newer Android devices may have anti-rollback mechanisms in place that do not allow flashing a boot image with an old security patch level. For example, if your device kernel is `5.10.101-android12-9-g30979850fc20`, its security patch is `2023-11`; even if you flash the kernel consistent with the kernel KMI, if the security patch level is older than `2023- 11`(such as `2023-06`), then it may cause bootloop. +Newer Android devices may have anti-rollback mechanisms in place that do not allow flashing a boot image with an old security patch level. For example, if your device kernel is `5.10.101-android12-9-g30979850fc20`, it's security patch level is `2023-11`; even if you flash the kernel corresponding to the KMI, if the security patch level is older than `2023- 11` (such as `2023-06`), then it may cause bootloop. -Therefore, kernels with latest security patch levels are preferred while maintaining KMI consistency. +Therefore, kernels with latest security patch levels are preferred for maintaining the correspondence with KMI. -### Kernel version vs. Android version +### Kernel version vs Android version Please note: **Kernel version and Android version are not necessarily the same!** -If you find that your kernel version is `android12-5.10.101`, but your Android system version is Android 13 or other; please don't be surprised, because the version number of the Android system is not necessarily the same as the version number of the Linux kernel; The version number of the Linux kernel is generally consistent with the version of the Android system that comes with the **device when it is shipped**. If the Android system is upgraded later, the kernel version will generally not change. If you need to flash, **please always refer to the kernel version!!** +If you find that your kernel version is `android12-5.10.101`, but your Android system version is Android 13 or other, please don't be surprised, because the version number of the Android system is not necessarily the same as the version number of the Linux kernel. The version number of the Linux kernel is generally correspondent to the version of the Android system that comes with the **device when it is shipped**. If the Android system is upgraded later, the kernel version will generally not change. So before flashing anything, **please always refer to the kernel version!** ## Introduction @@ -62,23 +62,23 @@ Since version `0.9.0`, KernelSU supports two running modes on GKI devices: 1. `GKI`: Replace the original kernel of the device with the **Generic Kernel Image** (GKI) provided by KernelSU. 2. `LKM`: Load the **Loadable Kernel Module** (LKM) into the device kernel without replacing the original kernel. -These two modes are suitable for different scenarios, and you can choose according to your needs. +These two modes are suitable for different scenarios, and you can choose the one according to your needs. -### GKI Mode {#gki-mode} +### GKI mode {#gki-mode} In GKI mode, the original kernel of the device will be replaced with the generic kernel image provided by KernelSU. The advantages of GKI mode are: -1. Strong universality, suitable for most devices; for example, Samsung has enabled KNOX devices, and LKM mode cannot operate. There are also some niche modified devices that can only use GKI mode; -2. Can be used without relying on official firmware; no need to wait for official firmware updates, as long as the KMI is consistent, it can be used; +1. Strong universality, suitable for most devices; for example, Samsung has enabled KNOX devices, and LKM mode cannot operate. There are also some niche modified devices that can only use GKI mode. +2. Can be used without relying on official firmware; no need to wait for official firmware updates, as long as the KMI is consistent, it can be used. -### LKM Mode {#lkm-mode} +### LKM mode {#lkm-mode} In LKM mode, the original kernel of the device will not be replaced, but the loadable kernel module will be loaded into the device kernel. The advantages of LKM mode are: -1. Will not replace the original kernel of the device; if you have special requirements for the original kernel of the device, or you want to use KernelSU while using a third-party kernel, you can use LKM mode; -2. It is more convenient to upgrade and OTA; when upgrading KernelSU, you can directly install it in the manager without manually flashing; after the system OTA, you can directly install it to the second slot without manually flashing; -3. Suitable for some special scenarios; for example, LKM can also be loaded with temporary ROOT permissions. Since it does not need to replace the boot partition, it will not trigger avb and will not cause the device to be bricked; -4. LKM can be temporarily uninstalled; if you want to temporarily cancel root, you can uninstall LKM, this process does not require flashing partitions, or even rebooting the device; if you want to root again, just reboot the device; +1. Will not replace the original kernel of the device; if you have special requirements for the original kernel of the device, or you want to use KernelSU while using a third-party kernel, you can use LKM mode. +2. It is more convenient to upgrade and OTA; when upgrading KernelSU, you can directly install it in the manager without flashing manually; after the system OTA, you can directly install it to the second slot without manual flashing. +3. Suitable for some special scenarios; for example, LKM can also be loaded with temporary ROOT permissions. Since it does not need to replace the boot partition, it will not trigger avb and will not cause the device to be bricked. +4. LKM can be temporarily uninstalled; if you want to temporarily disable root access, you can uninstall LKM, this process does not require flashing partitions, or even rebooting the device; if you want to enable root again, just reboot the device. :::tip Coexistence of two modes After opening the manager, you can see the current mode of the device on the homepage; note that the priority of GKI mode is higher than that of LKM. For example, if you use GKI kernel to replace the original kernel, and use LKM to patch the GKI kernel, then LKM will be ignored, and the device will always run in GKI mode. @@ -88,7 +88,7 @@ After opening the manager, you can see the current mode of the device on the hom If your device is a mobile phone, we recommend that you prioritize LKM mode; if your device is an emulator, WSA, or Waydroid, we recommend that you prioritize GKI mode. -## LKM Installation +## LKM installation ### Get the official firmware @@ -98,15 +98,15 @@ There are many ways to get the official firmware. If your device supports `fastb If your device does not support `fastboot boot`, then you may need to manually download the official firmware package and then extract the boot from it. -Unlike GKI mode, LKM mode will modify the `ramdisk`, so on devices with Android 13, it needs to patch the `init_boot` partition instead of the `boot` partition; while GKI mode always operates the `boot` partition. +Unlike GKI mode, LKM mode will modify the `ramdisk`, so on devices with Android 13, it needs to patch the `init_boot` partition instead of the `boot` partition; meanwhile, GKI mode always operates the `boot` partition. ### Use the manager Open the manager, click the installation icon in the upper right corner, and several options will appear: -1. Select and patch a file; if your phone does not have root permissions, you can choose this option, and then select your official firmware, and the manager will automatically patch it; you only need to flash this patched file to permanently obtain root permissions; -2. Install directly; if your phone is already rooted, you can choose this option, the manager will automatically get your device information, and then automatically patch the official firmware, and then flash it; you can consider using `fastboot boot` KernelSU's GKI kernel to get temporary root and install the manager, and then use this option; this is also the main way to upgrade KernelSU; -3. Install to another partition; if your device supports A/B partition, you can choose this option, the manager will automatically patch the official firmware, and then install it to another partition; this method is suitable for devices after OTA, you can directly install it to another partition after OTA, and then restart the device; +1. Select and patch a file; if your phone does not have root permissions, you can choose this option, and then select your official firmware, the manager will automatically patch it; you only need to flash this patched file to permanently obtain root permissions. +2. Install directly; if your phone is already rooted, you can choose this option, the manager will automatically get your device information, and then automatically patch the official firmware, and then flash it; you can consider using `fastboot boot` KernelSU's GKI kernel to get temporary root and install the manager, and then use this option; this is also the main way to upgrade KernelSU. +3. Install to another partition; if your device supports A/B partition, you can choose this option, the manager will automatically patch the official firmware, and then install it to another partition; this method is suitable for devices after OTA, you can directly install it to another partition after OTA, and then restart the device. ### Use the command line @@ -114,7 +114,7 @@ If you don’t want to use the manager, you can also use the command line to ins This tool supports macOS, Linux, and Windows. You can download the corresponding version from [GitHub Release](https://github.com/tiann/KernelSU/releases). -Usage: `ksud boot-patch` You can check the command line help for specific usage. +Usage: `ksud boot-patch`. You can check the command line help for specific options. ```sh oriole:/ # ksud boot-patch -h @@ -137,8 +137,8 @@ Options: A few options that need to be explained: -1. The `--magiskboot` option can specify the path of magiskboot. If it is not specified, ksud will look for it in the environment variables; if you don’t know how to get magiskboot, you can check [here](#patch-boot-image); -2. The `--kmi` option can specify the `KMI` version. If the kernel name of your device does not follow the KMI specification, you can specify it through this option; +1. The `--magiskboot` option can specify the path of magiskboot. If it is not specified, ksud will look for it in the environment variables; if you don’t know how to get magiskboot, you can refer to [this](#patch-boot-image). +2. The `--kmi` option can specify the `KMI` version. If the kernel name of your device does not follow the KMI specification, you can specify it through this option. The most common usage is: @@ -146,14 +146,14 @@ The most common usage is: ksud boot-patch -b --kmi android13-5.10 ``` -## GKI mode Installation +## GKI mode installation -There are several installation methods for GKI mode, each suitable for a different scenario, so please choose as needed. +There are several installation methods for GKI mode, each suitable for a different scenario, so please choose accordingly: -1. Install with fastboot using the boot.img provided by KernelSU -2. Install with a kernel flash app, such as KernelFlasher -3. Repair the boot.img manually and install it -4. Install with custom Recovery (e.g. TWRP) +1. Install with fastboot using the boot.img provided by KernelSU. +2. Install with a kernel flash app, such as KernelFlasher. +3. Repair the boot.img manually and install it. +4. Install with custom Recovery (e.g., TWRP). ## Install with boot.img provided by KernelSU @@ -161,19 +161,19 @@ If your device's `boot.img` uses a commonly used compression format, you can use ### Find proper boot.img -KernelSU provides a generic boot.img for GKI devices and you should flash the boot.img to the boot partition of the device. +KernelSU provides a generic boot.img for GKI devices, and you should flash the boot.img to the boot partition of the device. -You can download boot.img from [GitHub Release](https://github.com/tiann/KernelSU/releases), please note that you should use the correct version of boot.img. If you don't know which file to download, please carefully read the description of [KMI](#kmi) and [Security Patch Level](#security-patch-level) in this document. +You can download boot.img from [GitHub Release](https://github.com/tiann/KernelSU/releases), please note that you should use the correct version of boot.img. If you don't know which file to download, please carefully read the description of [KMI](#kmi) and [Security patch level](#security-patch-level) in this document. Normally, there are three boot files in different formats under the same KMI and security patch level. They are all the same except for the kernel compression format. Please check the kernel compression format of your original boot.img. You should use the correct format, such as `lz4`, `gz`; if you use an incorrect compression format, you may encounter bootloop after flashing boot. :::info Compression format of boot.img -1. You can use magiskboot to get the compression format of your original boot; of course you can also ask other, more experienced kids with the same model as your device. Also, the compression format of the kernel usually does not change, so if you boot successfully with a certain compression format, you can try that format later. +1. You can use magiskboot to get the compression format of your original boot; alternatively, you can also ask for it from community members/developers with the same model as your device. Also, the compression format of the kernel usually does not change, so if you boot successfully with a certain compression format, you can try that format later as well. 2. Xiaomi devices usually use `gz` or **uncompressed**. -3. For Pixel devices, follow below instructions. +3. For Pixel devices, follow the instructions below. ::: -### flash boot.img to device +### Flash boot.img to device Use `adb` to connect your device, then execute `adb reboot bootloader` to enter fastboot mode, then use this command to flash KernelSU: @@ -185,9 +185,9 @@ fastboot flash boot boot.img If your device supports `fastboot boot`, you can first use `fastboot boot boot.img` to try to use boot.img to boot the system first. If something unexpected happens, restart it again to boot. ::: -### reboot +### Reboot -After flashing is complete, you should reboot your device: +After the flashing process is complete, you should reboot your device: ```sh fastboot reboot @@ -195,84 +195,86 @@ fastboot reboot ## Install with Kernel Flasher -Step: +Steps: 1. Download the AnyKernel3 zip. If you don't know which file to download, please carefully read the description of [KMI](#kmi) and [Security Patch Level](#security-patch-level) in this document. 2. Open the Kernel Flash App (grant necessary root permissions) and use the provided AnyKernel3 zip to flash. This way requires the kernel flash App to have root permissions. You can use the following methods to achieve this: -1. Your device has rooted. For example, you have installed KernelSU and want to upgrade to the latest version, or you have rooted through other methods (such as Magisk). -2. If your phone is not rooted, but the phone supports the temporary boot method of `fastboot boot boot.img`, you can use the GKI image provided by KernelSU to temporarily boot your device, obtain temporary root permissions, and then use the kernel flash Flash the writer to obtain permanent root privileges. +1. Your device is rooted. For example, you have installed KernelSU and want to upgrade to the latest version, or you have rooted through other methods (such as Magisk). +2. If your device is not rooted, but the phone supports the temporary boot method of `fastboot boot boot.img`, you can use the GKI image provided by KernelSU to temporarily boot your device, obtain temporary root permissions, and then use the Kernel Flash App to obtain permanent root privileges. + +Some of kernel flashing apps that can be used for this: 1. [Kernel Flasher](https://github.com/capntrips/KernelFlasher/releases) 2. [Franco Kernel Manager](https://play.google.com/store/apps/details?id=com.franco.kernel) 3. [Ex Kernel Manager](https://play.google.com/store/apps/details?id=flar2.exkernelmanager) -PS. This method is more convenient when upgrading KernelSU and can be done without a computer (backup first!). . +P.S. This method is more convenient when upgrading KernelSU and can be done without a computer (make a backup first!). -## Patch boot.img manually{#patch-boot-image} +## Patch boot.img manually {#patch-boot-image} -For some devices, the boot.img format is not so common, such as not `lz4`, `gz` and uncompressed; the most typical is Pixel, its boot.img format is `lz4_legacy` compressed, ramdisk may be `gz` may also be `lz4_legacy` compression; at this time, if you directly flash the boot.img provided by KernelSU, the phone may not be able to boot; at this time, you can manually patch the boot.img to achieve. +For some devices, the boot.img format is not so common, such as not `lz4`, `gz` and uncompressed; the most typical example is a Pixel, it's boot.img format is `lz4_legacy` compressed, ramdisk may be `gz` may also be `lz4_legacy` compression; currently, if you directly flash the boot.img provided by KernelSU, the phone may not be able to boot; as an alternative, and you can manually patch the boot.img to achieve this. It's always recommended to use `magiskboot` to patch images, there are two ways: 1. [magiskboot](https://github.com/topjohnwu/Magisk/releases) 2. [magiskboot_build](https://github.com/ookiineko/magiskboot_build/releases/tag/last-ci) -The official build of `magiskboot` can only run on Android devices, if you want to run it on PC, you can try the second one. +The official build of `magiskboot` can only run on Android devices, if you want to run it on PC, you can try the second option. ::: tip -Android-Image-Kitchen is not recommended now, because it doesn't handle the boot metadata(such as security patch level) correctly, thus it may not work on some devices. +Android-Image-Kitchen is not recommended for now, as it doesn't handle the boot metadata (such as security patch level) correctly, thus it may not work on some devices. ::: ### Preparation -1. Get your phone's stock boot.img; you can get it from your device manufacturers, you may need [payload-dumper-go](https://github.com/ssut/payload-dumper-go) +1. Get your phone's stock boot.img; you can get it from your device manufacturers, you may need [payload-dumper-go](https://github.com/ssut/payload-dumper-go). 2. Download the AnyKernel3 zip file provided by KernelSU that matches the KMI version of your device (you can refer to the *Install with custom Recovery*). 3. Unpack the AnyKernel3 package and get the `Image` file, which is the kernel file of KernelSU. ### Using magiskboot on Android devices {#using-magiskboot-on-Android-devices} -1. Download latest Magisk from [Release Page](https://github.com/topjohnwu/Magisk/releases) +1. Download latest Magisk from [Release Page](https://github.com/topjohnwu/Magisk/releases). 2. Rename `Magisk-*(version).apk` to `Magisk-*.zip` and unzip it. 3. Push `Magisk-*/lib/arm64-v8a/libmagiskboot.so` to your device by adb: `adb push Magisk-*/lib/arm64-v8a/libmagiskboot.so /data/local/tmp/magiskboot` 4. Push stock boot.img and Image in AnyKernel3 to your device. -5. Enter adb shell and cd `/data/local/tmp/` directory, then `chmod +x magiskboot` -6. Enter adb shell and cd `/data/local/tmp/` directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel. -7. Replace `kernel` with `Image`: `mv -f Image kernel` -8. Execute `./magiskboot repack boot.img` to repack boot img, and you will get a `new-boot.img` file, flash this file to device by fastboot. +5. Enter adb shell and run `cd /data/local/tmp/` directory, then `chmod +x magiskboot` +6. Enter adb shell and run `cd /data/local/tmp/` directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel. +7. Replace `kernel` with `Image` by running the command: `mv -f Image kernel`. +8. Execute `./magiskboot repack boot.img` to repack boot image, and you will get a `new-boot.img` file, flash this file to device by fastboot. ### Using magiskboot on Windows/macOS/Linux PC{#using-magiskboot-on-PC} -1. Download proper `magiskboot` for your OS from [magiskboot_build](https://github.com/ookiineko/magiskboot_build/releases/tag/last-ci) +1. Download the corresponding `magiskboot` binary for your OS from [magiskboot_build](https://github.com/ookiineko/magiskboot_build/releases/tag/last-ci). 2. Prepare stock boot.img and Image in your PC. -3. `chmod +x magiskboot` -4. Enter the proper directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel. -5. Replace `kernel` with `Image`: `mv -f Image kernel` -6. Execute `./magiskboot repack boot.img` to repack boot img, and you will get a `new-boot.img` file, flash this file to device by fastboot. +3. Run `chmod +x magiskboot`. +4. Enter the corresponding directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel. +5. Replace `kernel` with `Image` by running the command: `mv -f Image kernel`. +6. Execute `./magiskboot repack boot.img` to repack the boot image, and you will get a `new-boot.img` file, flash this file to device by fastboot. ::: info -Official `magiskboot` can run `Linux` device normally, if you are a Linux user, you can use official build. +Official `magiskboot` can run in Linux environments normally, if you are a Linux user, you can use the official build. ::: -## Install with custom Recovery +## Install with Custom Recovery -Prerequisite: Your device must have a custom Recovery, such as TWRP; if not or only official Recovery is available, use another method. +Prerequisite: Your device must have a Custom Recovery, such as TWRP; if there is no custom recovery available for your device, use another method. -Step: +Steps: -1. From the [Release page](https://github.com/tiann/KernelSU/releases) of KernelSU, download the zip package starting with AnyKernel3 that matches your phone version; for example, the phone kernel version is `android12-5.10. 66`, then you should download the file `AnyKernel3-android12-5.10.66_yyyy-MM.zip` (where `yyyy` is the year and `MM` is the month). -2. Reboot the phone into TWRP. -3. Use adb to put AnyKernel3-*.zip into the phone /sdcard and choose to install it in the TWRP GUI; or you can directly `adb sideload AnyKernel-*.zip` to install. +1. From the [Release page](https://github.com/tiann/KernelSU/releases) of KernelSU, download the zip package starting with `AnyKernel3` that matches your phone version; for example, if the device's kernel version is `android12-5.10. 66`, then you should download the `AnyKernel3-android12-5.10.66_yyyy-MM.zip` file (where `yyyy` is the year and `MM` is the month). +2. Reboot the device into TWRP. +3. Use adb to place AnyKernel3-*.zip into the device's `/sdcard` location and choose to install it in the TWRP GUI; or you can directly run `adb sideload AnyKernel-*.zip` to install. -PS. This method is suitable for any installation (not limited to initial installation or subsequent upgrades), as long as you use TWRP. +P.S. This method is suitable for any installation (not limited to initial installation or subsequent upgrades), as long as you're using TWRP. ## Other methods -In fact, all these installation methods have only one main idea, which is to **replace the original kernel for the one provided by KernelSU**; as long as this can be achieved, it can be installed; for example, the following are other possible methods. +In fact, all of these installation methods have only one main idea, which is to **replace the original kernel for the one provided by KernelSU**; as long as this can be achieved, it can be installed; for example, the following are other possible methods. -1. First install Magisk, get root privileges through Magisk and then use the kernel flasher to flash in the AnyKernel zip from KernelSU. -2. Use some flashing toolkit on PCs to flash in the kernel provided KernelSU. +1. First install Magisk, get root privileges through Magisk and then use the kernel flasher to flash in the AnyKernel3 zip from KernelSU. +2. Use any flashing toolkit on PC to flash the kernel provided by KernelSU. -But if it doesn't work, please try `magiskboot` way. +However, if it doesn't work, please try `magiskboot` approach. diff --git a/kernel-5.10/KernelSU/website/docs/guide/module-webui.md b/kernel-5.10/KernelSU/website/docs/guide/module-webui.md index 52b04c7911..4afa5ddbd7 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/module-webui.md +++ b/kernel-5.10/KernelSU/website/docs/guide/module-webui.md @@ -24,7 +24,7 @@ If your page contains CSS and JavaScript, you need to place it in this directory ## JavaScript API -If it is just a display page, it is no different from a normal web page. More importantly, KernelSU provides a series of system API that allow you to implement the unique functions of the module. +If it is just a display page, it is no different from a normal web page. More importantly, KernelSU provides a series of system API that allows you to implement the unique functions of the module. KernelSU provides a JavaScript library and [publishes it on npm](https://www.npmjs.com/package/kernelsu), which you can use in the JavaScript code of your web pages. @@ -38,11 +38,11 @@ const { errno, stdout } = exec("getprop ro.product.model"); For another example, you can make the web page display full screen, or display a toast. -[API documentation](https://www.npmjs.com/package/kernelsu) +[API documentation](https://www.npmjs.com/package/kernelsu). If you find that the existing API does not meet your needs or is inconvenient to use, you are welcome to give us suggestions [here](https://github.com/tiann/KernelSU/issues)! ## Some tips -1. You can use `localStorage` normally to store some data, but it will be lost after the Manager App is uninstalled. If you need to save persistently, you can write data to some directory yourself. -2. For simple pages, I recommend you use [parceljs](https://parceljs.org/) for packaging. It requires zero configuration and is very convenient to use. However, if you are a front-end master or have your own preferences, then just choose one you like! +1. You can use `localStorage` normally to store some data, but it will be lost after the Manager App is uninstalled. If you need to save persistently, you can write data to a custom directory yourself. +2. For simple pages, I recommend you use [parceljs](https://parceljs.org/) for packaging. It requires zero configuration and is very convenient to use. However, if you are a front-end master or have your own preferences, then just choose the one you like! diff --git a/kernel-5.10/KernelSU/website/docs/guide/module.md b/kernel-5.10/KernelSU/website/docs/guide/module.md index 0749687d79..9625d16382 100644 --- a/kernel-5.10/KernelSU/website/docs/guide/module.md +++ b/kernel-5.10/KernelSU/website/docs/guide/module.md @@ -1,4 +1,4 @@ -# Module guides +# Module Guide KernelSU provides a module mechanism that achieves the effect of modifying the system directory while maintaining the integrity of the system partition. This mechanism is commonly known as "systemless". @@ -6,22 +6,22 @@ The module mechanism of KernelSU is almost the same as that of Magisk. If you ar ## WebUI -KernelSU's modules support displaying interfaces and interacting with users, please refer to the [WebUI documentation](module-webui.md). +KernelSU's modules support displaying interfaces and interacting with users. For more, please refer to [WebUI documentation](module-webui.md). ## Busybox -KernelSU ships with a feature complete BusyBox binary (including full SELinux support). The executable is located at `/data/adb/ksu/bin/busybox`. KernelSU's BusyBox supports runtime toggle-able "ASH Standalone Shell Mode". What this standalone mode means is that when running in the `ash` shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as `PATH`. For example, commands like `ls`, `rm`, `chmod` will **NOT** use what is in `PATH` (in the case of Android by default it will be `/system/bin/ls`, `/system/bin/rm`, and `/system/bin/chmod` respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command _not_ to use BusyBox, you have to call the executable with full paths. +KernelSU ships with a feature-complete BusyBox binary (including full SELinux support). The executable is located at `/data/adb/ksu/bin/busybox`. KernelSU's BusyBox supports runtime toggle-able "ASH Standalone Shell Mode". What this standalone mode means is that when running in the `ash` shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as `PATH`. For example, commands like `ls`, `rm`, `chmod` will **NOT** use what is in `PATH` (in the case of Android by default it will be `/system/bin/ls`, `/system/bin/rm`, and `/system/bin/chmod` respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command _not_ to use BusyBox, you have to call the executable with full paths. Every single shell script running in the context of KernelSU will be executed in BusyBox's `ash` shell with standalone mode enabled. For what is relevant to 3rd party developers, this includes all boot scripts and module installation scripts. For those who want to use this "Standalone Mode" feature outside of KernelSU, there are 2 ways to enable it: -1. Set environment variable `ASH_STANDALONE` to `1`
Example: `ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh