[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204185121.jt5ylxsouqi5dyie@jpoimboe>
Date: Tue, 4 Feb 2025 10:51:21 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Jens Remus <jremus@...ux.ibm.com>
Cc: x86@...nel.org, Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel@...r.kernel.org, Indu Bhagat <indu.bhagat@...cle.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org, Mark Brown <broonie@...nel.org>,
linux-toolchains@...r.kernel.org, Jordan Rome <jordalgo@...a.com>,
Sam James <sam@...too.org>, linux-trace-kernel@...r.kernel.org,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Florian Weimer <fweimer@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Weinan Liu <wnliu@...gle.com>, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>
Subject: Re: [PATCH v4 19/39] unwind_user/sframe: Add support for reading
.sframe contents
On Thu, Jan 30, 2025 at 04:47:00PM +0100, Jens Remus wrote:
> On 22.01.2025 03:31, Josh Poimboeuf wrote:
> > +struct sframe_fre {
> > + unsigned int size;
> > + s32 ip_off;
>
> The IP offset (from function start) in the SFrame V2 FDE is unsigned:
>
> u32 ip_off;
Indeed.
> > +#define __UNSAFE_GET_USER_INC(to, from, type, label) \
> > +({ \
> > + type __to; \
> > + unsafe_get_user(__to, (type __user *)from, label); \
> > + from += sizeof(__to); \
> > + to = (typeof(to))__to; \
> > +})
> > +
> > +#define UNSAFE_GET_USER_INC(to, from, size, label) \
> > +({ \
> > + switch (size) { \
> > + case 1: \
> > + __UNSAFE_GET_USER_INC(to, from, u8, label); \
> > + break; \
> > + case 2: \
> > + __UNSAFE_GET_USER_INC(to, from, u16, label); \
> > + break; \
> > + case 4: \
> > + __UNSAFE_GET_USER_INC(to, from, u32, label); \
> > + break; \
> > + default: \
> > + return -EFAULT; \
> > + } \
> > +})
>
> This does not work for the signed SFrame fields, such as the FRE CFA,
> RA, and FP offsets, as it does not perform the required sign extension.
> One option would be to rename to UNSAFE_GET_USER_UNSIGNED_INC() and
> re-introduce UNSAFE_GET_USER_SIGNED_INC() using s8, s16, and s32.
See the following line in __UNSAFE_GET_USER_INC():
to = (typeof(to))__to;
Does that not do the sign extension?
--
Josh
Powered by blists - more mailing lists