* Patch "ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()" has been added to the 5.15-stable tree
@ 2025-04-01 9:13 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2025-04-01 9:13 UTC (permalink / raw)
To: akpm, ardb, ben, broonie, gregkh, keescook, linux-arm-kernel,
rmk+kernel, wangkefeng.wang
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()
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:
arm-9350-1-fault-implement-copy_from_kernel_nofault_allowed.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@vger.kernel.org> know about it.
From 169f9102f9198b04afffa6164372a4ba4070f412 Mon Sep 17 00:00:00 2001
From: Kees Cook <keescook@chromium.org>
Date: Thu, 1 Feb 2024 18:32:58 +0100
Subject: ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()
From: Kees Cook <keescook@chromium.org>
commit 169f9102f9198b04afffa6164372a4ba4070f412 upstream.
Under PAN emulation when dumping backtraces from things like the
LKDTM EXEC_USERSPACE test[1], a double fault (which would hang a CPU)
would happen because of dump_instr() attempting to read a userspace
address. Make sure copy_from_kernel_nofault() does not attempt this
any more.
Closes: https://lava.sirena.org.uk/scheduler/job/497571
Link: https://lore.kernel.org/all/202401181125.D48DCB4C@keescook/ [1]
Reported-by: Mark Brown <broonie@kernel.org>
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Cc: Wang Kefeng <wangkefeng.wang@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm/mm/fault.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -24,6 +24,13 @@
#include "fault.h"
+bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
+{
+ unsigned long addr = (unsigned long)unsafe_src;
+
+ return addr >= TASK_SIZE && ULONG_MAX - addr >= size;
+}
+
#ifdef CONFIG_MMU
/*
Patches currently in stable-queue which might be from keescook@chromium.org are
queue-5.15/arm-9350-1-fault-implement-copy_from_kernel_nofault_allowed.patch
queue-5.15/slab-clean-up-function-prototypes.patch
queue-5.15/arm-9351-1-fault-add-cut-here-line-for-prefetch-aborts.patch
queue-5.15/slab-introduce-kmalloc_size_roundup.patch
queue-5.15/openvswitch-use-kmalloc_size_roundup-to-match-ksize-.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-01 9:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 9:13 Patch "ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()" has been added to the 5.15-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).