Thread (161 messages) 161 messages, 8 authors, 2025-04-24
STALE406d

[PATCH v4 24/39] unwind_user/sframe: Remove .sframe section on detected corruption

From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2025-01-22 02:32:17
Also in: linux-perf-users, linux-toolchains, lkml
Subsystem: the rest, userspace stack unwinding · Maintainers: Linus Torvalds, Josh Poimboeuf, Steven Rostedt

To avoid continued attempted use of a bad .sframe section, remove it
on demand when the first sign of corruption is detected.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 kernel/unwind/sframe.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
index 1a35615a361e..66b920441692 100644
--- a/kernel/unwind/sframe.c
+++ b/kernel/unwind/sframe.c
@@ -294,6 +294,10 @@ int sframe_find(unsigned long ip, struct unwind_user_frame *frame)
 	ret = __find_fre(sec, &fde, ip, frame);
 end:
 	user_read_access_end();
+
+	if (ret == -EFAULT)
+		WARN_ON_ONCE(sframe_remove_section(sec->sframe_start));
+
 	return ret;
 }
 
-- 
2.48.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help