]> git.baikalelectronics.ru Git - kernel.git/commit
maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault()
authorAlban Crequy <albancrequy@linux.microsoft.com>
Thu, 10 Nov 2022 08:56:13 +0000 (09:56 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 11 Nov 2022 19:44:46 +0000 (11:44 -0800)
commitaacca799320b8b5cb6782b07e8e53b7ccda4e3ad
treea6accda70d5e23d0b3568f9ae322a1b4df9f918d
parentaf7ca23f1378e24d3016e10a399f81a1a41d35b3
maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault()

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: 96875aabe356 ("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
mm/maccess.c