mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] ppc64: check for AltiVec in setjmp/longjmp
Date: Tue, 7 Dec 2021 19:39:33 +0100	[thread overview]
Message-ID: <20211207183933.GA8506@voyager> (raw)
In-Reply-To: <20211207132509.GO7074@brightrain.aerifal.cx>

On Tue, Dec 07, 2021 at 08:25:09AM -0500, Rich Felker wrote:
> On Mon, Dec 06, 2021 at 08:44:47PM -0500, David Edelsohn wrote:
> > It should work, but it's slightly preferred to use $+4 because one
> > explicitly wants the address of the next instruction and labels of the
>
> In this case we don't want the address of the next instruction. We
> want the address of the constant __hwcap-.
>
> Rich

According to at least one source I found at some point (and can't seem
to find right away), "bcl 20,31,+4" is the one special form of the
instruction that is most likely to circumvent the shadow stack. I have
seen "bcl 20,31,label" in the wild, even in cases where the label didn't
directly follow the instruction, so maybe it works, maybe it doesn't.

That said, architecturally it will work either way. We are only talking
about an implementation detail, and both IBM's and Freescale's/NXP's
documentation is very cagey about revealing any of those. The
instruction is specified to exist and do the right thing (namely to
branch with linking unconditionally) all the way back to the first
PowerPC implementations from the early nineties, but whether such a
thing as a branch predictor even exists, or if it uses shadow stacks to
predict the "blr" target, is entirely unspecified.

So yeah, you might want to restructure the code to move the hwcap offset
somewhere else.

Ciao,
Markus

  parent reply	other threads:[~2021-12-07 18:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 23:43 Stijn Tintel
2021-12-07  0:37 ` Florian Weimer
2021-12-07  0:59   ` Rich Felker
2021-12-07  1:15     ` David Edelsohn
2021-12-07  1:39       ` Rich Felker
2021-12-07  1:44         ` David Edelsohn
2021-12-07 13:25           ` Rich Felker
2021-12-07 13:39             ` David Edelsohn
2021-12-07 14:43               ` Rich Felker
2021-12-07 14:48                 ` David Edelsohn
2021-12-07 18:39             ` Markus Wichmann [this message]
2021-12-07 18:57               ` David Edelsohn
2021-12-07 19:28               ` Florian Weimer
2021-12-07 20:15                 ` Markus Wichmann
2021-12-07 20:29                   ` Rich Felker
2021-12-08  5:02                     ` Markus Wichmann
2021-12-07 18:27           ` James Y Knight
2021-12-07 18:57             ` Markus Wichmann
2021-12-08  8:43     ` Stijn Tintel
2021-12-08 13:37       ` Rich Felker
2021-12-08 15:36         ` Rich Felker

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=20211207183933.GA8506@voyager \
    --to=nullplan@gmx.net \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).