mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Change-Id: I44b83e6726ce5ee6637421456314bf1f2af567f0 Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
99 lines
2.4 KiB
C
99 lines
2.4 KiB
C
#include <linux/export.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/kobject.h>
|
|
#include <linux/module.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include "allowlist.h"
|
|
#include "arch.h"
|
|
#include "core_hook.h"
|
|
#include "klog.h" // IWYU pragma: keep
|
|
#include "ksu.h"
|
|
#include "throne_tracker.h"
|
|
|
|
static struct workqueue_struct *ksu_workqueue;
|
|
|
|
bool ksu_queue_work(struct work_struct *work)
|
|
{
|
|
return queue_work(ksu_workqueue, work);
|
|
}
|
|
|
|
extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
|
void *argv, void *envp, int *flags);
|
|
|
|
extern int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr,
|
|
void *argv, void *envp, int *flags);
|
|
|
|
int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
|
|
void *envp, int *flags)
|
|
{
|
|
ksu_handle_execveat_ksud(fd, filename_ptr, argv, envp, flags);
|
|
return ksu_handle_execveat_sucompat(fd, filename_ptr, argv, envp,
|
|
flags);
|
|
}
|
|
|
|
extern void ksu_sucompat_init();
|
|
extern void ksu_sucompat_exit();
|
|
extern void ksu_ksud_init();
|
|
extern void ksu_ksud_exit();
|
|
|
|
int __init kernelsu_init(void)
|
|
{
|
|
#ifdef CONFIG_KSU_DEBUG
|
|
pr_alert("*************************************************************");
|
|
pr_alert("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **");
|
|
pr_alert("** **");
|
|
pr_alert("** You are running KernelSU in DEBUG mode **");
|
|
pr_alert("** **");
|
|
pr_alert("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **");
|
|
pr_alert("*************************************************************");
|
|
#endif
|
|
|
|
ksu_core_init();
|
|
|
|
ksu_workqueue = alloc_ordered_workqueue("kernelsu_work_queue", 0);
|
|
|
|
ksu_allowlist_init();
|
|
|
|
ksu_throne_tracker_init();
|
|
|
|
#ifdef CONFIG_KPROBES
|
|
ksu_sucompat_init();
|
|
ksu_ksud_init();
|
|
#endif
|
|
|
|
#ifdef MODULE
|
|
#ifndef CONFIG_KSU_DEBUG
|
|
kobject_del(&THIS_MODULE->mkobj.kobj);
|
|
#endif
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
void kernelsu_exit(void)
|
|
{
|
|
ksu_allowlist_exit();
|
|
|
|
ksu_throne_tracker_exit();
|
|
|
|
destroy_workqueue(ksu_workqueue);
|
|
|
|
#ifdef CONFIG_KPROBES
|
|
ksu_ksud_exit();
|
|
ksu_sucompat_exit();
|
|
#endif
|
|
|
|
ksu_core_exit();
|
|
}
|
|
|
|
module_init(kernelsu_init);
|
|
module_exit(kernelsu_exit);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("weishu");
|
|
MODULE_DESCRIPTION("Android KernelSU");
|
|
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
|
|
MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
|
|
#endif
|