@@ -107,7 +107,7 @@ struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode)
107
107
ssize_t ksu_kernel_read_compat (struct file * p , void * buf , size_t count ,
108
108
loff_t * pos )
109
109
{
110
- #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 )
110
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 ) || defined( KSU_NEW_KERNEL_READ )
111
111
return kernel_read (p , buf , count , pos );
112
112
#else
113
113
loff_t offset = pos ? * pos : 0 ;
@@ -122,7 +122,7 @@ ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count,
122
122
ssize_t ksu_kernel_write_compat (struct file * p , const void * buf , size_t count ,
123
123
loff_t * pos )
124
124
{
125
- #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 )
125
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 ) || defined( KSU_NEW_KERNEL_WRITE )
126
126
return kernel_write (p , buf , count , pos );
127
127
#else
128
128
loff_t offset = pos ? * pos : 0 ;
@@ -134,20 +134,19 @@ ssize_t ksu_kernel_write_compat(struct file *p, const void *buf, size_t count,
134
134
#endif
135
135
}
136
136
137
- #if LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 8 , 0 )
137
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 8 , 0 ) || defined( KSU_STRNCPY_FROM_USER_NOFAULT )
138
138
long ksu_strncpy_from_user_nofault (char * dst , const void __user * unsafe_addr ,
139
139
long count )
140
140
{
141
141
return strncpy_from_user_nofault (dst , unsafe_addr , count );
142
142
}
143
- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 3 , 0 )
143
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 3 , 0 ) || defined( KSU_STRNCPY_FROM_UNSAFE_USER )
144
144
long ksu_strncpy_from_user_nofault (char * dst , const void __user * unsafe_addr ,
145
145
long count )
146
146
{
147
147
return strncpy_from_unsafe_user (dst , unsafe_addr , count );
148
148
}
149
- #else
150
- // Copied from: https://elixir.bootlin.com/linux/v4.9.337/source/mm/maccess.c#L201
149
+ #else // Copied from: https://elixir.bootlin.com/linux/v4.9.337/source/mm/maccess.c#L201
151
150
long ksu_strncpy_from_user_nofault (char * dst , const void __user * unsafe_addr ,
152
151
long count )
153
152
{
0 commit comments