Thread (14 messages) 14 messages, 2 authors, 2025-06-27
STALE336d
Revisions (3)
  1. v5 [diff vs current]
  2. v6 current
  3. v7 [diff vs current]

[PATCH v6 09/12] unwind_user/sframe: Remove .sframe section on detected corruption

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2025-06-17 22:51:17
Also in: bpf, lkml
Subsystem: the rest, userspace stack unwinding · Maintainers: Linus Torvalds, Josh Poimboeuf, Steven Rostedt

From: Josh Poimboeuf <jpoimboe@kernel.org>

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>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/unwind/sframe.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
index b10420d19840..f246ead6c2a0 100644
--- a/kernel/unwind/sframe.c
+++ b/kernel/unwind/sframe.c
@@ -310,6 +310,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.47.2

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help