On Tue, Jun 10, 2025 at 08:54:23PM -0400, Steven Rostedt wrote:
>  int unwind_user_next(struct unwind_user_state *state)
>  {
> +     struct unwind_user_frame *frame;
> +     unsigned long cfa = 0, fp, ra = 0;
> +
> +     if (state->done)
> +             return -EINVAL;
> +
> +     if (fp_state(state))
> +             frame = &fp_frame;
> +     else
> +             goto the_end;
> +
> +     cfa = (frame->use_fp ? state->fp : state->sp) + frame->cfa_off;
> +
> +     /* stack going in wrong direction? */
> +     if (cfa <= state->sp)
> +             goto the_end;
> +
> +     if (get_user(ra, (unsigned long *)(cfa + frame->ra_off)))
> +             goto the_end;
> +
> +     if (frame->fp_off && get_user(fp, (unsigned long __user *)(cfa + 
> frame->fp_off)))
> +             goto the_end;
> +
> +     state->ip = ra;
> +     state->sp = cfa;
> +     if (frame->fp_off)
> +             state->fp = fp;
> +
> +     return 0;
> +
> +the_end:
> +     state->done = true;
>       return -EINVAL;
>  }

I'm thinking 'the_end' might be better named 'done' ?

Also, CFA here is Call-Frame-Address and RA Return-Address ?

Reply via email to