All users are gone now.
Unified · Split
| @@ -311,7 +311,6 @@ extern long probe_user_read(void *dst, const void __user *src, size_t size); · 310 unmodified lines | ||
| 311 | 311 | extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); |
| 312 | 312 | extern long notrace probe_user_write(void __user *dst, const void *src, size_t size); |
| 313 | 313 | |
| 314 | −extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); | |
| 315 | 314 | long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, |
| 316 | 315 | long count); |
| 317 | 316 | |
| @@ -8,8 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | static long __probe_kernel_read(void *dst, const void *src, size_t size, |
| 10 | 10 | bool strict); |
| 11 | −static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, | |
| 12 | − long count, bool strict); | |
| 13 | 11 | |
| 14 | 12 | bool __weak probe_kernel_read_allowed(const void *unsafe_src, size_t size, |
| 15 | 13 | bool strict) |
| @@ -157,35 +155,6 @@ long probe_user_write(void __user *dst, const void *src, size_t size) · 141 unmodified lines | ||
| 157 | 155 | } |
| 158 | 156 | EXPORT_SYMBOL_GPL(probe_user_write); |
| 159 | 157 | |
| 160 | −/** | |
| 161 | − * strncpy_from_unsafe: - Copy a NUL terminated string from unsafe address. | |
| 162 | − * @dst: Destination address, in kernel space. This buffer must be at | |
| 163 | − * least @count bytes long. | |
| 164 | − * @unsafe_addr: Unsafe address. | |
| 165 | − * @count: Maximum number of bytes to copy, including the trailing NUL. | |
| 166 | − * | |
| 167 | − * Copies a NUL-terminated string from unsafe address to kernel buffer. | |
| 168 | − * | |
| 169 | − * On success, returns the length of the string INCLUDING the trailing NUL. | |
| 170 | − * | |
| 171 | − * If access fails, returns -EFAULT (some data may have been copied | |
| 172 | − * and the trailing NUL added). | |
| 173 | − * | |
| 174 | − * If @count is smaller than the length of the string, copies @count-1 bytes, | |
| 175 | − * sets the last byte of @dst buffer to NUL and returns @count. | |
| 176 | − * | |
| 177 | − * Same as strncpy_from_kernel_nofault() except that for architectures with | |
| 178 | − * not fully separated user and kernel address spaces this function also works | |
| 179 | − * for user address tanges. | |
| 180 | − * | |
| 181 | − * DO NOT USE THIS FUNCTION - it is broken on architectures with entirely | |
| 182 | − * separate kernel and user address spaces, and also a bad idea otherwise. | |
| 183 | − */ | |
| 184 | −long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) | |
| 185 | −{ | |
| 186 | − return __strncpy_from_unsafe(dst, unsafe_addr, count, false); | |
| 187 | −} | |
| 188 | − | |
| 189 | 158 | /** |
| 190 | 159 | * strncpy_from_kernel_nofault: - Copy a NUL terminated string from unsafe |
| 191 | 160 | * address. |
| @@ -205,12 +174,6 @@ long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) · 13 unmodified lines | ||
| 205 | 174 | * sets the last byte of @dst buffer to NUL and returns @count. |
| 206 | 175 | */ |
| 207 | 176 | long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) |
| 208 | −{ | |
| 209 | − return __strncpy_from_unsafe(dst, unsafe_addr, count, true); | |
| 210 | −} | |
| 211 | − | |
| 212 | −static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, | |
| 213 | − long count, bool strict) | |
| 214 | 177 | { |
| 215 | 178 | mm_segment_t old_fs = get_fs(); |
| 216 | 179 | const void *src = unsafe_addr; |
| @@ -218,7 +181,7 @@ static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, · 1 unmodified line | ||
| 218 | 181 | |
| 219 | 182 | if (unlikely(count <= 0)) |
| 220 | 183 | return 0; |
| 221 | − if (!probe_kernel_read_allowed(unsafe_addr, count, strict)) | |
| 184 | + if (!probe_kernel_read_allowed(unsafe_addr, count, true)) | |
| 222 | 185 | return -EFAULT; |
| 223 | 186 | |
| 224 | 187 | set_fs(KERNEL_DS); |