Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Commit 4f36db8

Browse files
sidex15simonpunk
authored andcommitted
1 parent 0df03ff commit 4f36db8

8 files changed

Lines changed: 188 additions & 51 deletions

File tree

fs/namei.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,9 +1688,6 @@ static struct dentry *__lookup_hash(const struct qstr *name,
16881688
if (susfs_is_base_dentry_android_data_dir(base) &&
16891689
susfs_is_sus_android_data_d_name_found(name->name))
16901690
{
1691-
if (flags & (LOOKUP_CREATE | LOOKUP_EXCL)) {
1692-
return ERR_PTR(-EACCES);
1693-
}
16941691
dentry = lookup_dcache(&susfs_fake_qstr_name, base, flags);
16951692
found_sus_path = true;
16961693
goto retry;
@@ -1712,6 +1709,7 @@ static struct dentry *__lookup_hash(const struct qstr *name,
17121709
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
17131710
{
17141711
if (!found_sus_path && !IS_ERR(dentry) && dentry->d_inode && susfs_is_inode_sus_path(dentry->d_inode)) {
1712+
dput(dentry);
17151713
dentry = lookup_dcache(&susfs_fake_qstr_name, base, flags);
17161714
found_sus_path = true;
17171715
goto retry;
@@ -1779,6 +1777,7 @@ static int lookup_fast(struct nameidata *nd,
17791777
dentry = __d_lookup_rcu(parent, &nd->last, &seq);
17801778
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
17811779
if (is_nd_state_lookup_last_and_open_last && dentry && !IS_ERR(dentry) && dentry->d_inode && parent->d_inode) {
1780+
dput(dentry);
17821781
if (susfs_is_inode_sus_path(dentry->d_inode)) {
17831782
dentry = __d_lookup_rcu(parent, &susfs_fake_qstr_name, &backup_next_seq);
17841783
}
@@ -1848,6 +1847,7 @@ static int lookup_fast(struct nameidata *nd,
18481847
dentry = __d_lookup(parent, &nd->last);
18491848
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
18501849
if (is_nd_state_lookup_last_and_open_last && dentry && !IS_ERR(dentry) && dentry->d_inode && parent->d_inode) {
1850+
dput(dentry);
18511851
if (susfs_is_inode_sus_path(dentry->d_inode)) {
18521852
dentry = __d_lookup(parent, &susfs_fake_qstr_name);
18531853
}
@@ -1948,6 +1948,7 @@ static struct dentry *lookup_slow(const struct qstr *name,
19481948
if (is_nd_flags_lookup_last && !found_sus_path) {
19491949
if (dentry && !IS_ERR(dentry) && dentry->d_inode) {
19501950
if (susfs_is_inode_sus_path(dentry->d_inode)) {
1951+
dput(dentry);
19511952
dentry = d_alloc_parallel(dir, &susfs_fake_qstr_name, &sus_wq);
19521953
found_sus_path = true;
19531954
goto retry;
@@ -3496,6 +3497,7 @@ static int lookup_open(struct nameidata *nd, struct path *path,
34963497
dentry = d_lookup(dir, &nd->last);
34973498
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
34983499
if (is_nd_state_open_last && dentry && !IS_ERR(dentry) && dentry->d_inode) {
3500+
dput(dentry);
34993501
if (susfs_is_inode_sus_path(dentry->d_inode)) {
35003502
dentry = d_lookup(dir, &susfs_fake_qstr_name);
35013503
found_sus_path = true;
@@ -3983,7 +3985,7 @@ struct file *do_filp_open(int dfd, struct filename *pathname,
39833985
if (unlikely(filp == ERR_PTR(-ESTALE)))
39843986
filp = path_openat(&nd, op, flags | LOOKUP_REVAL);
39853987
#ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT
3986-
if (!IS_ERR(filp) && unlikely(filp->f_inode->i_state & INODE_STATE_OPEN_REDIRECT) && current_uid().val < 11000) {
3988+
if (!IS_ERR(filp) && unlikely(filp->f_inode->i_mapping->flags & BIT_OPEN_REDIRECT) && current_uid().val < 11000) {
39873989
fake_pathname = susfs_get_redirected_path(filp->f_inode->i_ino);
39883990
if (!IS_ERR(fake_pathname)) {
39893991
restore_nameidata();

fs/notify/fdinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
102102
inode = igrab(mark->connector->inode);
103103
if (inode) {
104104
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
105-
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) &&
106-
unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) {
105+
if (likely(susfs_is_current_non_root_user_app_proc()) &&
106+
unlikely(inode->i_mapping->flags & BIT_SUS_KSTAT)) {
107107
struct path path;
108108
char *pathname = kmalloc(PAGE_SIZE, GFP_KERNEL);
109109
char *dpath;

fs/proc/fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int seq_show(struct seq_file *m, void *v)
6161

6262
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
6363
mnt = real_mount(file->f_path.mnt);
64-
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) &&
64+
if (likely(susfs_is_current_non_root_user_app_proc()) &&
6565
mnt->mnt_id >= DEFAULT_SUS_MNT_ID) {
6666
for (; mnt->mnt_id >= DEFAULT_SUS_MNT_ID; mnt = mnt->mnt_parent) { }
6767
}

fs/proc/task_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
640640
if (file) {
641641
struct inode *inode = file_inode(vma->vm_file);
642642
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
643-
if (unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) {
643+
if (unlikely(inode->i_mapping->flags & BIT_SUS_KSTAT)) {
644644
susfs_sus_ino_for_show_map_vma(inode->i_ino, &dev, &ino);
645645
goto bypass_orig_flow;
646646
}

fs/stat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *
4040
void generic_fillattr(struct inode *inode, struct kstat *stat)
4141
{
4242
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
43-
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) &&
44-
unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) {
43+
if (likely(susfs_is_current_non_root_user_app_proc()) &&
44+
unlikely(inode->i_mapping->flags & BIT_SUS_KSTAT)) {
4545
susfs_sus_ino_for_generic_fillattr(inode->i_ino, stat);
4646
stat->mode = inode->i_mode;
4747
stat->rdev = inode->i_rdev;

fs/statfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int vfs_statfs(const struct path *path, struct kstatfs *buf)
7878
struct mount *mnt;
7979

8080
mnt = real_mount(path->mnt);
81-
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
81+
if (likely(susfs_is_current_non_root_user_app_proc())) {
8282
for (; mnt->mnt_id >= DEFAULT_SUS_MNT_ID; mnt = mnt->mnt_parent) {}
8383
}
8484
error = statfs_by_dentry(mnt->mnt.mnt_root, buf);
@@ -241,7 +241,7 @@ int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
241241
return -EINVAL;
242242

243243
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
244-
if (unlikely(s->s_root->d_inode->i_state & INODE_STATE_SUS_MOUNT)) {
244+
if (unlikely(s->s_root->d_inode->i_mapping->flags & BIT_SUS_MOUNT)) {
245245
return -EINVAL;
246246
}
247247
#endif

0 commit comments

Comments
 (0)