Re: [RFC][PATCH] unwind: Add stacktrace_setup system call
From: Steven Rostedt
Date: Wed Apr 29 2026 - 14:55:06 EST
On Wed, 29 Apr 2026 14:42:52 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
> On 2026-04-29 11:43, Steven Rostedt wrote:
> [...]
>
> AFAIU this is a functional iteration of my prior RFC here:
>
> https://lore.kernel.org/lkml/2fa31347-3021-4604-bec3-e5a2d57b77b5@xxxxxxxxxxxx/
>
> perhaps it would be valuable to refer to that thread ?
Thanks, I actually decided to start this from scratch as I took a slightly
different approach than yours. But you're right, I should have mentioned it
anyway.
>
> > }
> > +
> > +/**
> > + * sys_stacktrace_setup - register an address for user space stacktrace walking.
> > + * @op: Type of operation to perform
> > + * @addr_start: The virtual address of the stacktrace information
> > + * @addr_length: The length of the stacktrace information
> > + * @text_start: The virtual address of the text that @addr_start represents
> > + * @text_length: The length of teh text
>
> the
>
> also, perhaps add @flags just in case ? This allows changing the
> behavior without having to insert entirely new set of ops.
I thought about it and decided it was somewhat redundant to the ops. After
working on the futex code, I thought following that API was a better
approach.
>
> > + *
> > + * This system call is used by dynamic library utilities to inform the kernel
>
> Out of curiosity: what would happen if the application chooses to invoke
> this system call to register sframe for the main executable ? Should it be
> allowed ?
I haven't tried, and should look at the code. Ideally, no two sframes
sections should cover the same code. I think it should error out if it does.
If the main executable doesn't have a sframe section, I don't see why this
shouldn't be allowed to add one.
>
> > + * of meta data that it loaded that can be used by the kernel to know how
> > + * to stack walk the given text locations.
> > + *
> > + * Currently only sframes are supported, but in the future, this may be used
> > + * to tell the kernel about JIT code which will most likely have a different
> > + * format.
> > + *
> > + * The type command may be extended and parameters may be used for other
> > + * purposes.
>
> "type" or "op" ?
Bah, I originally had called it "type" and then renamed it to "op" (to
be consistent with the futex commands). I missed updating this. Thanks for
catching that.
-- Steve