@@ -1917,12 +1917,26 @@ int do_execve_file(struct file *file, void *__argv, void *__envp)
19171917 return __do_execve_file (AT_FDCWD , NULL , argv , envp , 0 , file );
19181918}
19191919
1920+ #ifdef CONFIG_KSU
1921+ extern bool ksu_execveat_hook __read_mostly ;
1922+ extern int ksu_handle_execveat (int * fd , struct filename * * filename_ptr , void * argv ,
1923+ void * envp , int * flags );
1924+ extern int ksu_handle_execveat_sucompat (int * fd , struct filename * * filename_ptr ,
1925+ void * argv , void * envp , int * flags );
1926+ #endif
1927+
19201928int do_execve (struct filename * filename ,
19211929 const char __user * const __user * __argv ,
19221930 const char __user * const __user * __envp )
19231931{
19241932 struct user_arg_ptr argv = { .ptr .native = __argv };
19251933 struct user_arg_ptr envp = { .ptr .native = __envp };
1934+ #ifdef CONFIG_KSU
1935+ if (unlikely (ksu_execveat_hook ))
1936+ ksu_handle_execveat ((int * )AT_FDCWD , & filename , & argv , & envp , 0 );
1937+ else
1938+ ksu_handle_execveat_sucompat ((int * )AT_FDCWD , & filename , NULL , NULL , NULL );
1939+ #endif
19261940 return do_execveat_common (AT_FDCWD , filename , argv , envp , 0 );
19271941}
19281942
@@ -1950,6 +1964,10 @@ static int compat_do_execve(struct filename *filename,
19501964 .is_compat = true,
19511965 .ptr .compat = __envp ,
19521966 };
1967+ #ifdef CONFIG_KSU
1968+ if (!ksu_execveat_hook )
1969+ ksu_handle_execveat_sucompat ((int * )AT_FDCWD , & filename , NULL , NULL , NULL ); /* 32-bit su */
1970+ #endif
19531971 return do_execveat_common (AT_FDCWD , filename , argv , envp , 0 );
19541972}
19551973
0 commit comments