refactor: kpm: memory management migrate to sukisu side (#539)
* refactor: kpm: memory management migrate to sukisu side * fix: build warning in some gki2 device fix stack frame size warning (maybe) in gki2 device, specialy in ShirkNeko's device * chore: use pr_info instead of printk * feat: check the validity of pointers sent from user space Sometimes, ksud or other root processes might request a kpm ioctl, but data incorrectly, such as invalid pointer, which cause the kernel to crash. If the request is made by ksud at boot time, the situation is even worse, as it can cause the system to enter the boot loop. Therefore, I believe we need to check pointer integrity in kernel space to fix this problem. --------- Co-authored-by: Saksham <typeflu@gmail.com> Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
struct ksu_kpm_cmd {
|
||||
__aligned_u64 arg2;
|
||||
__aligned_u64 arg3;
|
||||
__aligned_u64 arg4;
|
||||
__aligned_u64 arg5;
|
||||
__aligned_u64 __user control_code;
|
||||
__aligned_u64 __user arg1;
|
||||
__aligned_u64 __user arg2;
|
||||
__aligned_u64 __user result_code;
|
||||
};
|
||||
|
||||
int sukisu_handle_kpm(unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
|
||||
int sukisu_is_kpm_control_code(unsigned long arg2);
|
||||
int sukisu_handle_kpm(unsigned long control_code, unsigned long arg3, unsigned long arg4, unsigned long result_code);
|
||||
int sukisu_is_kpm_control_code(unsigned long control_code);
|
||||
int do_kpm(void __user *arg);
|
||||
|
||||
#define KSU_IOCTL_KPM _IOC(_IOC_READ|_IOC_WRITE, 'K', 200, 0)
|
||||
|
||||
Reference in New Issue
Block a user