From 5980c113fec9635a26ab8b19c9e682f7e28c89d8 Mon Sep 17 00:00:00 2001 From: weishu Date: Sun, 4 Jun 2023 00:03:49 +0800 Subject: [PATCH] kernel: respect the app profile's umount modules field for kernel umounting --- kernel/core_hook.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index c48e2d2f..c1d00afd 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -417,7 +417,12 @@ static bool should_umount(struct path *path) if (path->mnt && path->mnt->mnt_sb && path->mnt->mnt_sb->s_type) { const char *fstype = path->mnt->mnt_sb->s_type->name; - return strcmp(fstype, "overlay") == 0; + if (strcmp(fstype, "overlay") == 0) { + return ksu_is_uid_should_umount(current_uid().val); + } +#ifdef CONFIG_KSU_DEBUG + pr_info("uid: %d should not umount!\n") +#endif } return false; }