maccess: rename strncpy_from_unsafe_strict to strncpy_from_kernel_nofault
This matches the naming of strncpy_from_user_nofault, and also makes it more clear what the function is supposed to do. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20200521152301.2587579-8-hch@lst.de Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bd88bb5d40
commit
c4cb164426
|
@ -34,7 +34,7 @@ long probe_kernel_read_strict(void *dst, const void *src, size_t size)
|
||||||
return __probe_kernel_read(dst, src, size);
|
return __probe_kernel_read(dst, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
long strncpy_from_unsafe_strict(char *dst, const void *unsafe_addr, long count)
|
long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count)
|
||||||
{
|
{
|
||||||
if (unlikely(invalid_probe_range((unsigned long)unsafe_addr)))
|
if (unlikely(invalid_probe_range((unsigned long)unsafe_addr)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
|
@ -310,7 +310,7 @@ extern long notrace probe_kernel_write(void *dst, const void *src, size_t size);
|
||||||
extern long notrace probe_user_write(void __user *dst, const void *src, size_t size);
|
extern long notrace probe_user_write(void __user *dst, const void *src, size_t size);
|
||||||
|
|
||||||
extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
|
extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
|
||||||
extern long strncpy_from_unsafe_strict(char *dst, const void *unsafe_addr,
|
long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr,
|
||||||
long count);
|
long count);
|
||||||
extern long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
|
extern long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
|
||||||
long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
|
long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
|
||||||
|
|
|
@ -240,7 +240,7 @@ bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr,
|
||||||
* is returned that can be used for bpf_perf_event_output() et al.
|
* is returned that can be used for bpf_perf_event_output() et al.
|
||||||
*/
|
*/
|
||||||
ret = compat ? strncpy_from_unsafe(dst, unsafe_ptr, size) :
|
ret = compat ? strncpy_from_unsafe(dst, unsafe_ptr, size) :
|
||||||
strncpy_from_unsafe_strict(dst, unsafe_ptr, size);
|
strncpy_from_kernel_nofault(dst, unsafe_ptr, size);
|
||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0))
|
||||||
out:
|
out:
|
||||||
memset(dst, 0, size);
|
memset(dst, 0, size);
|
||||||
|
@ -415,7 +415,7 @@ fmt_str:
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'k':
|
case 'k':
|
||||||
strncpy_from_unsafe_strict(buf, unsafe_ptr,
|
strncpy_from_kernel_nofault(buf, unsafe_ptr,
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
|
|
|
@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(probe_user_write);
|
||||||
* If @count is smaller than the length of the string, copies @count-1 bytes,
|
* If @count is smaller than the length of the string, copies @count-1 bytes,
|
||||||
* sets the last byte of @dst buffer to NUL and returns @count.
|
* sets the last byte of @dst buffer to NUL and returns @count.
|
||||||
*
|
*
|
||||||
* Same as strncpy_from_unsafe_strict() except that for architectures with
|
* Same as strncpy_from_kernel_nofault() except that for architectures with
|
||||||
* not fully separated user and kernel address spaces this function also works
|
* not fully separated user and kernel address spaces this function also works
|
||||||
* for user address tanges.
|
* for user address tanges.
|
||||||
*
|
*
|
||||||
|
@ -172,7 +172,7 @@ long __weak strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
|
||||||
__attribute__((alias("__strncpy_from_unsafe")));
|
__attribute__((alias("__strncpy_from_unsafe")));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* strncpy_from_unsafe_strict: - Copy a NUL terminated string from unsafe
|
* strncpy_from_kernel_nofault: - Copy a NUL terminated string from unsafe
|
||||||
* address.
|
* address.
|
||||||
* @dst: Destination address, in kernel space. This buffer must be at
|
* @dst: Destination address, in kernel space. This buffer must be at
|
||||||
* least @count bytes long.
|
* least @count bytes long.
|
||||||
|
@ -189,7 +189,7 @@ long __weak strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
|
||||||
* If @count is smaller than the length of the string, copies @count-1 bytes,
|
* If @count is smaller than the length of the string, copies @count-1 bytes,
|
||||||
* sets the last byte of @dst buffer to NUL and returns @count.
|
* sets the last byte of @dst buffer to NUL and returns @count.
|
||||||
*/
|
*/
|
||||||
long __weak strncpy_from_unsafe_strict(char *dst, const void *unsafe_addr,
|
long __weak strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr,
|
||||||
long count)
|
long count)
|
||||||
__attribute__((alias("__strncpy_from_unsafe")));
|
__attribute__((alias("__strncpy_from_unsafe")));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue