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