Compile fixes for kernels 5.11, 5.12 & 5.13
This commit is contained in:
parent
0338a34979
commit
516144c6a0
|
@ -66,6 +66,7 @@
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/task_work.h>
|
#include <linux/task_work.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
#include <uapi/linux/android/binder.h>
|
#include <uapi/linux/android/binder.h>
|
||||||
#include <uapi/linux/android/binderfs.h>
|
#include <uapi/linux/android/binderfs.h>
|
||||||
|
@ -2225,7 +2226,11 @@ static void binder_deferred_fd_close(int fd)
|
||||||
if (!twcb)
|
if (!twcb)
|
||||||
return;
|
return;
|
||||||
init_task_work(&twcb->twork, binder_do_fd_close);
|
init_task_work(&twcb->twork, binder_do_fd_close);
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
|
||||||
|
close_fd_get_file(fd, &twcb->file);
|
||||||
|
#else
|
||||||
__close_fd_get_file(fd, &twcb->file);
|
__close_fd_get_file(fd, &twcb->file);
|
||||||
|
#endif
|
||||||
if (twcb->file) {
|
if (twcb->file) {
|
||||||
filp_close(twcb->file, current->files);
|
filp_close(twcb->file, current->files);
|
||||||
task_work_add(current, &twcb->twork, TWA_RESUME);
|
task_work_add(current, &twcb->twork, TWA_RESUME);
|
||||||
|
@ -3089,7 +3094,11 @@ static void binder_transaction(struct binder_proc *proc,
|
||||||
u32 secid;
|
u32 secid;
|
||||||
size_t added_size;
|
size_t added_size;
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
|
||||||
|
security_task_getsecid_obj(proc->tsk, &secid);
|
||||||
|
#else
|
||||||
security_task_getsecid(proc->tsk, &secid);
|
security_task_getsecid(proc->tsk, &secid);
|
||||||
|
#endif
|
||||||
ret = security_secid_to_secctx(secid, &secctx, &secctx_sz);
|
ret = security_secid_to_secctx(secid, &secctx, &secctx_sz);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return_error = BR_FAILED_REPLY;
|
return_error = BR_FAILED_REPLY;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/user_namespace.h>
|
#include <linux/user_namespace.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include <linux/xarray.h>
|
#include <linux/xarray.h>
|
||||||
#include <uapi/asm-generic/errno-base.h>
|
#include <uapi/asm-generic/errno-base.h>
|
||||||
#include <uapi/linux/android/binder.h>
|
#include <uapi/linux/android/binder.h>
|
||||||
|
@ -356,15 +357,25 @@ 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))
|
||||||
|
static int binderfs_rename(struct user_namespace *namespace, struct inode *old_dir,
|
||||||
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
|
#else
|
||||||
static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (is_binderfs_control_device(old_dentry) ||
|
if (is_binderfs_control_device(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))
|
||||||
|
return simple_rename(namespace, old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||||
|
#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);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int binderfs_unlink(struct inode *dir, struct dentry *dentry)
|
static int binderfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
|
|
|
@ -69,13 +69,21 @@ static unsigned long kallsyms_lookup_name_wrapper(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int (*__close_fd_get_file_ptr)(unsigned int fd, struct file **res) = NULL;
|
static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res) = NULL;
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
|
||||||
|
int close_fd_get_file(unsigned int fd, struct file **res)
|
||||||
|
#else
|
||||||
int __close_fd_get_file(unsigned int fd, struct file **res)
|
int __close_fd_get_file(unsigned int fd, struct file **res)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!__close_fd_get_file_ptr)
|
if (!close_fd_get_file_ptr)
|
||||||
__close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file");
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
|
||||||
return __close_fd_get_file_ptr(fd, res);
|
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("close_fd_get_file");
|
||||||
|
#else
|
||||||
|
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file");
|
||||||
|
#endif
|
||||||
|
return close_fd_get_file_ptr(fd, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL;
|
static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL;
|
||||||
|
|
Loading…
Reference in New Issue