mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: possible bug in setjmp implementation for ppc64
Date: Tue, 1 Aug 2017 23:55:56 -0400	[thread overview]
Message-ID: <20170802035556.GG1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170802002845.GA21256@dora.lan>

On Tue, Aug 01, 2017 at 07:28:45PM -0500, Bobby Bingham wrote:
> On Tue, Aug 01, 2017 at 07:07:59PM -0400, Rich Felker wrote:
> > On Tue, Aug 01, 2017 at 06:45:33PM -0400, Rich Felker wrote:
> > > On Tue, Aug 01, 2017 at 08:28:27AM +0300, Alexander Monakov wrote:
> > > > On Tue, 1 Aug 2017, Bobby Bingham wrote:
> > > > > I think this either requires having different versions of setjmp/longjmp
> > > > > for static and dynamic libc,
> > > >
> > > > Do you mean for non-pic vs pic objects? As I understand, when libc.a is
> > > > built with -fpic (so it's suitable for static-pie), setjmp-longjmp need
> > > > to preserve saved TOC at (r1+24). So presumably source code would need
> > > > to test #ifdef __PIC__?
> > > >
> > > > > or to increase the size of jmpbuf so we can always save/restore both
> > > > > r2 and the value on the stack, but this would be an ABI change.
> > > >
> > > > Would that work for non-pic, i.e. is (r1+24) a reserved location even in
> > > > non-pic mode? If not, you can't overwrite it from longjmp.
> > >
> > > Pretty much certainly so; there is no separate "non-PIC ABI". PIC code
> > > is just code that doesn't happen to do certain things not permissible
> > > in PIC. It doesn't have additional permissions to do things that
> > > otherwise wouldn't be permitted in "non-PIC code".
> > >
> > > In any case just saving and restoring both is not an ABI change, since
> > > there's plenty of free space (896 bits worth of non-existant signals)
> > > in the jmp_buf due to the "Hurd sigset_t" mess.
> >
> > It might also be possible to manually create both the entry points for
> > setjmp, rather than letting the assembler auto-generate them, in which
> > case I think the choice of which value to save just depends on which
> > entry point was used. Thoughts?
> 
> I like this idea.  It's slightly more complicated than that because of
> the call to setjmp from sigsetjmp, but should still be ok.  I'll work on
> a patch.

Hmm, can you elaborate on the situation with sigsetjmp?

Rich


  reply	other threads:[~2017-08-02  3:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 20:06 felix.winkelmann
2017-07-31 20:30 ` Rich Felker
2017-08-01  5:10   ` Bobby Bingham
2017-08-01  5:28     ` Alexander Monakov
2017-08-01 22:45       ` Rich Felker
2017-08-01 23:07         ` Rich Felker
2017-08-02  0:28           ` Bobby Bingham
2017-08-02  3:55             ` Rich Felker [this message]
2017-08-02  4:31               ` Bobby Bingham
2017-08-02  4:58                 ` Rich Felker
2017-08-02 13:38                   ` Bobby Bingham
2017-08-02 14:46                     ` Rich Felker
2017-08-03  0:19                       ` Bobby Bingham
2017-08-01 15:33     ` David Edelsohn
2017-08-02 23:00       ` Alexander Monakov
2017-08-02 23:02         ` 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=20170802035556.GG1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).