forked from ShirkNeko/GKI_KernelSU_SUSFS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_ksun_susfs.patch
More file actions
82 lines (73 loc) · 2.62 KB
/
fix_ksun_susfs.patch
File metadata and controls
82 lines (73 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff --git a/kernel/core_hook.c b/kernel/core_hook.c
index a6b8b083..3f1d6d85 100644
--- a/kernel/core_hook.c
+++ b/kernel/core_hook.c
@@ -1105,27 +1105,32 @@ out_ksu_try_umount:
pr_info("handle umount for uid: %d, pid: %d\n", new_uid.val,
current->pid);
#endif
+
+#ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
+ // susfs come first, and lastly umount by ksu, make sure umount in reversed order
+ susfs_try_umount_all(new_uid.val);
+#else
// fixme: use `collect_mounts` and `iterate_mount` to iterate all mountpoint and
// filter the mountpoint whose target is `/data/adb`
- try_umount("/odm", true, 0);
- try_umount("/system", true, 0);
- try_umount("/system_ext", true, 0);
- try_umount("/vendor", true, 0);
- try_umount("/product", true, 0);
- try_umount("/data/adb/modules", false, MNT_DETACH);
+ ksu_try_umount("/odm", true, 0);
+ ksu_try_umount("/system", true, 0);
+ ksu_try_umount("/system_ext", true, 0);
+ ksu_try_umount("/vendor", true, 0);
+ ksu_try_umount("/product", true, 0);
+ ksu_try_umount("/data/adb/modules", false, MNT_DETACH);
// try umount ksu temp path
- try_umount("/debug_ramdisk", false, MNT_DETACH);
- try_umount("/sbin", false, MNT_DETACH);
+ ksu_try_umount("/debug_ramdisk", false, MNT_DETACH);
+ ksu_try_umount("/sbin", false, MNT_DETACH);
// try umount hosts file
- try_umount("/system/etc/hosts", false, MNT_DETACH);
+ ksu_try_umount("/system/etc/hosts", false, MNT_DETACH);
// try umount lsposed dex2oat bins
- try_umount("/apex/com.android.art/bin/dex2oat64", false, MNT_DETACH);
- try_umount("/apex/com.android.art/bin/dex2oat32", false, MNT_DETACH);
-
+ ksu_try_umount("/apex/com.android.art/bin/dex2oat64", false, MNT_DETACH);
+ ksu_try_umount("/apex/com.android.art/bin/dex2oat32", false, MNT_DETACH);
+#endif
return 0;
}
diff --git a/kernel/ksud.c b/kernel/ksud.c
index 816d066b..c41db884 100644
--- a/kernel/ksud.c
+++ b/kernel/ksud.c
@@ -64,6 +64,9 @@ bool ksu_vfs_read_hook __read_mostly = true;
bool ksu_execveat_hook __read_mostly = true;
bool ksu_input_hook __read_mostly = true;
+#ifdef CONFIG_KSU_SUSFS_SUS_SU
+bool susfs_is_sus_su_ready = false;
+#endif // #ifdef CONFIG_KSU_SUSFS_SUS_SU
u32 ksu_devpts_sid;
@@ -71,15 +74,15 @@ u32 ksu_devpts_sid;
bool ksu_is_compat __read_mostly = false;
#endif
-void on_post_fs_data(void)
+void ksu_on_post_fs_data(void)
{
static bool done = false;
if (done) {
- pr_info("on_post_fs_data already done\n");
+ pr_info("ksu_on_post_fs_data already done\n");
return;
}
done = true;
- pr_info("on_post_fs_data!\n");
+ pr_info("ksu_on_post_fs_data!\n");
ksu_load_allow_list();
// sanity check, this may influence the performance
stop_input_hook();