lkml.org 
[lkml]   [2021]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v4 1/2] arm64: Introduce stack trace reliability checks in the unwinder
On Fri, May 21, 2021 at 02:41:56PM -0500, Madhavan T. Venkataraman wrote:
> > Or is frame->reliable supposed to be checked after all? Looking at the
> > code again, I'm not sure.
> >
> > Either way it would be good to document the interface more clearly in a
> > comment above the function.
> >
>
> So, arch_stack_walk_reliable() would do this:
>
> start_backtrace(frame);
>
> while (...) {
> if (!frame->reliable)
> return error;
>
> consume_entry(...);
>
> ret = unwind_frame(...);
>
> if (ret)
> break;
> }
>
> if (ret == -ENOENT)
> return success;
> return error;
>
>
> Something like that.

I see. So basically there are six possible combinations of return
states:

1) No error frame->reliable
2) No error !frame->reliable
3) -ENOENT frame->reliable
5) -ENOENT !frame->reliable (doesn't happen in practice)
4) Other error frame->reliable (doesn't happen in practice)
6) Other error !frame->reliable


On x86 we have fewer combinations:

1) No error state->error
2) No error !state->error
3) Error state->error
4) Error !state->error (doesn't happen in practice)


I think the x86 interface seems more robust, because it's more narrow
and has fewer edge cases. Also it doesn't have to distinguish between
error enums, which can get hairy if a downstream callee happens to
return -ENOENT for a different reason.

--
Josh

\
 
 \ /
  Last update: 2021-05-21 22:09    [W:0.525 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site