Deprecated ADD_TRY_UMOUNT in favor of official kernel_umount; Synced with the latest commit of official KernelSU main repo
- Since official KSU has exposed kernel_umount API and provided meta module for handling mount operations, susfs can finally handover try_umount and auto add_try_umount to KSU and its meta module
- Synced with upstream, see e1e58ed737
Co-authored-by: simonpunk <simonpunk2016@gmail.com>
This commit is contained in:
@@ -27,11 +27,7 @@
|
||||
|
||||
#include "sulog.h"
|
||||
|
||||
#ifndef CONFIG_KSU_SUSFS
|
||||
static bool ksu_kernel_umount_enabled = true;
|
||||
#else
|
||||
bool ksu_kernel_umount_enabled = true;
|
||||
#endif
|
||||
|
||||
static int kernel_umount_feature_get(u64 *value)
|
||||
{
|
||||
@@ -93,11 +89,7 @@ static void ksu_sys_umount(const char *mnt, int flags)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
||||
static void try_umount(const char *mnt, int flags)
|
||||
#else
|
||||
void try_umount(const char *mnt, int flags)
|
||||
#endif // #ifndef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
||||
{
|
||||
struct path path;
|
||||
int err = kern_path(mnt, 0, &path);
|
||||
@@ -115,7 +107,6 @@ void try_umount(const char *mnt, int flags)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(CONFIG_KSU_SUSFS) || !defined(CONFIG_KSU_SUSFS_TRY_UMOUNT)
|
||||
struct umount_tw {
|
||||
struct callback_head cb;
|
||||
const struct cred *old_cred;
|
||||
@@ -150,7 +141,6 @@ int ksu_handle_umount(uid_t old_uid, uid_t new_uid)
|
||||
{
|
||||
struct umount_tw *tw;
|
||||
|
||||
#if defined(CONFIG_KSU_SUSFS) || !defined(CONFIG_KSU_SUSFS_TRY_UMOUNT)
|
||||
// if there isn't any module mounted, just ignore it!
|
||||
if (!ksu_module_mounted) {
|
||||
return 0;
|
||||
@@ -160,6 +150,7 @@ int ksu_handle_umount(uid_t old_uid, uid_t new_uid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_KSU_SUSFS
|
||||
// There are 5 scenarios:
|
||||
// 1. Normal app: zygote -> appuid
|
||||
// 2. Isolated process forked from zygote: zygote -> isolated_process
|
||||
@@ -183,12 +174,14 @@ int ksu_handle_umount(uid_t old_uid, uid_t new_uid)
|
||||
pr_info("handle umount ignore non zygote child: %d\n", current->pid);
|
||||
return 0;
|
||||
}
|
||||
#endif // #ifndef CONFIG_KSU_SUSFS
|
||||
|
||||
// umount the target mnt
|
||||
pr_info("handle umount for uid: %d, pid: %d\n", new_uid, current->pid);
|
||||
|
||||
#if __SULOG_GATE
|
||||
ksu_sulog_report_syscall(new_uid, NULL, "setuid", NULL);
|
||||
#endif
|
||||
#endif // #if defined(CONFIG_KSU_SUSFS) || !defined(CONFIG_KSU_SUSFS_TRY_UMOUNT)
|
||||
// umount the target mnt
|
||||
pr_info("handle umount for uid: %d, pid: %d\n", new_uid, current->pid);
|
||||
|
||||
tw = kzalloc(sizeof(*tw), GFP_ATOMIC);
|
||||
if (!tw)
|
||||
@@ -208,7 +201,6 @@ int ksu_handle_umount(uid_t old_uid, uid_t new_uid)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // #if !defined(CONFIG_KSU_SUSFS) || !defined(CONFIG_KSU_SUSFS_TRY_UMOUNT)
|
||||
|
||||
void ksu_kernel_umount_init(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user