Skip to content

Commit f5bd1a7

Browse files
committed
update susfs v1.5.5
1 parent 4a84bbd commit f5bd1a7

File tree

30 files changed

+674
-394
lines changed

30 files changed

+674
-394
lines changed

.github/workflows/build_usu_kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Add KernelSU setup.sh
3939
run: |
4040
cd kernel-source
41-
curl -sSL https://raw.githubusercontent.com/itejo443/KernelSU/mksu-susfs/kernel/setup.sh | bash
41+
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next-susfs/kernel/setup.sh" | bash -s next-susfs
4242
4343
- name: Setup submodules
4444
working-directory: kernel-source

arch/arm64/configs/vendor/m23xq_eur_open_defconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,10 @@ CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
614614
#
615615
# General architecture-dependent options
616616
#
617-
CONFIG_KPROBES=y
618617
CONFIG_JUMP_LABEL=y
619618
CONFIG_UPROBES=y
620619
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
621620
CONFIG_HAVE_KPROBES=y
622-
CONFIG_KPROBE_EVENTS=y
623621
CONFIG_HAVE_KRETPROBES=y
624622
CONFIG_HAVE_NMI=y
625623
CONFIG_HAVE_ARCH_TRACEHOOK=y
@@ -6660,6 +6658,9 @@ CONFIG_DISPLAY_SAMSUNG=y
66606658
CONFIG_KSU=y
66616659
CONFIG_KSU_DEBUG=y
66626660
CONFIG_KSU_SUSFS=y
6661+
CONFIG_KPROBES=y
6662+
CONFIG_KSU_WITH_KPROBES=y
6663+
CONFIG_KPROBE_EVENTS=y
66636664
# SUSFS configurations
66646665
CONFIG_KSU_SUSFS_SUS_PATH=y
66656666
CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y
@@ -6673,7 +6674,6 @@ CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y
66736674
CONFIG_KSU_SUSFS_SPOOF_UNAME=y
66746675
CONFIG_KSU_SUSFS_ENABLE_LOG=y
66756676
CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y
6676-
CONFIG_KSU_SUSFS_SPOOF_PROC_CMDLINE=y
6677+
CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y
66776678
CONFIG_KSU_SUSFS_OPEN_REDIRECT=y
6678-
CONFIG_KSU_SUSFS_SUS_SU=y
6679-
6679+
CONFIG_KSU_SUSFS_SUS_SU=n

drivers/input/input.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,10 @@ static int input_get_disposition(struct input_dev *dev,
366366
return disposition;
367367
}
368368

369-
#ifdef CONFIG_KSU_SUSFS_SUS_SU
370-
extern bool susfs_is_sus_su_hooks_enabled __read_mostly;
371-
extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);
372-
#endif
373-
374369
static void input_handle_event(struct input_dev *dev,
375370
unsigned int type, unsigned int code, int value)
376371
{
377372
int disposition = input_get_disposition(dev, type, code, &value);
378-
#ifdef CONFIG_KSU_SUSFS_SUS_SU
379-
if (unlikely(susfs_is_sus_su_hooks_enabled))
380-
ksu_handle_input_handle_event(&type, &code, &value);
381-
#endif
382373

383374
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
384375
add_input_randomness(type, code, value);

fs/dcache.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include <linux/bit_spinlock.h>
3232
#include <linux/rculist_bl.h>
3333
#include <linux/list_lru.h>
34+
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
35+
#include <linux/susfs_def.h>
36+
#endif
3437
#include "internal.h"
3538
#include "mount.h"
3639
#ifdef CONFIG_KDP_NS
@@ -2193,7 +2196,7 @@ struct dentry *__d_lookup_rcu(const struct dentry *parent,
21932196
if (dentry_cmp(dentry, str, hashlen_len(hashlen)) != 0)
21942197
continue;
21952198
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
2196-
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
2199+
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
21972200
continue;
21982201
}
21992202
#endif
@@ -2281,7 +2284,7 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name)
22812284
continue;
22822285

22832286
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
2284-
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
2287+
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
22852288
continue;
22862289
}
22872290
#endif

fs/devpts/inode.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,6 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
599599
return dentry;
600600
}
601601

