Patch "maccess: Fix writing offset in case of fault in strncpy_from_kernel_nofault()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 5.15-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-5.15 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
@@ -99,7 +99,7 @@ long strncpy_from_kernel_nofault(char *d
 	return src - unsafe_addr;
 Efault:
 	pagefault_enable();
-	dst[-1] = '\0';
+	dst[0] = '\0';
 	return -EFAULT;
 }
 #else /* HAVE_GET_KERNEL_NOFAULT */


Patches currently in stable-queue which might be from albancrequy@xxxxxxxxxxxxxxxxxxx are

queue-5.15/maccess-fix-writing-offset-in-case-of-fault-in-strncpy_from_kernel_nofault.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux