kernel: Resolving the issue of unavailable functionality
This commit is contained in:
@@ -205,8 +205,6 @@ static const char sh_path[] = SH_PATH;
|
||||
static const char su_path[] = SU_PATH;
|
||||
static const char ksud_path[] = KSUD_PATH;
|
||||
|
||||
extern bool ksu_kernel_umount_enabled;
|
||||
|
||||
// the call from execve_handler_pre won't provided correct value for __never_use_argument, use them after fix execve_handler_pre, keeping them for consistence for manually patched code
|
||||
int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
||||
void *__never_use_argv, void *__never_use_envp,
|
||||
@@ -214,6 +212,10 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
||||
{
|
||||
struct filename *filename;
|
||||
|
||||
if (!ksu_su_compat_enabled){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (unlikely(!filename_ptr))
|
||||
return 0;
|
||||
|
||||
@@ -236,6 +238,10 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
||||
int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
|
||||
void *envp, int *flags)
|
||||
{
|
||||
if (!ksu_su_compat_enabled){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ksu_handle_execveat_ksud(fd, filename_ptr, argv, envp, flags)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -248,6 +254,10 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
|
||||
{
|
||||
char path[sizeof(su_path) + 1] = {0};
|
||||
|
||||
if (!ksu_su_compat_enabled){
|
||||
return 0;
|
||||
}
|
||||
|
||||
strncpy_from_user_nofault(path, *filename_user, sizeof(path));
|
||||
|
||||
if (unlikely(!memcmp(path, su_path, sizeof(su_path)))) {
|
||||
@@ -277,6 +287,10 @@ int ksu_handle_stat(int *dfd, struct filename **filename, int *flags) {
|
||||
#else
|
||||
int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
|
||||
{
|
||||
if (!ksu_su_compat_enabled){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (unlikely(!filename_user)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -313,27 +327,31 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
|
||||
|
||||
int ksu_handle_devpts(struct inode *inode)
|
||||
{
|
||||
if (!current->mm) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t uid = current_uid().val;
|
||||
if (uid % 100000 < 10000) {
|
||||
// not untrusted_app, ignore it
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!__ksu_is_allow_uid_for_current(uid))
|
||||
return 0;
|
||||
|
||||
if (ksu_file_sid) {
|
||||
struct inode_security_struct *sec = selinux_inode(inode);
|
||||
if (sec) {
|
||||
sec->sid = ksu_file_sid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!current->mm) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ksu_su_compat_enabled){
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t uid = current_uid().val;
|
||||
if (uid % 100000 < 10000) {
|
||||
// not untrusted_app, ignore it
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!__ksu_is_allow_uid_for_current(uid))
|
||||
return 0;
|
||||
|
||||
if (ksu_file_sid) {
|
||||
struct inode_security_struct *sec = selinux_inode(inode);
|
||||
if (sec) {
|
||||
sec->sid = ksu_file_sid;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // #ifndef CONFIG_KSU_SUSFS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user