Skip to content

Commit

Permalink
kernel: Relax dentry_path_raw compare in core_hook (tiann#2041)
Browse files Browse the repository at this point in the history
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 tiann#1783

Signed-off-by: hmtheboy154 <[email protected]>
  • Loading branch information
hmtheboy154 authored and LeCmnGend committed Sep 29, 2024
1 parent 4152988 commit e3aadc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/sched.h>
#include <linux/security.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/uidgid.h>
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e3aadc3

Please sign in to comment.