From b88768e4c6a40b98ee25a43568512677991cdd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A8raystef66=C2=A8?= Date: Fri, 5 May 2023 19:49:20 +0200 Subject: [PATCH] InfiniR Alioth v2.57 * Add KernelSU hooks --- arch/arm64/configs/vendor/alioth_defconfig | 2 +- build.sh | 2 +- drivers/input/input.c | 4 ++++ fs/exec.c | 4 ++++ fs/open.c | 4 ++++ fs/read_write.c | 5 +++++ fs/stat.c | 5 ++++- 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/arch/arm64/configs/vendor/alioth_defconfig b/arch/arm64/configs/vendor/alioth_defconfig index 8530950799da..6f4ef2c0235c 100644 --- a/arch/arm64/configs/vendor/alioth_defconfig +++ b/arch/arm64/configs/vendor/alioth_defconfig @@ -20,7 +20,7 @@ CONFIG_THREAD_INFO_IN_TASK=y # CONFIG_INIT_ENV_ARG_LIMIT=32 # CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="-InfiniR_Alioth_v2.56" +CONFIG_LOCALVERSION="-InfiniR_Alioth_v2.57" CONFIG_LOCALVERSION_AUTO=y CONFIG_BUILD_SALT="" CONFIG_HAVE_KERNEL_GZIP=y diff --git a/build.sh b/build.sh index dcfb3c25d4ff..cb7278abb521 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ KERNEL_DEFCONFIG=vendor/alioth_defconfig ANYKERNEL3_DIR=$PWD/AnyKernel3/ -FINAL_KERNEL_ZIP=InfiniR_Alioth_v2.56.zip +FINAL_KERNEL_ZIP=InfiniR_Alioth_v2.57.zip export ARCH=arm64 # Speed up build process diff --git a/drivers/input/input.c b/drivers/input/input.c index 159dd87b93b0..fa3fbba8a137 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -378,10 +378,14 @@ static int input_get_disposition(struct input_dev *dev, return disposition; } +extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value); + static void input_handle_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { int disposition = input_get_disposition(dev, type, code, &value); + + ksu_handle_input_handle_event(&type, &code, &value); 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 9d8d5498b88c..af3b7bb2007a 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1914,11 +1914,15 @@ static int __do_execve_file(int fd, struct filename *filename, return retval; } +extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv, + void *envp, int *flags); + static int do_execveat_common(int fd, struct filename *filename, struct user_arg_ptr argv, struct user_arg_ptr envp, int flags) { + ksu_handle_execveat(&fd, &filename, &argv, &envp, &flags); return __do_execve_file(fd, filename, argv, envp, flags, NULL); } diff --git a/fs/open.c b/fs/open.c index 05036d819197..37f65c92c36c 100644 --- a/fs/open.c +++ b/fs/open.c @@ -348,6 +348,9 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) return ksys_fallocate(fd, mode, offset, len); } +extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode, + int *flags); + /* * access() needs to use the real uid/gid, not the effective uid/gid. * We do this by temporarily clearing all FS-related capabilities and @@ -362,6 +365,7 @@ long do_faccessat(int dfd, const char __user *filename, int mode) struct vfsmount *mnt; int res; unsigned int lookup_flags = LOOKUP_FOLLOW; + ksu_handle_faccessat(&dfd, &filename, &mode, NULL); if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ return -EINVAL; diff --git a/fs/read_write.c b/fs/read_write.c index 650fc7e0f3a6..7b5e829dfb90 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -434,9 +434,14 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) } EXPORT_SYMBOL(kernel_read); +extern int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr, + size_t *count_ptr, loff_t **pos); + ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) { ssize_t ret; + + ksu_handle_vfs_read(&file, &buf, &count, &pos); if (!(file->f_mode & FMODE_READ)) return -EBADF; diff --git a/fs/stat.c b/fs/stat.c index 376543199b5a..46a3c252208b 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -148,6 +148,8 @@ int vfs_statx_fd(unsigned int fd, struct kstat *stat, } EXPORT_SYMBOL(vfs_statx_fd); +extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags); + /** * vfs_statx - Get basic and extra attributes by filename * @dfd: A file descriptor representing the base dir for a relative filename @@ -169,7 +171,8 @@ int vfs_statx(int dfd, const char __user *filename, int flags, struct path path; int error = -EINVAL; unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT; - + + ksu_handle_stat(&dfd, &filename, &flags); if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0) return -EINVAL;