Thread (45 messages) flat view 45 messages, 5 authors, 2025-07-16

Re: [PATCH v13 02/14] unwind_user: Add frame pointer support

From: Jens Remus <hidden>
Date: 2025-07-10 12:28:36
Also in: bpf, lkml

On 09.07.2025 12:01, Jens Remus wrote:
On 08.07.2025 03:22, Steven Rostedt wrote:
quoted
From: Josh Poimboeuf <jpoimboe@kernel.org>
quoted
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
quoted
 static int unwind_user_next(struct unwind_user_state *state)
 {
-	/* no implementation yet */
+	struct unwind_user_frame *frame;
+	unsigned long cfa = 0, fp, ra = 0;
+	unsigned int shift;
+
+	if (state->done)
+		return -EINVAL;
+
+	if (fp_state(state))
+		frame = &fp_frame;
+	else
+		goto done;
+
+	if (frame->use_fp) {
+		if (state->fp < state->sp)
The initial check above is correct.  I got the logic wrong.  Sorry for
the fuss!  Do not change the check to what I came up with yesterday:
		if (state->fp <= state->sp)
Below s390 particularity, that FP may be equal to FP in any frame,
is only allowed with the initial check.
I meanwhile came to the conclusion that for architectures, such as s390,
where SP at function entry == SP at call site, the FP may be equal to
the SP.  At least for the brief period where the FP has been setup and
stack allocation did not yet take place.  For most architectures this
can probably only occur in the topmost frame.  For s390 the FP is setup
after static stack allocation, so --fno-omit-frame-pointer would enforce
FP==SP in any frame that does not perform dynamic stack allocation.
quoted
+			goto done;
+		cfa = state->fp;
+	} else {
+		cfa = state->sp;
+	}
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help