public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat•com>
To: Nicholas Piggin <npiggin@gmail•com>
Cc: Torsten Duwe <duwe@lst•de>,
	linux-kernel@vger•kernel.org, Jiri Kosina <jkosina@suse•cz>,
	live-patching@vger•kernel.org, linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE
Date: Sun, 17 Dec 2017 20:58:54 -0600	[thread overview]
Message-ID: <20171218025854.angid7h33gnmxsrg@treble> (raw)
In-Reply-To: <20171215194009.349b04da@roar.ozlabs.ibm.com>

On Fri, Dec 15, 2017 at 07:40:09PM +1000, Nicholas Piggin wrote:
> On Tue, 12 Dec 2017 08:05:01 -0600
> Josh Poimboeuf <jpoimboe@redhat•com> wrote:
> 
> > On Tue, Dec 12, 2017 at 12:39:12PM +0100, Torsten Duwe wrote:
> > > Hi all,
> > > 
> > > The "Power Architecture 64-Bit ELF V2 ABI" says in section 2.3.2.3:
> > > 
> > > [...] There are several rules that must be adhered to in order to ensure
> > > reliable and consistent call chain backtracing:
> > > 
> > > * Before a function calls any other function, it shall establish its
> > >   own stack frame, whose size shall be a multiple of 16 bytes.  
> > 
> > What about leaf functions?  If a leaf function doesn't establish a stack
> > frame, and it has inline asm which contains a blr to another function,
> > this ABI is broken.

Oops, I meant to say "bl" instead of "blr".

> > Also, even for non-leaf functions, is it possible for GCC to insert the
> > inline asm before it sets up the stack frame?  (This is an occasional
> > problem on x86.)
> 
> Inline asm must not have control transfer out of the statement unless
> it is asm goto.

Can inline asm have calls to other functions?

> > Also, what about hand-coded asm?
> 
> Should follow the same rules if it uses the stack.

How is that enforced?

> > > To me this sounds like the equivalent of HAVE_RELIABLE_STACKTRACE.
> > > This patch may be unneccessarily limited to ppc64le, but OTOH the only
> > > user of this flag so far is livepatching, which is only implemented on
> > > PPCs with 64-LE, a.k.a. ELF ABI v2.  
> > 
> > In addition to fixing the above issues, the unwinder also needs to
> > detect interrupts (i.e., preemption) and page faults on the stack of a
> > blocked task.  If a function were preempted before it created a stack
> > frame, or if a leaf function blocked on a page fault, the stack trace
> > will skip the function's caller, so such a trace will need to be
> > reported to livepatch as unreliable.
> 
> I don't think there is much problem there for powerpc. Stack frame
> creation and function call with return pointer are each atomic.

What if the function is interrupted before it creates the stack frame?

-- 
Josh

  reply	other threads:[~2017-12-18  2:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 15:25 [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols Kamalesh Babulal
2017-10-05  6:56 ` Naveen N . Rao
2017-10-05 12:43 ` Torsten Duwe
2017-10-06  5:43   ` Kamalesh Babulal
2017-10-11  9:44     ` Kamalesh Babulal
2017-10-06  5:57   ` Kamalesh Babulal
2017-10-17 14:47     ` Torsten Duwe
2017-10-18  6:17       ` Kamalesh Babulal
2017-10-20 12:07         ` Torsten Duwe
2017-10-21  0:59           ` Balbir Singh
2017-10-23  8:19             ` Kamalesh Babulal
2017-12-12 11:39               ` [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE Torsten Duwe
2017-12-12 12:12                 ` Miroslav Benes
2017-12-12 13:02                   ` Torsten Duwe
2018-02-27 16:09                   ` [PATCH 2/2] ppc64le save_stack_trace_tsk_reliable (Was: HAVE_RELIABLE_STACKTRACE) Torsten Duwe
2018-03-08 21:43                     ` Balbir Singh
2018-03-09 15:54                       ` Torsten Duwe
2017-12-12 14:05                 ` [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE Josh Poimboeuf
2017-12-15  9:40                   ` Nicholas Piggin
2017-12-18  2:58                     ` Josh Poimboeuf [this message]
2017-12-18  3:39                       ` Balbir Singh
2017-12-18  4:01                         ` Josh Poimboeuf
2017-12-18  5:33                       ` Nicholas Piggin
2017-12-18 18:56                         ` Josh Poimboeuf
2017-12-19  2:46                           ` Nicholas Piggin
2017-12-19 11:28                           ` Torsten Duwe
2017-12-19 21:46                             ` Josh Poimboeuf
2017-12-21 12:10                               ` Michael Ellerman
2017-12-23  4:00                                 ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218025854.angid7h33gnmxsrg@treble \
    --to=jpoimboe@redhat$(echo .)com \
    --cc=duwe@lst$(echo .)de \
    --cc=jkosina@suse$(echo .)cz \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=live-patching@vger$(echo .)kernel.org \
    --cc=npiggin@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox