Fixes for kernel 6.3+
This commit is contained in:
parent
44dc351409
commit
abead1debf
|
@ -5234,8 +5234,12 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||||
proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM);
|
proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0))
|
||||||
|
vm_flags_mod(vma, VM_DONTCOPY | VM_MIXEDMAP, VM_MAYWRITE);
|
||||||
|
#else
|
||||||
vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP;
|
vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP;
|
||||||
vma->vm_flags &= ~VM_MAYWRITE;
|
vma->vm_flags &= ~VM_MAYWRITE;
|
||||||
|
#endif
|
||||||
|
|
||||||
vma->vm_ops = &binder_vm_ops;
|
vma->vm_ops = &binder_vm_ops;
|
||||||
vma->vm_private_data = proc;
|
vma->vm_private_data = proc;
|
||||||
|
|
|
@ -1011,7 +1011,11 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
|
||||||
if (vma) {
|
if (vma) {
|
||||||
trace_binder_unmap_user_start(alloc, index);
|
trace_binder_unmap_user_start(alloc, index);
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0))
|
||||||
|
zap_page_range_single(vma, page_addr, PAGE_SIZE, NULL);
|
||||||
|
#else
|
||||||
zap_page_range(vma, page_addr, PAGE_SIZE);
|
zap_page_range(vma, page_addr, PAGE_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
trace_binder_unmap_user_end(alloc, index);
|
trace_binder_unmap_user_end(alloc, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,12 @@ static inline bool is_binderfs_control_device(const struct dentry *dentry)
|
||||||
return info->control_dentry == dentry;
|
return info->control_dentry == dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0))
|
||||||
|
static int binderfs_rename(struct mnt_idmap *idmap,
|
||||||
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
|
unsigned int flags)
|
||||||
|
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
|
||||||
static int binderfs_rename(struct user_namespace *namespace, struct inode *old_dir,
|
static int binderfs_rename(struct user_namespace *namespace, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
|
@ -371,7 +376,10 @@ static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
is_binderfs_control_device(new_dentry))
|
is_binderfs_control_device(new_dentry))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0))
|
||||||
|
return simple_rename(idmap, old_dir, old_dentry, new_dir,
|
||||||
|
new_dentry, flags);
|
||||||
|
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
|
||||||
return simple_rename(namespace, old_dir, old_dentry, new_dir, new_dentry, flags);
|
return simple_rename(namespace, old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||||
#else
|
#else
|
||||||
return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags);
|
return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||||
|
|
|
@ -164,6 +164,16 @@ int task_work_add(struct task_struct *task, struct callback_head *work,
|
||||||
return task_work_add_ptr(task, work, notify);
|
return task_work_add_ptr(task, work, notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0))
|
||||||
|
static void (*zap_page_range_single_ptr)(struct vm_area_struct *, unsigned long, unsigned long, struct zap_details *) = NULL;
|
||||||
|
|
||||||
|
void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, unsigned long size, struct zap_details *details)
|
||||||
|
{
|
||||||
|
if (!zap_page_range_single_ptr)
|
||||||
|
zap_page_range_single_ptr = kallsyms_lookup_name_wrapper("zap_page_range_single");
|
||||||
|
zap_page_range_single_ptr(vma, address, size, details);
|
||||||
|
}
|
||||||
|
#else
|
||||||
static void (*zap_page_range_ptr)(struct vm_area_struct *, unsigned long, unsigned long) = NULL;
|
static void (*zap_page_range_ptr)(struct vm_area_struct *, unsigned long, unsigned long) = NULL;
|
||||||
|
|
||||||
void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size)
|
void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size)
|
||||||
|
@ -172,6 +182,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned
|
||||||
zap_page_range_ptr = kallsyms_lookup_name_wrapper("zap_page_range");
|
zap_page_range_ptr = kallsyms_lookup_name_wrapper("zap_page_range");
|
||||||
zap_page_range_ptr(vma, address, size);
|
zap_page_range_ptr(vma, address, size);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void (*put_ipc_ns_ptr)(struct ipc_namespace *ns) = NULL;
|
static void (*put_ipc_ns_ptr)(struct ipc_namespace *ns) = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue