public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul E Murphy <murphyp@linux.ibm.com>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] powerpc64: Workaround sigtramp vdso return call.
Date: Tue, 26 Jan 2021 08:45:00 -0600	[thread overview]
Message-ID: <92b0ba5f-082c-5d4d-7998-075973fb32f6@linux.ibm.com> (raw)
In-Reply-To: <8735ynbxe6.fsf@oldenburg.str.redhat.com>



On 1/26/21 8:12 AM, Florian Weimer via Libc-alpha wrote:
> * Raoni Fassina Firmino:
> 
>> A not so recent kernel change[1] changed how the trampoline
>> `__kernel_sigtramp_rt64` is used to call signal handlers.
>>
>> This was exposed on the test misc/tst-sigcontext-get_pc
>>
>> Before kernel 5.9, the kernel set LR to the trampoline address and
>> jumped directly to the signal handler, and at the end the signal
>> handler, as any other function, would `blr` to the address set.  In
>> other words, the trampoline was executed just at the end of the signal
>> handler and the only thing it did was call sigreturn.  But since
>> kernel 5.9 the kernel set CTRL to the signal handler and calls to the
>> trampoline code, the trampoline then `bctrl` to the address in CTRL,
>> setting the LR to the next instruction in the middle of the
>> trampoline, when the signal handler returns, the rest of the
>> trampoline code executes the same code as before.
> 
> Thanks for the patch, byt:
> 
> No one has explained so far why the original blr instruction couldn't be
> augmented with the appropriate branch predictor hint.  The 2.07 ISA
> manual suggests that it's possible, but maybe I'm reading it wrong.

bctrl is the preferred form of making indirect calls.  You can add hint 
0b01 to bclr (blr) to get similar behavior on power8/9, but as noted in 
the ISA, it is optional.

  reply	other threads:[~2021-01-26 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 13:05 Raoni Fassina Firmino
2021-01-26 13:08 ` Raoni Fassina Firmino
2021-01-26 14:12 ` Florian Weimer
2021-01-26 14:45   ` Paul E Murphy [this message]
2021-01-27 16:21     ` Raoni Fassina Firmino
2021-01-28  5:38       ` Nicholas Piggin
2021-01-26 16:36 ` Adhemerval Zanella
2021-01-27 19:22   ` Raoni Fassina Firmino
2021-01-27 19:31     ` Adhemerval Zanella
2021-01-28  8:54 ` Andreas Schwab
2021-01-28 13:03   ` Raoni Fassina Firmino

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=92b0ba5f-082c-5d4d-7998-075973fb32f6@linux.ibm.com \
    --to=murphyp@linux.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).