From 1498789fe8f8896d4f5770e19b52023937dd7ba3 Mon Sep 17 00:00:00 2001 From: Huy Minh <39849246+hmtheboy154@users.noreply.github.com> Date: Sat, 7 Sep 2024 09:59:06 +0700 Subject: [PATCH] kernel: Relax dentry_path_raw compare in core_hook (#2041) On Android-x86 (or BlissOS) it initialize Android by using switch_root or chroot, when checking a path with dentry_path_raw() it will show the whole real path instead of the path that we want. Relax the checking requirement by using strstr to look for "/system/packages.list" in the string instead of requiring the path to be "/system/packages.list" This fixes #1783 Signed-off-by: hmtheboy154 --- kernel/core_hook.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index 429ba3306ea3..009216efa454 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -197,7 +198,7 @@ int ksu_handle_rename(struct dentry *old_dentry, struct dentry *new_dentry) return 0; } - if (strcmp(buf, "/system/packages.list")) { + if (!strstr(buf, "/system/packages.list")) { return 0; } pr_info("renameat: %s -> %s, new path: %s\n", old_dentry->d_iname,