Skip to content

Commit

Permalink
kernel: unregister sysfs for module's ext4 image
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Feb 17, 2025
1 parent 38dc2eb commit de29115
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ int ksu_handle_rename(struct dentry *old_dentry, struct dentry *new_dentry)
return 0;
}

static void nuke_ext4_sysfs() {
struct path path;
int err = kern_path("/data/adb/modules", 0, &path);
if (err) {
pr_err("nuke path err: %d\n", err);
return;
}

struct super_block* sb = path.dentry->d_inode->i_sb;
const char* name = sb->s_type->name;
if (strcmp(name, "ext4") != 0) {
pr_info("nuke but module aren't mounted\n");
return;
}

ext4_unregister_sysfs(sb);
}

int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5)
{
Expand Down Expand Up @@ -318,6 +336,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
case EVENT_MODULE_MOUNTED: {
ksu_module_mounted = true;
pr_info("module mounted!\n");
nuke_ext4_sysfs();
break;
}
default:
Expand Down

0 comments on commit de29115

Please sign in to comment.