Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

unwind_user: Enhance comments on get CFA, FP, and RA

Move the comment "Get the Canonical Frame Address (CFA)" to the top
of the sequence of statements that actually get the CFA. Reword the
comment "Find the Return Address (RA)" to "Get ...", as the statements
actually get the RA. Add a respective comment to the statements that
get the FP. This will be useful once future commits extend the logic
to get the RA and FP.

While at it align the comment on the "stack going in wrong direction"
check to the following one on the "address is word aligned" check.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251208160352.1363040-2-jremus@linux.ibm.com

authored by

Jens Remus and committed by
Peter Zijlstra
2d6ad925 65eb3a9a

+4 -4
+4 -4
kernel/unwind/user.c
··· 31 31 { 32 32 unsigned long cfa, fp, ra; 33 33 34 + /* Get the Canonical Frame Address (CFA) */ 34 35 if (frame->use_fp) { 35 36 if (state->fp < state->sp) 36 37 return -EINVAL; ··· 39 38 } else { 40 39 cfa = state->sp; 41 40 } 42 - 43 - /* Get the Canonical Frame Address (CFA) */ 44 41 cfa += frame->cfa_off; 45 42 46 - /* stack going in wrong direction? */ 43 + /* Make sure that stack is not going in wrong direction */ 47 44 if (cfa <= state->sp) 48 45 return -EINVAL; 49 46 ··· 49 50 if (cfa & (state->ws - 1)) 50 51 return -EINVAL; 51 52 52 - /* Find the Return Address (RA) */ 53 + /* Get the Return Address (RA) */ 53 54 if (get_user_word(&ra, cfa, frame->ra_off, state->ws)) 54 55 return -EINVAL; 55 56 57 + /* Get the Frame Pointer (FP) */ 56 58 if (frame->fp_off && get_user_word(&fp, cfa, frame->fp_off, state->ws)) 57 59 return -EINVAL; 58 60