kernel: Replace ksu_access_ok with macro
Signed-off-by: rsuntk <rissu.ntk@gmail.com>
This commit is contained in:
@@ -179,12 +179,3 @@ long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ksu_access_ok(const void *addr, unsigned long size)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
|
||||
return access_ok(addr, size);
|
||||
#else
|
||||
return access_ok(VERIFY_READ, addr, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -64,5 +64,11 @@ extern ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count,
|
||||
loff_t *pos);
|
||||
extern ssize_t ksu_kernel_write_compat(struct file *p, const void *buf,
|
||||
size_t count, loff_t *pos);
|
||||
extern int ksu_access_ok(const void *addr, unsigned long size);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
|
||||
#define ksu_access_ok(addr, size) (access_ok(addr, size))
|
||||
#else
|
||||
#define ksu_access_ok(addr, size) (access_ok(VERIFY_READ, addr, size))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
|
||||
* some cpus dont really have that good speculative execution
|
||||
* access_ok to substitute set_fs, we check if pointer is accessible
|
||||
*/
|
||||
if (!ksu_access_ok((const void *)filename_user, sizeof(path)))
|
||||
if (!ksu_access_ok(*filename_user, sizeof(path)))
|
||||
return 0;
|
||||
|
||||
// success = returns number of bytes and should be less than path
|
||||
|
||||
Reference in New Issue
Block a user