Re: [RFC PATCH v1 02/11] unwind_user: Support Minimal DWARF CFI user-space unwinding

From
sashiko-bot@kernel.org
Date
2026-11-23 00:11:37
Also in
bpf, kvmarm, linux-efi, linux-kbuild, linux-perf-users
Reply to
Ian Rogers, 2026-11-22
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] unwind_user: unguarded frame_pointer() call in
  unwind_user_frame_pointer()
--

commit ad18f29bd8a6b46031b3d36b8ae44ab35c61c7c8
Author: Ian Rogers [off-list ref]

unwind_user: Support Minimal DWARF CFI user-space unwinding

This commit extends the generic user-space unwinder with
UNWIND_USER_TYPE_CFI to resolve ELF PT_GNU_EH_FRAME headers across
executable VMAs and enables 64-bit and 32-bit compat user unwinding on x86.
quoted hunk ↗ jump to hunk
diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h
index 64618618febde..dcd87012ab82c 100644
--- a/include/linux/unwind_user.h
+++ b/include/linux/unwind_user.h
@@ -16,6 +16,12 @@
 #endif
 
 #ifndef unwind_user_at_function_start
+/**
+ * unwind_user_at_function_start() - Default stub for function-entry detection
+ * @regs: User-mode register state.
+ *
+ * Return: false when the architecture does not override entry detection.
+ */
 static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 {
 	return false;
@@ -23,6 +29,78 @@ static inline bool unwind_user_at_function_start(struct pt_regs *regs)
 #define unwind_user_at_function_start unwind_user_at_function_start
 #endif
 
+#ifndef unwind_user_frame_pointer
+/**
+ * unwind_user_frame_pointer() - Default helper returning @regs's frame pointer
+ * @regs: User-mode register state.
+ *
+ * Return: Architectural user frame pointer from frame_pointer(@regs).
+ */
+static inline unsigned long unwind_user_frame_pointer(struct pt_regs *regs)
+{
+	return frame_pointer(regs);
+}
+#define unwind_user_frame_pointer unwind_user_frame_pointer
+#endif
[Severity: High]
Does defining unwind_user_frame_pointer() unconditionally break the build
on architectures that do not provide frame_pointer(regs)?

include/linux/unwind_deferred.h includes include/linux/unwind_user.h
outside CONFIG_UNWIND_USER, and core files such as kernel/exit.c include
include/linux/unwind_deferred.h on all architectures.  Architectures like
LoongArch and s390 do not define frame_pointer(regs) in asm/ptrace.h, and
include/linux/unwind_user.h also does not include linux/ptrace.h before
referencing struct pt_regs and frame_pointer().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261122235757.3456048-1-irogers@google.com?part=2
Thread (26 messages) 26 messages, 3 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help