This is a note to let you know that I've just added the patch titled maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault() to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: maccess-fix-writing-offset-in-case-of-fault-in-strncpy_from_kernel_nofault.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8678ea06852cd1f819b870c773d43df888d15d46 Mon Sep 17 00:00:00 2001 From: Alban Crequy <albancrequy@xxxxxxxxxxxxxxxxxxx> Date: Thu, 10 Nov 2022 09:56:13 +0100 Subject: maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault() From: Alban Crequy <albancrequy@xxxxxxxxxxxxxxxxxxx> commit 8678ea06852cd1f819b870c773d43df888d15d46 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: b58294ead14c ("maccess: allow architectures to provide kernel probing directly") Signed-off-by: Alban Crequy <albancrequy@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Tested-by: Francis Laniel <flaniel@xxxxxxxxxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [5.8] Link: https://lore.kernel.org/bpf/20221110085614.111213-2-albancrequy@xxxxxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/maccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/maccess.c +++ b/mm/maccess.c @@ -97,7 +97,7 @@ long strncpy_from_kernel_nofault(char *d return src - unsafe_addr; Efault: pagefault_enable(); - dst[-1] = '\0'; + dst[0] = '\0'; return -EFAULT; } Patches currently in stable-queue which might be from albancrequy@xxxxxxxxxxxxxxxxxxx are queue-6.0/maccess-fix-writing-offset-in-case-of-fault-in-strncpy_from_kernel_nofault.patch