Skip to content

Commit

Permalink
the last su bender
Browse files Browse the repository at this point in the history
Signed-off-by: fukiame <fukiame@proton.me>
  • Loading branch information
fukiame committed Aug 1, 2024
1 parent 52fb96a commit 357be23
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 33 deletions.
9 changes: 3 additions & 6 deletions ksu/patches/4.14/0001-fs-exec-add-ksu-execveat-hook.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] fs/exec: add ksu execveat hook


diff --git a/fs/exec.c b/fs/exec.c
index ae0a49517ba9..5b69af79cf06 100644
index 5d5e417c2fa4..93ce05cca024 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1706,6 +1706,12 @@ static int exec_binprm(struct linux_binprm *bprm)
@@ -1707,6 +1707,12 @@ static int exec_binprm(struct linux_binprm *bprm)
return ret;
}

Expand All @@ -21,7 +21,7 @@ index ae0a49517ba9..5b69af79cf06 100644
/*
* sys_execve() executes a new program.
*/
@@ -1714,6 +1720,11 @@ static int do_execveat_common(int fd, struct filename *filename,
@@ -1715,6 +1721,11 @@ static int do_execveat_common(int fd, struct filename *filename,
struct user_arg_ptr envp,
int flags)
{
Expand All @@ -33,6 +33,3 @@ index ae0a49517ba9..5b69af79cf06 100644
char *pathbuf = NULL;
struct linux_binprm *bprm;
struct file *file;
--
2.45.0

3 changes: 0 additions & 3 deletions ksu/patches/4.14/0002-fs-open-add-ksu-faccessat-hook.patch
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@ index 3b62683fe332..741ee091747e 100644
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;

--
2.45.0

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ index 0da6e4f19d7f..a05e05302930 100644
ssize_t ret;

if (!(file->f_mode & FMODE_READ))
--
2.45.0

3 changes: 0 additions & 3 deletions ksu/patches/4.14/0004-fs-stat-add-ksu-vfs_statx-hook.patch
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ index 0fda4b6b8fb2..5e3aef49c291 100644
if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |
AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)
return -EINVAL;
--
2.45.0

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ index f9f3d6261dc5..bd0e39332f55 100644
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
add_input_randomness(type, code, value);

--
2.45.0

9 changes: 3 additions & 6 deletions ksu/patches/4.14/0006-treewide-Guard-KernelSU-s-hooks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ index bd0e39332f55..b81959837942 100644
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
add_input_randomness(type, code, value);
diff --git a/fs/exec.c b/fs/exec.c
index 5b69af79cf06..e07614a594a4 100644
index 93ce05cca024..cccfd271c400 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1706,11 +1706,13 @@ static int exec_binprm(struct linux_binprm *bprm)
@@ -1707,11 +1707,13 @@ static int exec_binprm(struct linux_binprm *bprm)
return ret;
}

Expand All @@ -51,7 +51,7 @@ index 5b69af79cf06..e07614a594a4 100644

/*
* sys_execve() executes a new program.
@@ -1720,10 +1722,13 @@ static int do_execveat_common(int fd, struct filename *filename,
@@ -1721,10 +1723,13 @@ static int do_execveat_common(int fd, struct filename *filename,
struct user_arg_ptr envp,
int flags)
{
Expand Down Expand Up @@ -137,6 +137,3 @@ index 5e3aef49c291..7c4954e64adb 100644

if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |
AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)
--
2.45.0

Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,3 @@ index 000000000000..7781685c9c30
+int is_suspicious_mount(struct vfsmount* const mnt, const struct path* const root);
+int suspicious_path(const struct filename* const name);
+#endif
--
2.45.0

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ index dbbc5fff7177..b0906fdb762e 100644
};

static uid_t getuid(void) {
--
2.45.0

Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,3 @@ index e7789907481a..c2e0dfaccdbc 100644

retval = security_inode_getattr(path);
if (retval)
--
2.45.0

31 changes: 31 additions & 0 deletions ksu/patches/4.14/0010-fs-devpts-inode-add-ksu-handle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: fukiame <fukiame@proton.me>
Date: Thu, 1 Aug 2024 18:08:20 +0700
Subject: [PATCH] fs/devpts: inode: add ksu handle


diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 32f6f1c683d9..1cf42cbc4f00 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -602,6 +602,10 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
return dentry;
}

+#ifdef CONFIG_KSU
+extern int ksu_handle_devpts(struct inode*);
+#endif /* CONFIG_KSU */
+
/**
* devpts_get_priv -- get private data for a slave
* @pts_inode: inode of the slave
@@ -610,6 +614,9 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
*/
void *devpts_get_priv(struct dentry *dentry)
{
+#ifdef CONFIG_KSU
+ ksu_handle_devpts(dentry->d_inode);
+#endif /* CONFIG_KSU */
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
return NULL;
return dentry->d_fsdata;

0 comments on commit 357be23

Please sign in to comment.