You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
kernel: susfs: CONFIG_KSU_SUSFS_INFO syscall to get susfs version & variant
This commit is contained in:
@@ -154,6 +154,13 @@ config KSU_SUSFS_SUS_SU
|
|||||||
- Only apps with root access granted by ksu manager are allowed to get root.
|
- Only apps with root access granted by ksu manager are allowed to get root.
|
||||||
- Also overlayfs is required.
|
- Also overlayfs is required.
|
||||||
|
|
||||||
|
config KSU_SUSFS_INFO
|
||||||
|
bool "Enable meta-data of susfs"
|
||||||
|
depends on KSU_SUSFS
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
- Allow parsing meta-data of susfs version info.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
@@ -196,6 +196,9 @@ endif
|
|||||||
ifdef KSU_SUSFS_SUS_SU
|
ifdef KSU_SUSFS_SUS_SU
|
||||||
ccflags-y += -DKSU_SUSFS_SUS_SU
|
ccflags-y += -DKSU_SUSFS_SUS_SU
|
||||||
endif
|
endif
|
||||||
|
ifdef KSU_SUSFS_INFO
|
||||||
|
ccflags-y += -DKSU_SUSFS_INFO
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
$(info -- You have not integrate susfs in your kernel.)
|
$(info -- You have not integrate susfs in your kernel.)
|
||||||
$(info -- Read: https://gitlab.com/simonpunk/susfs4ksu)
|
$(info -- Read: https://gitlab.com/simonpunk/susfs4ksu)
|
||||||
|
|||||||
@@ -590,6 +590,49 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif //#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
#endif //#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
||||||
|
#ifdef CONFIG_KSU_SUSFS_INFO
|
||||||
|
if (arg2 == CMD_SUSFS_SHOW_VERSION) {
|
||||||
|
const char *version = SUSFS_VERSION;
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg3, version, strlen(version) + 1)) {
|
||||||
|
pr_info("susfs: copy_to_user() failed\n");
|
||||||
|
error = -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg5, version, strlen(version) + 1)) {
|
||||||
|
pr_info("susfs: copy_to_user() failed\n");
|
||||||
|
error = -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg5 + strlen(version) + 1, &error, sizeof(error))) {
|
||||||
|
pr_info("susfs: copy_to_user() failed (error status)\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg2 == CMD_SUSFS_SHOW_VARIANT) {
|
||||||
|
const char *variant = SUSFS_VARIANT;
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg3, variant, strlen(variant) + 1)) {
|
||||||
|
pr_info("susfs: copy_to_user() failed\n");
|
||||||
|
error = -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg5, variant, strlen(variant) + 1)) {
|
||||||
|
pr_info("susfs: copy_to_user() failed\n");
|
||||||
|
error = -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_user((void __user*)arg5 + strlen(variant) + 1, &error, sizeof(error))) {
|
||||||
|
pr_info("susfs: copy_to_user() failed (error status)\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif //#ifdef CONFIG_KSU_SUSFS_INFO
|
||||||
}
|
}
|
||||||
#endif //#ifdef CONFIG_KSU_SUSFS
|
#endif //#ifdef CONFIG_KSU_SUSFS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user