mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-15 11:44:11 +00:00
maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault()
commit8678ea0685
upstream. If a page fault occurs while copying the first byte, this function resets one byte before dst. As a consequence, an address could be modified and leaded to kernel crashes if case the modified address was accessed later. Fixes:b58294ead1
("maccess: allow architectures to provide kernel probing directly") Signed-off-by: Alban Crequy <albancrequy@linux.microsoft.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Tested-by: Francis Laniel <flaniel@linux.microsoft.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: <stable@vger.kernel.org> [5.8] Link: https://lore.kernel.org/bpf/20221110085614.111213-2-albancrequy@linux.microsoft.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
43fe04711b
commit
a22041b330
1 changed files with 1 additions and 1 deletions
|
@ -99,7 +99,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count)
|
|||
return src - unsafe_addr;
|
||||
Efault:
|
||||
pagefault_enable();
|
||||
dst[-1] = '\0';
|
||||
dst[0] = '\0';
|
||||
return -EFAULT;
|
||||
}
|
||||
#else /* HAVE_GET_KERNEL_NOFAULT */
|
||||
|
|
Loading…
Add table
Reference in a new issue