Add KernelSU, config-variables and update the hooks

Signed-off-by: Jenna <jenna@jennalody.de>
fifteen
Jenna 1 month ago
parent c6182c5943
commit 57954ccef2
  1. 1
      KernelSU
  2. 3
      arch/arm64/configs/vendor/pixel_experience-a52q_defconfig
  3. 1
      drivers/Kconfig
  4. 2
      drivers/Makefile
  5. 4
      drivers/input/input.c
  6. 1
      drivers/kernelsu
  7. 6
      fs/exec.c
  8. 4
      fs/open.c
  9. 6
      fs/read_write.c
  10. 4
      fs/stat.c

@ -0,0 +1 @@
Subproject commit 8685fa1f603a279f70f19c4e28e7f3c4b86f76f2

@ -48,7 +48,7 @@ CONFIG_THREAD_INFO_IN_TASK=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION="-Ascendia-15.0-v4.1-A-V"
CONFIG_LOCALVERSION="-Ascendia-15.0-v4.1-A-V-ksu"
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
@ -6088,6 +6088,7 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_DEBUG_MODULE_LOAD_INFO is not set
# CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS is not set
CONFIG_KSU=y
#
# Compile-time checks and compiler options

@ -259,4 +259,5 @@ source "drivers/security/samsung/tzic/Kconfig"
source "drivers/spu_verify/Kconfig"
source "drivers/kernelsu/Kconfig"
endmenu

@ -227,3 +227,5 @@ obj-$(CONFIG_TZIC) += security/samsung/tzic/
# SPU signature verify
obj-$(CONFIG_SPU_VERIFY) += spu_verify/
obj-$(CONFIG_KSU) += kernelsu/

@ -368,16 +368,20 @@ static int input_get_disposition(struct input_dev *dev,
return disposition;
}
#ifdef CONFIG_KSU
extern bool ksu_input_hook __read_mostly;
extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);
#endif
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);
#ifdef CONFIG_KSU
if (unlikely(ksu_input_hook))
ksu_handle_input_handle_event(&type, &code, &value);
#endif
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
add_input_randomness(type, code, value);

@ -0,0 +1 @@
../KernelSU/kernel

@ -1840,11 +1840,13 @@ static int exec_binprm(struct linux_binprm *bprm)
return ret;
}
#ifdef CONFIG_KSU
extern bool ksu_execveat_hook __read_mostly;
extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
void *envp, int *flags);
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
void *argv, void *envp, int *flags);
#endif
/*
* sys_execve() executes a new program.
@ -1860,10 +1862,12 @@ static int do_execveat_common(int fd, struct filename *filename,
struct files_struct *displaced;
int retval;
if (unlikely(ksu_execveat_hook))
#ifdef CONFIG_KSU
if (unlikely(ksu_execveat_hook))
ksu_handle_execveat(&fd, &filename, &argv, &envp, &flags);
else
ksu_handle_execveat_sucompat(&fd, &filename, &argv, &envp, &flags);
#endif
if (IS_ERR(filename))
return PTR_ERR(filename);

@ -358,8 +358,10 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
return error;
}
#ifdef CONFIG_KSU
extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
int *flags);
#endif
/*
* access() needs to use the real uid/gid, not the effective uid/gid.
@ -376,7 +378,9 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
int res;
unsigned int lookup_flags = LOOKUP_FOLLOW;
#ifdef CONFIG_KSU
ksu_handle_faccessat(&dfd, &filename, &mode, NULL);
#endif
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;

@ -437,16 +437,20 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
}
EXPORT_SYMBOL(kernel_read);
#ifdef CONFIG_KSU
extern bool ksu_vfs_read_hook __read_mostly;
extern int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
size_t *count_ptr, loff_t **pos);
#endif
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
ssize_t ret;
if (unlikely(ksu_vfs_read_hook))
#ifdef CONFIG_KSU
if (unlikely(ksu_vfs_read_hook))
ksu_handle_vfs_read(&file, &buf, &count, &pos);
#endif
if (!(file->f_mode & FMODE_READ))
return -EBADF;

@ -148,7 +148,9 @@ int vfs_statx_fd(unsigned int fd, struct kstat *stat,
}
EXPORT_SYMBOL(vfs_statx_fd);
#ifdef CONFIG_KSU
extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);
#endif
/**
* vfs_statx - Get basic and extra attributes by filename
@ -172,7 +174,9 @@ int vfs_statx(int dfd, const char __user *filename, int flags,
int error = -EINVAL;
unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;
#ifdef CONFIG_KSU
ksu_handle_stat(&dfd, &filename, &flags);
#endif
if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |
AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)

Loading…
Cancel
Save