Re: [PATCH] Documentation: livepatch: document reliable stacktrace

From: Josh Poimboeuf
Date: Thu Jan 14 2021 - 19:05:41 EST


On Thu, Jan 14, 2021 at 06:10:13PM +0000, Mark Rutland wrote:
> On Wed, Jan 13, 2021 at 04:25:41PM -0600, Josh Poimboeuf wrote:
> > On Wed, Jan 13, 2021 at 08:23:15PM +0000, Mark Brown wrote:
> > > On Wed, Jan 13, 2021 at 01:33:13PM -0600, Josh Poimboeuf wrote:
> > >
> > > > I think it's worth mentioning a little more about objtool. There are a
> > > > few passing mentions of objtool's generation of metadata (i.e. ORC), but
> > > > objtool has another relevant purpose: stack validation. That's
> > > > particularly important when it comes to frame pointers.
> > >
> > > > For some architectures like x86_64 and arm64 (but not powerpc/s390),
> > > > it's far too easy for a human to write asm and/or inline asm which
> > > > violates frame pointer protocol, silently causing the violater's callee
> > > > to get skipped in the unwind. Such architectures need objtool
> > > > implemented for CONFIG_STACK_VALIDATION.
> > >
> > > This basically boils down to just adding a statement saying "you may
> > > need to depend on objtool" I think?
> >
> > Right, but maybe it would be a short paragraph or two.
>
> I reckon that's a top-level section between requirements and
> consideration along the lines of:
>
> 3. Compile-time analysis
> ========================
>
> To ensure that kernel code can be correctly unwound in all cases,
> architectures may need to verify that code has been compiled in a manner
> expected by the unwinder. For example, an unwinder may expect that
> functions manipulate the stack pointer in a limited way, or that all
> functions use specific prologue and epilogue sequences. Architectures
> with such requirements should verify the kernel compilation using
> objtool.
>
> In some cases, an unwinder may require metadata to correctly unwind.
> Where necessary, this metadata should be generated at build time using
> objtool.

Sounds good to me.

--
Josh