Skip to content

Commit dbe3881

Browse files
committed
optional: turn off mount monitor at boot complete
not sure if really needed. security_remove_hooks ?
1 parent 0da937c commit dbe3881

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

kernel/core_hook.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static bool ksu_module_mounted = false;
5050
extern int handle_sepolicy(unsigned long arg3, void __user *arg4);
5151

5252
static bool ksu_su_compat_enabled = true;
53+
static bool ksu_mount_monitor_enabled = true;
5354
extern void ksu_sucompat_init();
5455
extern void ksu_sucompat_exit();
5556

@@ -332,6 +333,9 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
332333
if (!boot_complete_lock) {
333334
boot_complete_lock = true;
334335
pr_info("boot_complete triggered\n");
336+
// turn off mount monitor
337+
pr_info("turning off ksu_mount_monitor\n");
338+
ksu_mount_monitor_enabled = false;
335339
}
336340
break;
337341
}
@@ -592,7 +596,10 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
592596

593597
int ksu_mount_monitor(const char *dev_name, const char *dirname, const char *type)
594598
{
595-
599+
if (!ksu_mount_monitor_enabled) {
600+
return 0;
601+
}
602+
596603
char *device_name_copy = kstrdup(dev_name, GFP_KERNEL);
597604
char *fstype_copy = kstrdup(type, GFP_KERNEL);
598605
char *dirname_copy = kstrdup(dirname, GFP_KERNEL);
@@ -704,6 +711,10 @@ static int ksu_task_fix_setuid(struct cred *new, const struct cred *old,
704711
static int ksu_sb_mount(const char *dev_name, const struct path *path,
705712
const char *type, unsigned long flags, void *data)
706713
{
714+
if (!ksu_mount_monitor_enabled) {
715+
return 0;
716+
}
717+
707718
char buf[256];
708719
char *dir_name = d_path(path, buf, sizeof(buf));
709720

0 commit comments

Comments
 (0)