kernel: increase reliability, add ksu_access_ok to simplify

Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
rsuntk
2025-07-22 22:31:58 +07:00
committed by ShirkNeko
parent 39811e311f
commit 0c87765958
4 changed files with 18 additions and 9 deletions

View File

@@ -155,13 +155,9 @@ 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 LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
if (!access_ok(VERIFY_READ, *filename_user, sizeof(path)))
if (!ksu_access_ok((const void *)filename_user, sizeof(path)))
return 0;
#else
if (!access_ok(*filename_user, sizeof(path)))
return 0;
#endif
// success = returns number of bytes and should be less than path
long len = strncpy_from_user(path, *filename_user, sizeof(path));
if (len <= 0)