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