@@ -371,10 +371,15 @@ static int do_get_wrapper_fd(void __user *arg) {
|
||||
goto put_orig_file;
|
||||
}
|
||||
|
||||
// kcompat for older kernel
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
||||
#define getfd_secure anon_inode_create_getfd
|
||||
#else
|
||||
#elif defined(KSU_HAS_GETFD_SECURE)
|
||||
#define getfd_secure anon_inode_getfd_secure
|
||||
#else
|
||||
// technically not a secure inode, but, this is the only way so.
|
||||
#define getfd_secure(name, ops, data, flags, __unused) \
|
||||
anon_inode_getfd(name, ops, data, flags)
|
||||
#endif
|
||||
ret = getfd_secure("[ksu_fdwrapper]", &data->ops, data, f->f_flags, NULL);
|
||||
if (ret < 0) {
|
||||
@@ -386,7 +391,11 @@ static int do_get_wrapper_fd(void __user *arg) {
|
||||
struct inode* wrapper_inode = file_inode(pf);
|
||||
// copy original inode mode
|
||||
wrapper_inode->i_mode = file_inode(f)->i_mode;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(KSU_OPTIONAL_SELINUX_INODE)
|
||||
struct inode_security_struct *sec = selinux_inode(wrapper_inode);
|
||||
#else
|
||||
struct inode_security_struct *sec = (struct inode_security_struct *)wrapper_inode->i_security;
|
||||
#endif
|
||||
if (sec) {
|
||||
sec->sid = ksu_file_sid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user