602-
#if defined(CONFIG_KSU_SUSFS_SUS_SU) && !defined(CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT)
603-
extern bool ksu_devpts_hook;
604-
extern int ksu_handle_devpts(struct inode*);
605-
#endif
606-
607602
/**
608603
* devpts_get_priv -- get private data for a slave
609604
* @pts_inode: inode of the slave
@@ -612,11 +607,6 @@ extern int ksu_handle_devpts(struct inode*);
612607
*/
613608
void *devpts_get_priv(struct dentry *dentry)
614609
{
615-
#if defined(CONFIG_KSU_SUSFS_SUS_SU) && !defined(CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT)
616-
if (likely(ksu_devpts_hook)) {
617-
ksu_handle_devpts(dentry->d_inode);
618-
}
619-
#endif
620610
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
621611
return NULL;
622612
return dentry->d_fsdata;

fs/exec.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,25 +1902,11 @@ static int __do_execve_file(int fd, struct filename *filename,
19021902
return retval;
19031903
}
19041904

1905-
#ifdef CONFIG_KSU_SUSFS_SUS_SU
1906-
extern bool susfs_is_sus_su_hooks_enabled;
1907-
extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
1908-
void *envp, int *flags);
1909-
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
1910-
void *argv, void *envp, int *flags);
1911-
#endif
1912-
19131905
static int do_execveat_common(int fd, struct filename *filename,
19141906
struct user_arg_ptr argv,
19151907
struct user_arg_ptr envp,
19161908
int flags)
19171909
{
1918-
#ifdef CONFIG_KSU_SUSFS_SUS_SU
1919-
if (susfs_is_sus_su_hooks_enabled)
1920-
ksu_handle_execveat(&fd, &filename, &argv, &envp, &flags);
1921-
else
1922-
ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags);
1923-
#endif
19241910
return __do_execve_file(fd, filename, argv, envp, flags, NULL);
19251911
}
19261912

@@ -1932,6 +1918,15 @@ int do_execve_file(struct file *file, void *__argv, void *__envp)
19321918
return __do_execve_file(AT_FDCWD, NULL, argv, envp, 0, file);
19331919
}
19341920

1921+
1922+
#ifdef CONFIG_KSU
1923+
extern bool ksu_execveat_hook __read_mostly;
1924+
extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
1925+
void *envp, int *flags);
1926+
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
1927+
void *argv, void *envp, int *flags);
1928+
#endif
1929+
19351930
int do_execve(struct filename *filename,
19361931
const char __user *const __user *__argv,
19371932
const char __user *const __user *__envp)

fs/inode.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include <trace/events/writeback.h>
2424
#include "internal.h"
2525

