Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion KernelSU-Next
Submodule KernelSU-Next updated from 81dff8 to e8e683
2 changes: 1 addition & 1 deletion drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ obj-$(CONFIG_TRUSTY) += trusty/
obj-$(CONFIG_GNSS_SIRF) += gnsssirf/
obj-$(CONFIG_GNSS) += gnss/

obj-y += kernelsu/
obj-$(CONFIG_KSU) += kernelsu/
3 changes: 1 addition & 2 deletions fs/overlayfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
bool is_dir = S_ISDIR(dentry->d_inode->i_mode);
int err;

#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS

ovl_path_lowerdata(dentry, &realpath);
if (likely(realpath.mnt && realpath.dentry)) {
old_cred = ovl_override_creds(dentry->d_sb);
err = vfs_getattr(&realpath, stat, request_mask, flags);
goto out;
}
#endif
type = ovl_path_real(dentry, &realpath);
old_cred = ovl_override_creds(dentry->d_sb);
err = vfs_getattr(&realpath, stat, request_mask, flags);
Expand Down
3 changes: 1 addition & 2 deletions fs/overlayfs/overlayfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ bool ovl_dentry_weird(struct dentry *dentry);
enum ovl_path_type ovl_path_type(struct dentry *dentry);
void ovl_path_upper(struct dentry *dentry, struct path *path);
void ovl_path_lower(struct dentry *dentry, struct path *path);
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS

void ovl_path_lowerdata(struct dentry *dentry, struct path *path);
#endif
enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
struct dentry *ovl_dentry_upper(struct dentry *dentry);
struct dentry *ovl_dentry_lower(struct dentry *dentry);
Expand Down
13 changes: 1 addition & 12 deletions fs/overlayfs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,19 +838,8 @@ static int ovl_dir_open(struct inode *inode, struct file *file)
if (!od)
return -ENOMEM;

#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
ovl_path_lowerdata(file->f_path.dentry, &realpath);
if (likely(realpath.mnt && realpath.dentry)) {
// We still use '__OVL_PATH_UPPER' here which should be fine.
type = __OVL_PATH_UPPER;
goto bypass_orig_flow;
}
#endif

type = ovl_path_real(file->f_path.dentry, &realpath);
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
bypass_orig_flow:
#endif

realfile = ovl_path_open(&realpath, file->f_flags);
if (IS_ERR(realfile)) {
kfree(od);
Expand Down
3 changes: 1 addition & 2 deletions fs/overlayfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
struct path path;
int err;

#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS

ovl_path_lowerdata(root_dentry, &path);
if (likely(path.mnt && path.dentry)) {
err = vfs_statfs(&path, buf);
Expand All @@ -292,7 +292,6 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
}
return err;
}
#endif

ovl_path_real(root_dentry, &path);

Expand Down
3 changes: 1 addition & 2 deletions fs/overlayfs/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void ovl_path_lower(struct dentry *dentry, struct path *path)
*path = oe->numlower ? oe->lowerstack[0] : (struct path) { };
}

#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS

void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
{
struct ovl_entry *oe = dentry->d_fsdata;
Expand All @@ -154,7 +154,6 @@ void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
*path = (struct path) { };
}
}
#endif

enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path)
{
Expand Down
29 changes: 15 additions & 14 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include <linux/syscalls.h>
#include <linux/pagemap.h>
#include <linux/compat.h>
#if defined(CONFIG_KSU_SUSFS_SUS_KSTAT) || defined(CONFIG_KSU_SUSFS_SUS_MOUNT)
#include <linux/susfs_def.h>
#endif

#include <linux/uaccess.h>
#include <asm/unistd.h>
Expand All @@ -34,22 +32,11 @@
* operation is supplied.
*/
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *stat);
extern void susfs_generic_fillattr_spoofer(struct inode *inode, struct kstat *stat);
#endif

void generic_fillattr(struct inode *inode, struct kstat *stat)
{
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
if (likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC) &&
unlikely(inode->i_state & INODE_STATE_SUS_KSTAT)) {
susfs_sus_ino_for_generic_fillattr(inode->i_ino, stat);
stat->mode = inode->i_mode;
stat->rdev = inode->i_rdev;
stat->uid = inode->i_uid;
stat->gid = inode->i_gid;
return;
}
#endif
stat->dev = inode->i_sb->s_dev;
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
Expand All @@ -64,6 +51,10 @@ void generic_fillattr(struct inode *inode, struct kstat *stat)
stat->blksize = i_blocksize(inode);
stat->blocks = inode->i_blocks;

#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
susfs_generic_fillattr_spoofer(inode, stat);
#endif

if (IS_NOATIME(inode))
stat->result_mask &= ~STATX_ATIME;
if (IS_AUTOMOUNT(inode))
Expand Down Expand Up @@ -94,8 +85,18 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
request_mask &= STATX_ALL;
query_flags &= KSTAT_QUERY_FLAGS;
if (inode->i_op->getattr)
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
{
int err = inode->i_op->getattr(path, stat, request_mask,
query_flags);
if (!err)
susfs_generic_fillattr_spoofer(inode, stat);
return err;
}
#else
return inode->i_op->getattr(path, stat, request_mask,
query_flags);
#endif

generic_fillattr(inode, stat);
return 0;
Expand Down
140 changes: 0 additions & 140 deletions fs/sus_su.c

This file was deleted.

Loading