[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250618135201.GM1613376@noisy.programming.kicks-ass.net>
Date: Wed, 18 Jun 2025 15:52:01 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
bpf@...r.kernel.org, x86@...nel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrii Nakryiko <andrii@...nel.org>,
Indu Bhagat <indu.bhagat@...cle.com>,
"Jose E. Marchesi" <jemarch@....org>,
Beau Belgrave <beaub@...ux.microsoft.com>,
Jens Remus <jremus@...ux.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v10 02/14] unwind_user: Add frame pointer support
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 ?
Powered by blists - more mailing lists