You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
kernel: throne_tracker: resolve s_magic for < 3.9
throne_tracker, cross-fs avoidance: f_inode is f_path.dentry->d_inode so file->f_inode->i_sb->s_magic is file->f_path.dentry->d_inode->i_sb->s_magic Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
This commit is contained in:
@@ -249,6 +249,13 @@ bool is_lock_held(const char *path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compat: https://elixir.bootlin.com/linux/v3.9/source/include/linux/fs.h#L771
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
|
||||||
|
#define S_MAGIC_COMPAT(x) ((x)->f_inode->i_sb->s_magic)
|
||||||
|
#else
|
||||||
|
#define S_MAGIC_COMPAT(x) ((x)->f_path.dentry->d_inode->i_sb->s_magic)
|
||||||
|
#endif
|
||||||
|
|
||||||
void search_manager(const char *path, int depth, struct list_head *uid_data)
|
void search_manager(const char *path, int depth, struct list_head *uid_data)
|
||||||
{
|
{
|
||||||
int i, stop = 0;
|
int i, stop = 0;
|
||||||
@@ -293,8 +300,8 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
|
|||||||
|
|
||||||
// grab magic on first folder, which is /data/app
|
// grab magic on first folder, which is /data/app
|
||||||
if (!data_app_magic) {
|
if (!data_app_magic) {
|
||||||
if (file->f_inode->i_sb->s_magic) {
|
if (S_MAGIC_COMPAT(file)) {
|
||||||
data_app_magic = file->f_inode->i_sb->s_magic;
|
data_app_magic = S_MAGIC_COMPAT(file);
|
||||||
pr_info("%s: dir: %s got magic! 0x%lx\n", __func__, pos->dirpath, data_app_magic);
|
pr_info("%s: dir: %s got magic! 0x%lx\n", __func__, pos->dirpath, data_app_magic);
|
||||||
} else {
|
} else {
|
||||||
filp_close(file, NULL);
|
filp_close(file, NULL);
|
||||||
@@ -302,9 +309,9 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->f_inode->i_sb->s_magic != data_app_magic) {
|
if (S_MAGIC_COMPAT(file) != data_app_magic) {
|
||||||
pr_info("%s: skip: %s magic: 0x%lx expected: 0x%lx\n", __func__, pos->dirpath,
|
pr_info("%s: skip: %s magic: 0x%lx expected: 0x%lx\n", __func__, pos->dirpath,
|
||||||
file->f_inode->i_sb->s_magic, data_app_magic);
|
S_MAGIC_COMPAT(file), data_app_magic);
|
||||||
filp_close(file, NULL);
|
filp_close(file, NULL);
|
||||||
goto skip_iterate;
|
goto skip_iterate;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user