Repatch
This commit is contained in:
parent
157e80e925
commit
717afbe056
30 changed files with 43 additions and 558 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -147,4 +147,10 @@ kernel/configs/android-*.cfg
|
|||
drivers/kernelsu
|
||||
|
||||
# Failed patch
|
||||
*.rej
|
||||
*.rej
|
||||
|
||||
# xxtr-zip
|
||||
xxtr-zip/
|
||||
|
||||
# toolchain
|
||||
toolchain/
|
8
Makefile
8
Makefile
|
@ -311,8 +311,8 @@ else
|
|||
HOSTCC = gcc
|
||||
HOSTCXX = g++
|
||||
endif
|
||||
HOSTCFLAGS := -Wall -Wmissing-prototypes -O2 -fomit-frame-pointer -std=gnu89
|
||||
HOSTCXXFLAGS = -O2
|
||||
HOSTCFLAGS := -Wall -Wmissing-prototypes -O3 -fomit-frame-pointer -std=gnu89
|
||||
HOSTCXXFLAGS = -O3
|
||||
|
||||
# Decide whether to build built-in, modular, or both.
|
||||
# Normally, just do built-in.
|
||||
|
@ -888,8 +888,8 @@ KBUILD_LDFLAGS += -mllvm -regalloc-enable-advisor=release \
|
|||
endif
|
||||
|
||||
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
||||
KBUILD_CFLAGS += -O2
|
||||
KBUILD_LDFLAGS += -O2
|
||||
KBUILD_CFLAGS += -O3
|
||||
KBUILD_LDFLAGS += -O3
|
||||
else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
|
||||
KBUILD_CFLAGS += -O3
|
||||
KBUILD_LDFLAGS += -O3
|
||||
|
|
|
@ -46,7 +46,7 @@ CONFIG_TOOLS_SUPPORT_RELR=y
|
|||
CONFIG_INIT_ENV_ARG_LIMIT=32
|
||||
CONFIG_CROSS_COMPILE=""
|
||||
# CONFIG_COMPILE_TEST is not set
|
||||
CONFIG_LOCALVERSION="-xxTR-00.0"
|
||||
CONFIG_LOCALVERSION="-xxTR-00.0-MindPatched-v2"
|
||||
# CONFIG_LOCALVERSION_AUTO is not set
|
||||
CONFIG_DEFAULT_HOSTNAME="(none)"
|
||||
CONFIG_SWAP=y
|
||||
|
@ -231,7 +231,7 @@ CONFIG_SLUB_CPU_PARTIAL=y
|
|||
CONFIG_DEFERRED_INITCALLS=y
|
||||
# CONFIG_PROFILING is not set
|
||||
CONFIG_TRACEPOINTS=y
|
||||
# CONFIG_KPROBES is not set
|
||||
CONFIG_KPROBES=y
|
||||
# CONFIG_JUMP_LABEL is not set
|
||||
# CONFIG_UPROBES is not set
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
|
@ -5330,10 +5330,13 @@ CONFIG_TZIC_USE_TRUSTONIC=y
|
|||
# CONFIG_TZIC_DEFAULT is not set
|
||||
|
||||
#
|
||||
# KernelSU
|
||||
# KernelSU / SuSFS
|
||||
#
|
||||
CONFIG_KSU=y
|
||||
CONFIG_KSU_SUSFS=y
|
||||
CONFIG_KSU_SUSFS_SUS_SU=y
|
||||
KSU_SUSFS_HAS_MAGIC_MOUNT=y
|
||||
|
||||
# CONFIG_KSU_DEBUG is not set
|
||||
|
||||
#
|
||||
|
|
|
@ -13,8 +13,6 @@ obj-y := open.o read_write.o file_table.o super.o \
|
|||
pnode.o splice.o sync.o utimes.o \
|
||||
stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
|
||||
|
||||
obj-$(CONFIG_KSU_SUSFS) += susfs.o
|
||||
|
||||
ifeq ($(CONFIG_BLOCK),y)
|
||||
obj-y += buffer.o block_dev.o direct-io.o mpage.o
|
||||
else
|
||||
|
|
11
fs/dcache.c
11
fs/dcache.c
|
@ -2220,11 +2220,6 @@ seqretry:
|
|||
continue;
|
||||
if (dentry_cmp(dentry, str, hashlen_len(hashlen)) != 0)
|
||||
continue;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
*seqp = seq;
|
||||
return dentry;
|
||||
|
@ -2308,12 +2303,6 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name)
|
|||
if (dentry->d_name.hash != hash)
|
||||
continue;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
spin_lock(&dentry->d_lock);
|
||||
if (dentry->d_parent != parent)
|
||||
goto next;
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
#define DEVPTS_DEFAULT_PTMX_MODE 0000
|
||||
#define PTMX_MINOR 2
|
||||
|
||||
#if defined(CONFIG_KSU_SUSFS_SUS_SU)
|
||||
extern bool ksu_devpts_hook;
|
||||
extern int ksu_handle_devpts(struct inode*);
|
||||
#endif
|
||||
/*
|
||||
* sysctl support for setting limits on the number of Unix98 ptys allocated.
|
||||
* Otherwise one can eat up all kernel memory by opening /dev/ptmx repeatedly.
|
||||
|
@ -569,14 +565,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
|
|||
*
|
||||
* Returns whatever was passed as priv in devpts_pty_new for a given inode.
|
||||
*/
|
||||
|
||||
void *devpts_get_priv(struct dentry *dentry)
|
||||
{
|
||||
#if defined(CONFIG_KSU_SUSFS_SUS_SU)
|
||||
if (ksu_devpts_hook) {
|
||||
ksu_handle_devpts(dentry->d_inode);
|
||||
}
|
||||
#endif
|
||||
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
|
||||
return NULL;
|
||||
return dentry->d_fsdata;
|
||||
|
|
12
fs/exec.c
12
fs/exec.c
|
@ -1938,13 +1938,6 @@ extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
|||
/*
|
||||
* sys_execve() executes a new program.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
||||
extern bool susfs_is_sus_su_hooks_enabled __read_mostly;
|
||||
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr, void *argv,
|
||||
void *envp, int *flags);
|
||||
#endif
|
||||
|
||||
static int do_execveat_common(int fd, struct filename *filename,
|
||||
struct user_arg_ptr argv,
|
||||
struct user_arg_ptr envp,
|
||||
|
@ -1966,11 +1959,6 @@ static int do_execveat_common(int fd, struct filename *filename,
|
|||
if (IS_ERR(filename))
|
||||
return PTR_ERR(filename);
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
||||
if (susfs_is_sus_su_hooks_enabled)
|
||||
ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We move the actual failure in case of RLIMIT_NPROC excess from
|
||||
* set*uid() to execve() because too many poorly written programs
|
||||
|
|
21
fs/inode.c
21
fs/inode.c
|
@ -23,10 +23,6 @@
|
|||
|
||||
#include <crypto/fmp.h>
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
extern bool susfs_is_current_ksu_domain(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Inode locking rules:
|
||||
*
|
||||
|
@ -1648,11 +1644,6 @@ int generic_update_time(struct inode *inode, struct timespec *time, int flags)
|
|||
{
|
||||
int iflags = I_DIRTY_TIME;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (flags & S_ATIME)
|
||||
inode->i_atime = *time;
|
||||
if (flags & S_VERSION)
|
||||
|
@ -1677,12 +1668,6 @@ static int update_time(struct inode *inode, struct timespec *time, int flags)
|
|||
{
|
||||
int (*update_time)(struct inode *, struct timespec *, int);
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
update_time = inode->i_op->update_time ? inode->i_op->update_time :
|
||||
generic_update_time;
|
||||
|
||||
|
@ -1740,12 +1725,6 @@ void touch_atime(const struct path *path)
|
|||
struct inode *inode = d_inode(path->dentry);
|
||||
struct timespec now;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!__atime_needs_update(path, inode, false))
|
||||
return;
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ extern int finish_automount(struct vfsmount *, struct path *);
|
|||
extern int sb_prepare_remount_readonly(struct super_block *);
|
||||
|
||||
extern void __init mnt_init(void);
|
||||
int path_umount(struct path *path, int flags);
|
||||
|
||||
extern int __mnt_want_write(struct vfsmount *);
|
||||
extern int __mnt_want_write_file(struct file *);
|
||||
|
|
137
fs/namei.c
137
fs/namei.c
|
@ -932,12 +932,6 @@ static inline int may_follow_link(struct nameidata *nd)
|
|||
const struct inode *parent;
|
||||
kuid_t puid;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (nd->inode && unlikely(nd->inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!sysctl_protected_symlinks)
|
||||
return 0;
|
||||
|
||||
|
@ -1014,12 +1008,6 @@ static int may_linkat(struct path *link)
|
|||
{
|
||||
struct inode *inode;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (link->dentry->d_inode && unlikely(link->dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!sysctl_protected_hardlinks)
|
||||
return 0;
|
||||
|
||||
|
@ -1059,12 +1047,6 @@ static int may_linkat(struct path *link)
|
|||
static int may_create_in_sticky(umode_t dir_mode, kuid_t dir_uid,
|
||||
struct inode * const inode)
|
||||
{
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((!sysctl_protected_fifos && S_ISFIFO(inode->i_mode)) ||
|
||||
(!sysctl_protected_regular && S_ISREG(inode->i_mode)) ||
|
||||
likely(!(dir_mode & S_ISVTX)) ||
|
||||
|
@ -1599,9 +1581,6 @@ static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry,
|
|||
unsigned int flags)
|
||||
{
|
||||
struct dentry *old;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
int error;
|
||||
#endif
|
||||
|
||||
/* Don't create child dentry for a dead directory. */
|
||||
if (unlikely(IS_DEADDIR(dir))) {
|
||||
|
@ -1614,19 +1593,6 @@ static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry,
|
|||
dput(dentry);
|
||||
dentry = old;
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
if ((flags & (LOOKUP_CREATE | LOOKUP_EXCL))) {
|
||||
error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
|
||||
if (error) {
|
||||
dput(dentry);
|
||||
return ERR_PTR(error);
|
||||
}
|
||||
}
|
||||
dput(dentry);
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
#endif
|
||||
return dentry;
|
||||
}
|
||||
|
||||
|
@ -1775,12 +1741,6 @@ again:
|
|||
dentry = old;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
dput(dentry);
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
#endif
|
||||
out:
|
||||
inode_unlock_shared(inode);
|
||||
return dentry;
|
||||
|
@ -2253,12 +2213,6 @@ OK:
|
|||
}
|
||||
return -ENOTDIR;
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
// we deal with sus sub path here
|
||||
if (nd->inode && unlikely(nd->inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2438,12 +2392,6 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags,
|
|||
if (likely(!retval))
|
||||
audit_inode(name, path->dentry, flags & LOOKUP_PARENT);
|
||||
restore_nameidata();
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (!retval && path->dentry->d_inode && unlikely(path->dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
putname(name);
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
putname(name);
|
||||
return retval;
|
||||
}
|
||||
|
@ -2926,12 +2874,6 @@ static int may_delete(struct vfsmount *mnt, struct inode *dir, struct dentry *vi
|
|||
if (IS_APPEND(dir))
|
||||
return -EPERM;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (check_sticky(dir, inode) || IS_APPEND(inode) ||
|
||||
IS_IMMUTABLE(inode) || IS_SWAPFILE(inode) || HAS_UNMAPPED_ID(inode))
|
||||
return -EPERM;
|
||||
|
@ -2960,20 +2902,8 @@ static int may_delete(struct vfsmount *mnt, struct inode *dir, struct dentry *vi
|
|||
*/
|
||||
static inline int may_create(struct vfsmount *mnt, struct inode *dir, struct dentry *child)
|
||||
{
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
int error;
|
||||
#endif
|
||||
struct user_namespace *s_user_ns;
|
||||
audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE);
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (child->d_inode && unlikely(child->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
error = inode_permission2(mnt, dir, MAY_WRITE | MAY_EXEC);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
if (child->d_inode)
|
||||
return -EEXIST;
|
||||
if (IS_DEADDIR(dir))
|
||||
|
@ -3073,12 +3003,6 @@ static int may_open(struct path *path, int acc_mode, int flag)
|
|||
if (!inode)
|
||||
return -ENOENT;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (inode->i_mode & S_IFMT) {
|
||||
case S_IFLNK:
|
||||
return -ELOOP;
|
||||
|
@ -3150,20 +3074,7 @@ static inline int open_to_namei_flags(int flag)
|
|||
static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
struct user_namespace *s_user_ns;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
int error;
|
||||
|
||||
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
error = inode_permission2(dir->mnt, dir->dentry->d_inode, MAY_WRITE | MAY_EXEC);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
error = security_path_mknod(dir, dentry, mode, 0);
|
||||
#else
|
||||
int error = security_path_mknod(dir, dentry, mode, 0);
|
||||
#endif
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -3310,12 +3221,6 @@ static int lookup_open(struct nameidata *nd, struct path *path,
|
|||
}
|
||||
if (dentry->d_inode) {
|
||||
/* Cached positive dentry: will open in f_op->open */
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
dput(dentry);
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
goto out_no_open;
|
||||
}
|
||||
|
||||
|
@ -3359,16 +3264,6 @@ static int lookup_open(struct nameidata *nd, struct path *path,
|
|||
mode, opened);
|
||||
if (unlikely(error == -ENOENT) && create_error)
|
||||
error = create_error;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
if (create_error) {
|
||||
dput(dentry);
|
||||
return create_error;
|
||||
}
|
||||
dput(dentry);
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -3384,12 +3279,6 @@ no_open:
|
|||
}
|
||||
dput(dentry);
|
||||
dentry = res;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
|
||||
dput(dentry);
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3745,19 +3634,12 @@ out2:
|
|||
return file;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT
|
||||
extern struct filename* susfs_get_redirected_path(unsigned long ino);
|
||||
#endif
|
||||
|
||||
struct file *do_filp_open(int dfd, struct filename *pathname,
|
||||
const struct open_flags *op)
|
||||
{
|
||||
struct nameidata nd;
|
||||
int flags = op->lookup_flags;
|
||||
struct file *filp;
|
||||
#ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT
|
||||
struct filename *fake_pathname;
|
||||
#endif
|
||||
|
||||
set_nameidata(&nd, dfd, pathname);
|
||||
filp = path_openat(&nd, op, flags | LOOKUP_RCU);
|
||||
|
@ -3765,25 +3647,6 @@ struct file *do_filp_open(int dfd, struct filename *pathname,
|
|||
filp = path_openat(&nd, op, flags);
|
||||
if (unlikely(filp == ERR_PTR(-ESTALE)))
|
||||
filp = path_openat(&nd, op, flags | LOOKUP_REVAL);
|
||||
#ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT
|
||||
if (!IS_ERR(filp) && unlikely(filp->f_inode->i_state & 134217728) && current_uid().val < 2000) {
|
||||
fake_pathname = susfs_get_redirected_path(filp->f_inode->i_ino);
|
||||
if (!IS_ERR(fake_pathname)) {
|
||||
restore_nameidata();
|
||||
filp_close(filp, NULL);
|
||||
// no need to do `putname(pathname);` here as it will be done by calling process
|
||||
set_nameidata(&nd, dfd, fake_pathname);
|
||||
filp = path_openat(&nd, op, flags | LOOKUP_RCU);
|
||||
if (unlikely(filp == ERR_PTR(-ECHILD)))
|
||||
filp = path_openat(&nd, op, flags);
|
||||
if (unlikely(filp == ERR_PTR(-ESTALE)))
|
||||
filp = path_openat(&nd, op, flags | LOOKUP_REVAL);
|
||||
restore_nameidata();
|
||||
putname(fake_pathname);
|
||||
return filp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
restore_nameidata();
|
||||
return filp;
|
||||
}
|
||||
|
|
153
fs/namespace.c
153
fs/namespace.c
|
@ -46,23 +46,6 @@
|
|||
#define KDP_MOUNT_VENDOR_LEN strlen(KDP_MOUNT_VENDOR)
|
||||
#endif /*CONFIG_RKP_NS_PROT */
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
extern bool susfs_is_current_ksu_domain(void);
|
||||
extern bool susfs_is_current_zygote_domain(void);
|
||||
#define CL_SUSFS_COPY_MNT_NS 0x1000000
|
||||
#define DEFAULT_SUS_MNT_GROUP_ID 1000
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT
|
||||
extern int susfs_auto_add_sus_bind_mount(const char *pathname, struct path *path_target);
|
||||
#endif
|
||||
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT
|
||||
extern void susfs_auto_add_try_umount_for_bind_mount(struct path *path);
|
||||
#endif
|
||||
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT
|
||||
extern void susfs_auto_add_sus_ksu_default_mount(const char __user *to_pathname);
|
||||
#endif
|
||||
|
||||
/* Maximum number of mounts in a mount namespace */
|
||||
unsigned int sysctl_mount_max __read_mostly = 100000;
|
||||
|
||||
|
@ -307,20 +290,6 @@ static int mnt_alloc_vfsmount(struct mount *mnt)
|
|||
static void mnt_free_id(struct mount *mnt)
|
||||
{
|
||||
int id = mnt->mnt_id;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
int orig_id;
|
||||
// If mnt->mnt.android_kabi_reserved4 is not zero, it means mnt->mnt_id is spoofed,
|
||||
// so here we return the original mnt_id for being freed.
|
||||
if (unlikely(mnt->mnt.android_kabi_reserved4)) {
|
||||
orig_id = mnt->mnt.android_kabi_reserved4;
|
||||
spin_lock(&mnt_id_lock);
|
||||
ida_remove(&mnt_id_ida, orig_id);
|
||||
if (mnt_id_start > orig_id)
|
||||
mnt_id_start = orig_id;
|
||||
spin_unlock(&mnt_id_lock);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
spin_lock(&mnt_id_lock);
|
||||
ida_remove(&mnt_id_ida, id);
|
||||
if (mnt_id_start > id)
|
||||
|
@ -328,14 +297,6 @@ static void mnt_free_id(struct mount *mnt)
|
|||
spin_unlock(&mnt_id_lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
static void susfs_mnt_alloc_group_id(struct mount *mnt)
|
||||
{
|
||||
// Just assign the same default sus mount_group_id to mnt->mnt_group_id
|
||||
mnt->mnt_group_id = DEFAULT_SUS_MNT_GROUP_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate a new peer group ID
|
||||
*
|
||||
|
@ -363,14 +324,6 @@ static int mnt_alloc_group_id(struct mount *mnt)
|
|||
void mnt_release_group_id(struct mount *mnt)
|
||||
{
|
||||
int id = mnt->mnt_group_id;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
// If mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID, it means 'mnt' is sus mount,
|
||||
// here we don't need to free the mnt_group_id and just simply return and do nothing.
|
||||
if (unlikely(mnt->mnt_group_id >= DEFAULT_SUS_MNT_GROUP_ID)) {
|
||||
mnt->mnt_group_id = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ida_remove(&mnt_group_ida, id);
|
||||
if (mnt_group_start > id)
|
||||
mnt_group_start = id;
|
||||
|
@ -1318,14 +1271,6 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
|
|||
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
||||
#endif
|
||||
mnt->mnt_parent = mnt;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (susfs_is_current_zygote_domain()) {
|
||||
mnt->mnt.android_kabi_reserved4 = mnt->mnt_id;
|
||||
mnt->mnt_id = current->android_kabi_reserved8++;
|
||||
}
|
||||
#endif
|
||||
|
||||
lock_mount_hash();
|
||||
list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts);
|
||||
unlock_mount_hash();
|
||||
|
@ -1451,14 +1396,6 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
|
|||
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
|
||||
#endif
|
||||
mnt->mnt_parent = mnt;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (susfs_is_current_zygote_domain() && !(flag & CL_SUSFS_COPY_MNT_NS)) {
|
||||
mnt->mnt.android_kabi_reserved4 = mnt->mnt_id;
|
||||
mnt->mnt_id = current->android_kabi_reserved8++;
|
||||
}
|
||||
#endif
|
||||
|
||||
lock_mount_hash();
|
||||
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
|
||||
unlock_mount_hash();
|
||||
|
@ -2433,17 +2370,6 @@ static int invent_group_ids(struct mount *mnt, bool recurse)
|
|||
{
|
||||
struct mount *p;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
|
||||
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
|
||||
susfs_mnt_alloc_group_id(p);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
|
||||
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
|
||||
int err = mnt_alloc_group_id(p);
|
||||
|
@ -2822,24 +2748,6 @@ static int do_loopback(struct path *path, const char *old_name,
|
|||
umount_tree(mnt, UMOUNT_SYNC);
|
||||
unlock_mount_hash();
|
||||
}
|
||||
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT) || defined(CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT)
|
||||
// Check if bind mounted path should be hidden and umounted automatically.
|
||||
// And we target only process with ksu domain.
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT)
|
||||
if (susfs_auto_add_sus_bind_mount(old_name, &old_path)) {
|
||||
goto orig_flow;
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT)
|
||||
susfs_auto_add_try_umount_for_bind_mount(path);
|
||||
#endif
|
||||
}
|
||||
#if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT)
|
||||
orig_flow:
|
||||
#endif
|
||||
#endif // #if defined(CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT) || defined(CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT)
|
||||
|
||||
out2:
|
||||
unlock_mount(mp);
|
||||
out:
|
||||
|
@ -3526,13 +3434,6 @@ long do_mount(const char *dev_name, const char __user *dir_name,
|
|||
retval = do_new_mount(&path, type_page, sb_flags, mnt_flags,
|
||||
dev_name, data_page);
|
||||
#endif
|
||||
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT
|
||||
if (!retval && (!(flags & (MS_REMOUNT | MS_BIND | MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)))) {
|
||||
if (susfs_is_current_ksu_domain()) {
|
||||
susfs_auto_add_sus_ksu_default_mount(dir_name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
dput_out:
|
||||
path_put(&path);
|
||||
return retval;
|
||||
|
@ -3610,10 +3511,6 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
|
|||
struct mount *old;
|
||||
struct mount *new;
|
||||
int copy_flags;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
bool is_zygote_pid = susfs_is_current_zygote_domain();
|
||||
int last_entry_mnt_id = 0;
|
||||
#endif
|
||||
|
||||
BUG_ON(!ns);
|
||||
|
||||
|
@ -3633,12 +3530,6 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
|
|||
copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;
|
||||
if (user_ns != ns->user_ns)
|
||||
copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (is_zygote_pid) {
|
||||
// Let clone_mnt() in copy_tree() know we only interested in function called by copy_mnt_ns()
|
||||
copy_flags |= CL_SUSFS_COPY_MNT_NS;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_RKP_NS_PROT
|
||||
new = copy_tree(old, old->mnt->mnt_root, copy_flags);
|
||||
#else
|
||||
|
@ -3695,29 +3586,6 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
|
|||
#endif
|
||||
p = next_mnt(p, old);
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
// current->android_kabi_reserved8 -> to record last valid fake mnt_id to zygote pid
|
||||
// q->mnt.android_kabi_reserved4 -> original mnt_id
|
||||
// q->mnt_id -> will be modified to the fake mnt_id
|
||||
|
||||
// Here We are only interested in processes of which original mnt namespace belongs to zygote
|
||||
// Also we just make use of existing 'q' mount pointer, no need to delcare extra mount pointer
|
||||
if (is_zygote_pid) {
|
||||
last_entry_mnt_id = list_first_entry(&new_ns->list, struct mount, mnt_list)->mnt_id;
|
||||
list_for_each_entry(q, &new_ns->list, mnt_list) {
|
||||
if (unlikely(q->mnt.mnt_root->d_inode->i_state & 33554432)) {
|
||||
continue;
|
||||
}
|
||||
q->mnt.android_kabi_reserved4 = q->mnt_id;
|
||||
q->mnt_id = last_entry_mnt_id++;
|
||||
}
|
||||
}
|
||||
// Assign the 'last_entry_mnt_id' to 'current->android_kabi_reserved8' for later use.
|
||||
// should be fine here assuming zygote is forking/unsharing app in one single thread.
|
||||
// Or should we put a lock here?
|
||||
current->android_kabi_reserved8 = last_entry_mnt_id;
|
||||
#endif
|
||||
|
||||
namespace_unlock();
|
||||
|
||||
if (rootmnt)
|
||||
|
@ -4343,24 +4211,3 @@ const struct proc_ns_operations mntns_operations = {
|
|||
.install = mntns_install,
|
||||
.owner = mntns_owner,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
||||
extern void susfs_try_umount_all(uid_t uid);
|
||||
void susfs_run_try_umount_for_current_mnt_ns(void) {
|
||||
struct mount *mnt;
|
||||
struct mnt_namespace *mnt_ns;
|
||||
|
||||
mnt_ns = current->nsproxy->mnt_ns;
|
||||
// Lock the namespace
|
||||
namespace_lock();
|
||||
list_for_each_entry(mnt, &mnt_ns->list, mnt_list) {
|
||||
// Change the sus mount to be private
|
||||
if (mnt->mnt.mnt_root->d_inode->i_state & 33554432) {
|
||||
change_mnt_propagation(mnt, MS_PRIVATE);
|
||||
}
|
||||
}
|
||||
// Unlock the namespace
|
||||
namespace_unlock();
|
||||
susfs_try_umount_all(current_uid().val);
|
||||
}
|
||||
#endif
|
13
fs/open.c
13
fs/open.c
|
@ -369,13 +369,6 @@ extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int
|
|||
* We do this by temporarily clearing all FS-related capabilities and
|
||||
* switching the fsuid/fsgid around to the real ones.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
||||
extern bool susfs_is_sus_su_hooks_enabled __read_mostly;
|
||||
extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
|
||||
int *flags);
|
||||
#endif
|
||||
|
||||
SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
|
||||
{
|
||||
const struct cred *old_cred;
|
||||
|
@ -390,12 +383,6 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
|
|||
ksu_handle_faccessat(&dfd, &filename, &mode, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_SU
|
||||
if (susfs_is_sus_su_hooks_enabled) {
|
||||
ksu_handle_faccessat(&dfd, &filename, &mode, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -115,16 +115,6 @@ static int ovl_getattr(const struct path *path, struct kstat *stat,
|
|||
const struct cred *old_cred;
|
||||
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);
|
||||
ovl_revert_creds(old_cred);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
ovl_path_real(dentry, &realpath);
|
||||
old_cred = ovl_override_creds(dentry->d_sb);
|
||||
err = vfs_getattr(&realpath, stat, request_mask, flags);
|
||||
|
|
|
@ -148,9 +148,6 @@ u64 ovl_dentry_version_get(struct dentry *dentry);
|
|||
void ovl_dentry_version_inc(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);
|
||||
int ovl_path_next(int idx, struct dentry *dentry, struct path *path);
|
||||
struct dentry *ovl_dentry_upper(struct dentry *dentry);
|
||||
|
|
|
@ -499,19 +499,7 @@ 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);
|
||||
|
|
|
@ -186,20 +186,6 @@ void ovl_path_lower(struct dentry *dentry, struct path *path)
|
|||
*path = oe->numlower ? oe->lowerstack[0] : (struct path) { NULL, NULL };
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
|
||||
void ovl_path_lowerdata(struct dentry *dentry, struct path *path)
|
||||
{
|
||||
struct ovl_entry *oe = dentry->d_fsdata;
|
||||
|
||||
if (oe->numlower) {
|
||||
path->mnt = oe->lowerstack[oe->numlower - 1].mnt;
|
||||
path->dentry = oe->lowerstack[oe->numlower - 1].dentry;
|
||||
} else {
|
||||
*path = (struct path) { };
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int ovl_want_write(struct dentry *dentry)
|
||||
{
|
||||
struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
|
||||
|
@ -668,18 +654,6 @@ 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);
|
||||
if (!err) {
|
||||
buf->f_namelen = 255; // 255 for erofs, ext2/4, f2fs
|
||||
buf->f_type = path.dentry->d_sb->s_magic;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
ovl_path_real(root_dentry, &path);
|
||||
|
||||
err = vfs_statfs(&path, buf);
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
#include <linux/seq_file.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
#ifdef KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG
|
||||
extern int susfs_spoof_cmdline_or_bootconfig(struct seq_file *m);
|
||||
#endif
|
||||
|
||||
enum {
|
||||
FLAG_DELETE = 0,
|
||||
FLAG_REPLACE,
|
||||
|
@ -17,12 +13,6 @@ static char new_command_line[COMMAND_LINE_SIZE];
|
|||
|
||||
static int cmdline_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
#ifdef KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG
|
||||
if (!susfs_spoof_cmdline_or_bootconfig(m)) {
|
||||
seq_putc(m, '\n');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
seq_puts(m, new_command_line);
|
||||
seq_putc(m, '\n');
|
||||
return 0;
|
||||
|
|
|
@ -375,10 +375,6 @@ static void show_vma_header_prefix(struct seq_file *m,
|
|||
MAJOR(dev), MINOR(dev), ino);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
extern void susfs_sus_ino_for_show_map_vma(unsigned long ino, dev_t *out_dev, unsigned long *out_ino);
|
||||
#endif
|
||||
|
||||
static void
|
||||
show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
||||
{
|
||||
|
@ -394,17 +390,8 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|||
|
||||
if (file) {
|
||||
struct inode *inode = file_inode(vma->vm_file);
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (unlikely(inode->i_state & 67108864)) {
|
||||
susfs_sus_ino_for_show_map_vma(inode->i_ino, &dev, &ino);
|
||||
goto bypass_orig_flow;
|
||||
}
|
||||
#endif
|
||||
dev = inode->i_sb->s_dev;
|
||||
ino = inode->i_ino;
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
bypass_orig_flow:
|
||||
#endif
|
||||
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
#include "pnode.h"
|
||||
#include "internal.h"
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
extern bool susfs_is_current_ksu_domain(void);
|
||||
#endif
|
||||
|
||||
static unsigned mounts_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct seq_file *m = file->private_data;
|
||||
|
@ -103,11 +99,6 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
|
|||
struct super_block *sb = mnt_path.dentry->d_sb;
|
||||
int err;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (unlikely((r->mnt.mnt_root->d_inode->i_state & 33554432) && !susfs_is_current_ksu_domain()))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (sb->s_op->show_devname) {
|
||||
err = sb->s_op->show_devname(m, mnt_path.dentry);
|
||||
if (err)
|
||||
|
@ -144,11 +135,6 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
|
|||
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
||||
int err;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (unlikely((r->mnt.mnt_root->d_inode->i_state & 33554432) && !susfs_is_current_ksu_domain()))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
|
||||
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
||||
if (sb->s_op->show_path) {
|
||||
|
@ -213,11 +199,6 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
|
|||
struct super_block *sb = mnt_path.dentry->d_sb;
|
||||
int err;
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
if (unlikely((r->mnt.mnt_root->d_inode->i_state & 33554432) && !susfs_is_current_ksu_domain()))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* device */
|
||||
if (sb->s_op->show_devname) {
|
||||
seq_puts(m, "device ");
|
||||
|
|
|
@ -286,10 +286,6 @@ struct getdents_callback64 {
|
|||
int error;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
extern int susfs_sus_ino_for_filldir64(unsigned long ino);
|
||||
#endif
|
||||
|
||||
static int filldir64(struct dir_context *ctx, const char *name, int namlen,
|
||||
loff_t offset, u64 ino, unsigned int d_type)
|
||||
{
|
||||
|
@ -299,11 +295,6 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen,
|
|||
int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
|
||||
sizeof(u64));
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
|
||||
if (likely(current_cred()->user->android_kabi_reserved2 & 16777216) && susfs_sus_ino_for_filldir64(ino)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
buf->error = verify_dirent_name(name, namlen);
|
||||
if (unlikely(buf->error))
|
||||
return buf->error;
|
||||
|
|
14
fs/stat.c
14
fs/stat.c
|
@ -18,10 +18,6 @@
|
|||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *stat);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* generic_fillattr - Fill in the basic attributes from the inode struct
|
||||
* @inode: Inode to use as the source
|
||||
|
@ -33,16 +29,6 @@ extern void susfs_sus_ino_for_generic_fillattr(unsigned long ino, struct kstat *
|
|||
*/
|
||||
void generic_fillattr(struct inode *inode, struct kstat *stat)
|
||||
{
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (unlikely(inode->i_state & 67108864)) {
|
||||
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;
|
||||
|
|
22
fs/statfs.c
22
fs/statfs.c
|
@ -89,22 +89,6 @@ retry:
|
|||
goto retry;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
|
||||
/* - When mounting overlay, the f_flags are set with 'ro' and 'relatime',
|
||||
* but this is an abnormal status, as when we inspect the output from mountinfo,
|
||||
* we will find that all partitions set with 'ro' will have 'noatime' set as well.
|
||||
* - But what is strange here is that the vfsmnt f_flags of the lowest layer has corrent f_flags set,
|
||||
* and still it is always changed to 'relatime' instead of 'noatime' for the final result,
|
||||
* I can't think of any other reason to explain about this, maybe the f_flags is set by its own
|
||||
* filesystem implementation but not the one from overlayfs.
|
||||
* - Anyway we just cannot use the retrieved f_flags from ovl_getattr() of overlayfs,
|
||||
* we need to run one more check for user_statfs() and fd_statfs() by ourselves.
|
||||
*/
|
||||
if (unlikely((st->f_flags & ST_RDONLY) && (st->f_flags & ST_RELATIME))) {
|
||||
st->f_flags &= ~ST_RELATIME;
|
||||
st->f_flags |= ST_NOATIME;
|
||||
}
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -116,12 +100,6 @@ int fd_statfs(int fd, struct kstatfs *st)
|
|||
error = vfs_statfs(&f.file->f_path, st);
|
||||
fdput(f);
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_OVERLAYFS
|
||||
if (unlikely((st->f_flags & ST_RDONLY) && (st->f_flags & ST_RELATIME))) {
|
||||
st->f_flags &= ~ST_RELATIME;
|
||||
st->f_flags |= ST_NOATIME;
|
||||
}
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,9 +71,6 @@ struct vfsmount {
|
|||
#endif
|
||||
int mnt_flags;
|
||||
void *data;
|
||||
#ifdef CONFIG_KSU_SUSFS
|
||||
u64 android_kabi_reserved4;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct file; /* forward dec */
|
||||
|
|
|
@ -863,10 +863,6 @@ struct user_struct {
|
|||
#if defined(CONFIG_PERF_EVENTS) || defined(CONFIG_BPF_SYSCALL)
|
||||
atomic_long_t locked_vm;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS
|
||||
u64 android_kabi_reserved2;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int uids_sysfs_init(void);
|
||||
|
@ -2188,11 +2184,6 @@ struct task_struct {
|
|||
/* A live task holds one reference. */
|
||||
atomic_t stack_refcount;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS
|
||||
u64 android_kabi_reserved8;
|
||||
#endif
|
||||
|
||||
/* CPU-specific state of this task */
|
||||
struct thread_struct thread;
|
||||
/*
|
||||
|
|
|
@ -678,19 +678,8 @@ static int s_show(struct seq_file *m, void *p)
|
|||
seq_printf(m, "%pK %c %s\t[%s]\n", (void *)iter->value,
|
||||
type, iter->name, iter->module_name);
|
||||
} else
|
||||
|
||||
#ifndef CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS
|
||||
seq_printf(m, "%pK %c %s\n", (void *)iter->value,
|
||||
iter->type, iter->name);
|
||||
#else
|
||||
{
|
||||
if (strstr(iter->name, "ksu_") || !strncmp(iter->name, "susfs_", 6) || !strncmp(iter->name, "ksud", 4)) {
|
||||
return 0;
|
||||
}
|
||||
seq_printf(m, "%pK %c %s\n", (void *)iter->value,
|
||||
iter->type, iter->name);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1340,10 +1340,6 @@ static int override_release(char __user *release, size_t len)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KSU_SUSFS_SPOOF_UNAME
|
||||
extern void susfs_spoof_uname(struct new_utsname* tmp);
|
||||
#endif
|
||||
|
||||
SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
|
||||
{
|
||||
struct new_utsname tmp;
|
||||
|
@ -1357,9 +1353,6 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
|
|||
pr_debug("fake uname: %s/%d release=%s\n",
|
||||
current->comm, current->pid, tmp.release);
|
||||
}
|
||||
#ifdef CONFIG_KSU_SUSFS_SPOOF_UNAME
|
||||
susfs_spoof_uname(&tmp);
|
||||
#endif
|
||||
up_read(&uts_sem);
|
||||
if (copy_to_user(name, &tmp, sizeof(tmp)))
|
||||
return -EFAULT;
|
||||
|
|
|
@ -4,9 +4,9 @@ exec 9>.kernelsu-fetch-lock
|
|||
flock -n 9 || exit 0
|
||||
[[ $(( $(date +%s) - $(stat -c %Y "drivers/kernelsu/.check" 2>/dev/null || echo 0) )) -gt 86400 ]] || exit 0
|
||||
|
||||
AUTHOR="rifsxd"
|
||||
AUTHOR="galaxybuild-project"
|
||||
REPO="KernelSU-Next"
|
||||
VERSION=`curl -s -I -k "https://api.github.com/repos/$AUTHOR/$REPO/commits?sha=next-susfs-4.9&per_page=1" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'`
|
||||
VERSION=`curl -s -I -k "https://api.github.com/repos/$AUTHOR/$REPO/commits?sha=next&per_page=1" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'`
|
||||
|
||||
if [[ -f drivers/kernelsu/.version && *$(cat drivers/kernelsu/.version)* == *$VERSION* ]]; then
|
||||
touch drivers/kernelsu/.check
|
||||
|
@ -17,7 +17,7 @@ fi
|
|||
rm -rf drivers/kernelsu
|
||||
mkdir -p drivers/kernelsu
|
||||
cd drivers/kernelsu
|
||||
wget -q -O - https://github.com/$AUTHOR/$REPO/archive/refs/heads/next-susfs-4.9.tar.gz | tar -xz --strip=2 "$REPO-next-susfs-4.9/kernel"
|
||||
wget -q -O - https://github.com/$AUTHOR/$REPO/archive/refs/heads/next.tar.gz | tar -xz --strip=2 "$REPO-next/kernel"
|
||||
echo $VERSION >> .version
|
||||
touch .check
|
||||
|
||||
|
|
1
toolchain
Symbolic link
1
toolchain
Symbolic link
|
@ -0,0 +1 @@
|
|||
../toolchain
|
39
variables.sh
39
variables.sh
|
@ -1,23 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin:/home/$USER/galaxybuild-project/Toolchains/clang-r522817/lib:${PATH}
|
||||
export CLANG_TRIPLE=/home/$USER/galaxybuild-project/Toolchains/clang/bin/aarch64-linux-gnu-
|
||||
export CROSS_COMPILE=/home/$USER/galaxybuild-project/Toolchains/clang/bin/aarch64-linux-gnu-
|
||||
export CROSS_COMPILE_ARM32=/home/$USER/galaxybuild-project/Toolchains/clang/bin/arm-linux-gnueabi-
|
||||
export CC=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/clang
|
||||
export REAL_CC=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/clang
|
||||
export LD=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/ld.lld
|
||||
export AR=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-ar
|
||||
export NM=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-nm
|
||||
export OBJCOPY=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-objcopy
|
||||
export OBJDUMP=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-objdump
|
||||
export READELF=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-readelf
|
||||
export STRIP=/home/$USER/galaxybuild-project/Toolchains/clang-r522817/bin/llvm-strip
|
||||
export PATH=$(pwd)/toolchain/clang-17/bin:$(pwd)/toolchain/clang-17/lib:${PATH}
|
||||
export CLANG_TRIPLE=$(pwd)/toolchain/clang-13/bin/aarch64-linux-gnu-
|
||||
export CROSS_COMPILE=$(pwd)/toolchain/clang-13/bin/aarch64-linux-gnu-
|
||||
export CROSS_COMPILE_ARM32=$(pwd)/toolchain/clang-13/bin/arm-linux-gnueabi-
|
||||
export CC=$(pwd)/toolchain/clang-17/bin/clang
|
||||
export REAL_CC=$(pwd)/toolchain/clang-17/bin/clang
|
||||
export LD=$(pwd)/toolchain/clang-17/bin/ld.lld
|
||||
export AR=$(pwd)/toolchain/clang-17/bin/llvm-ar
|
||||
export NM=$(pwd)/toolchain/clang-17/bin/llvm-nm
|
||||
export OBJCOPY=$(pwd)/toolchain/clang-17/bin/llvm-objcopy
|
||||
export OBJDUMP=$(pwd)/toolchain/clang-17/bin/llvm-objdump
|
||||
export READELF=$(pwd)/toolchain/clang-17/bin/llvm-readelf
|
||||
export STRIP=$(pwd)/toolchain/clang-17/bin/llvm-strip
|
||||
export LLVM=1 && export LLVM_IAS=1
|
||||
export KALLSYMS_EXTRA_PASS=1
|
||||
|
||||
export ARCH=arm64 && export SUBARCH=arm64
|
||||
ZIP_DIR="/home/$USER/galaxybuild-project/xxtr-zip"
|
||||
ZIP_DIR="$(pwd)/xxtr-zip"
|
||||
KERNEL_NAME="Kernel"
|
||||
DTB_NAME="Dtb"
|
||||
CUR_DIR=$PWD
|
||||
|
@ -71,10 +71,13 @@ clean() {
|
|||
}
|
||||
|
||||
patch_kernelsu() {
|
||||
printf "Enabling KernelSU (NEXT)\n"
|
||||
sed -i 's/# CONFIG_KSU is not set/CONFIG_KSU=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
sed -i 's/# CONFIG_KSU_SUSFS is not set/CONFIG_KSU_SUSFS=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
KERNEL_NAME="$KERNEL_NAME-ksu"
|
||||
printf "Enabling KernelSU (NEXT)\n"
|
||||
sed -i 's/# CONFIG_KSU is not set/CONFIG_KSU=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
sed -i 's/# CONFIG_KSU_SUSFS is not set/CONFIG_KSU_SUSFS=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
sed -i 's/# CONFIG_KPROBES is not set/CONFIG_KPROBES=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
sed -i 's/# CONFIG_KSU_SUSFS_SUS_SU is not set/CONFIG_KSU_SUSFS_SUS_SU=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
sed -i 's/# KSU_SUSFS_HAS_MAGIC_MOUNT is not set/KSU_SUSFS_HAS_MAGIC_MOUNT=y/g' "$CUR_DIR"/arch/arm64/configs/exynos9810_temp_defconfig
|
||||
KERNEL_NAME="$KERNEL_NAME-ksu"
|
||||
}
|
||||
|
||||
patch_wifi() {
|
||||
|
|
2
zip.sh
2
zip.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
printf "Zipping\n"
|
||||
ZIP_DIR="/home/$USER/galaxybuild-project/xxtr-zip"
|
||||
ZIP_DIR="$(pwd)/xxtr-zip"
|
||||
cd $ZIP_DIR
|
||||
./zip.sh
|
Loading…
Add table
Add a link
Reference in a new issue