26-
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
27-
extern bool susfs_is_current_ksu_domain(void);
28-
#endif
29-
3026
/*
3127
* Inode locking rules:
3228
*
@@ -1647,11 +1643,6 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
16471643
int iflags = I_DIRTY_TIME;
16481644
bool dirty = false;
16491645

1650-
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
1651-
if (susfs_is_current_ksu_domain()) {
1652-
return 0;
1653-
}
1654-
#endif
16551646
if (flags & S_ATIME)
16561647
inode->i_atime = *time;
16571648
if (flags & S_VERSION)
@@ -1679,12 +1670,6 @@ static int update_time(struct inode *inode, struct timespec64 *time, int flags)
16791670
{
16801671
int (*update_time)(struct inode *, struct timespec64 *, int);
16811672

1682-
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
1683-
if (susfs_is_current_ksu_domain()) {
1684-
return 0;
1685-
}
1686-
#endif
1687-
16881673
update_time = inode->i_op->update_time ? inode->i_op->update_time :
16891674
generic_update_time;
16901675

@@ -1741,12 +1726,6 @@ void touch_atime(const struct path *path)
17411726
struct inode *inode = d_inode(path->dentry);
17421727
struct timespec64 now;
17431728

1744-
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
1745-
if (susfs_is_current_ksu_domain()) {
1746-
return;
1747-
}
1748-
#endif
1749-
17501729
if (!atime_needs_update(path, inode))
17511730
return;
17521731

fs/namei.c

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
#include <linux/uaccess.h>
4242
#include <linux/build_bug.h>
4343

44+
#if defined(CONFIG_KSU_SUSFS_SUS_PATH) || defined(CONFIG_KSU_SUSFS_OPEN_REDIRECT)
45+
#include <linux/susfs_def.h>
46+
#endif
47+
4448
#ifdef CONFIG_FSCRYPT_SDP
4549
#include <linux/fscrypto_sdp_name.h>
4650
#endif
@@ -1010,7 +1014,7 @@ static inline int may_follow_link(struct nameidata *nd)
10101014
kuid_t puid;
10111015

10121016
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1013-
if (nd->inode && unlikely(nd->inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
1017+
if (nd->inode && unlikely(nd->inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
10141018
return -ENOENT;
10151019
}
10161020
#endif
@@ -1093,7 +1097,7 @@ static int may_linkat(struct path *link)
10931097
struct inode *inode = link->dentry->d_inode;
10941098

10951099
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1096-
if (link->dentry->d_inode && unlikely(link->dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
1100+
if (link->dentry->d_inode && unlikely(link->dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
10971101
return -ENOENT;
10981102
}
10991103
#endif
@@ -1140,7 +1144,7 @@ static int may_create_in_sticky(umode_t dir_mode, kuid_t dir_uid,
11401144
struct inode * const inode)
11411145
{
11421146
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1143-
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
1147+
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
11441148
return -ENOENT;
11451149
}
11461150
#endif
@@ -1674,9 +1678,6 @@ static struct dentry *__lookup_hash(const struct qstr *name,
16741678
struct dentry *dentry = lookup_dcache(name, base, flags);
16751679
struct dentry *old;
16761680
struct inode *dir = base->d_inode;
1677-
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1678-
int error;
1679-
#endif
16801681

16811682
if (dentry)
16821683
return dentry;
@@ -1695,14 +1696,7 @@ static struct dentry *__lookup_hash(const struct qstr *name,
16951696
dentry = old;
16961697
}
16971698
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1698-
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
1699-
if ((flags & (LOOKUP_CREATE | LOOKUP_EXCL))) {
1700-
error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
1701-
if (error) {
1702-
dput(dentry);
1703-
return ERR_PTR(error);
1704-
}
1705-
}
1699+
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
17061700
dput(dentry);
17071701
return ERR_PTR(-ENOENT);
17081702
}
@@ -1835,7 +1829,7 @@ static struct dentry *__lookup_slow(const struct qstr *name,
18351829
}
18361830
}
18371831
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
1838-
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
1832+
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
18391833
dput(dentry);
18401834
return ERR_PTR(-ENOENT);
18411835
}
@@ -2332,7 +2326,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
23322326
}
23332327
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
23342328
// we deal with sus sub path here
2335-
if (nd->inode && unlikely(nd->inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
2329+
if (nd->inode && unlikely(nd->inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
23362330
return 0;
23372331
}
23382332
#endif
@@ -2526,7 +2520,7 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags,
25262520
audit_inode(name, path->dentry, flags & LOOKUP_PARENT);
25272521
restore_nameidata();
25282522
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
2529-
if (!retval && path->dentry->d_inode && unlikely(path->dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
2523+
if (!retval && path->dentry->d_inode && unlikely(path->dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
25302524
putname(name);
25312525
return -ENOENT;
25322526
}
@@ -2993,7 +2987,7 @@ static int may_delete(struct vfsmount *mnt, struct inode *dir, struct dentry *vi
29932987
if (IS_APPEND(dir))
29942988
return -EPERM;
29952989
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
2996-
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
2990+
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
29972991
return -ENOENT;
29982992
}
29992993
#endif
@@ -3032,7 +3026,7 @@ static inline int may_create(struct vfsmount *mnt, struct inode *dir, struct den
30323026
struct user_namespace *s_user_ns;
30333027
audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE);
30343028
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
3035-
if (child->d_inode && unlikely(child->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3029+
if (child->d_inode && unlikely(child->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
30363030
error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
30373031
if (error) {
30383032
return error;
@@ -3170,7 +3164,7 @@ static int may_open(const struct path *path, int acc_mode, int flag)
31703164
return -ENOENT;
31713165

31723166
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
3173-
if (unlikely(inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3167+
if (unlikely(inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
31743168
return -ENOENT;
31753169
}
31763170
#endif
@@ -3249,7 +3243,7 @@ static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t m
32493243
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
32503244
int error;
32513245

3252-
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3246+
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
32533247
error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC);
32543248
if (error) {
32553249
return error;
@@ -3399,7 +3393,7 @@ static int lookup_open(struct nameidata *nd, struct path *path,
33993393
if (dentry->d_inode) {
34003394
/* Cached positive dentry: will open in f_op->open */
34013395
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
3402-
if (unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3396+
if (unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
34033397
dput(dentry);
34043398
return -ENOENT;
34053399
}
@@ -3448,7 +3442,7 @@ static int lookup_open(struct nameidata *nd, struct path *path,
34483442
if (unlikely(error == -ENOENT) && create_error)
34493443
error = create_error;
34503444
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
3451-
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3445+
if (!IS_ERR(dentry) && dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
34523446
if (create_error) {
34533447
dput(dentry);
34543448
return create_error;
@@ -3473,7 +3467,7 @@ static int lookup_open(struct nameidata *nd, struct path *path,
34733467
dput(dentry);
34743468
dentry = res;
34753469
#ifdef CONFIG_KSU_SUSFS_SUS_PATH
3476-
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & 16777216) && likely(current_cred()->user->android_kabi_reserved2 & 16777216)) {
3470+
if (dentry->d_inode && unlikely(dentry->d_inode->i_state & INODE_STATE_SUS_PATH) && likely(current->susfs_task_state & TASK_STRUCT_NON_ROOT_USER_APP_PROC)) {
34773471
dput(dentry);
34783472
return -ENOENT;
34793473
}
@@ -3835,7 +3829,7 @@ struct file *do_filp_open(int dfd, struct filename *pathname,
38353829
if (unlikely(filp == ERR_PTR(-ESTALE)))
38363830
filp = path_openat(&nd, op, flags | LOOKUP_REVAL);
38373831
#ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT
3838-
if (!IS_ERR(filp) && unlikely(filp->f_inode->i_state & 134217728) && current_uid().val < 2000) {
3832+
if (!IS_ERR(filp) && unlikely(filp->f_inode->i_state & INODE_STATE_OPEN_REDIRECT) && current_uid().val < 2000) {
38393833
fake_pathname = susfs_get_redirected_path(filp->f_inode->i_ino);
38403834
if (!IS_ERR(fake_pathname)) {
38413835
restore_nameidata();

0 commit comments

Comments
 (0)