public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: "Carlos O'Donell" <carlos@redhat.com>,
	"Senkevich, Andrew" <andrew.senkevich@intel.com>,
	 Andreas Schwab <schwab@suse.de>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Revert Intel CET changes to __jmp_buf_tag (Bug 22743)
Date: Thu, 25 Jan 2018 13:00:00 -0000	[thread overview]
Message-ID: <CAMe9rOpXJbr0ax=Z-zmJfQ2KBVJgwLoBm=7FpOGEvoEi1BHfMA@mail.gmail.com> (raw)
In-Reply-To: <30596304-a38e-1102-156f-85f67bd4d40e@redhat.com>

On Thu, Jan 25, 2018 at 4:50 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 01/25/2018 01:38 PM, H.J. Lu wrote:
>>>
>>> I still think you are over-engineering this.  The pad array has still an
>>> unused member (the last one).  Just change sigsetjmp to store the shadow
>>> pointer in that location, then the old and new setjmp will work with the
>>> current stack layout.  As far as I can tell, there are only 64 signals,
>>> so
>>> you don't even have to change the location of the signal mask.
>>
>> No, it doesn't work.  struct pthread_unwind_buf is placed on caller's
>> stack
>> and its address is passed from applications to libpthread.   If the size
>> of
>> caller's struct pthread_unwind_buf is smaller than what libpthread
>> expects,
>> libpthread will override caller's stack.
>
>
> As far as I can see, ibuf->priv.pad[3] is currently unused.  (sig)setjmp
> could save the shadow stack pointer at the right offset in jmp_buf to hit
> this place, then all these new conditionals wouldn't be necessary. Of course
> it is still a hack, but your approach is not clearer IMHO.

It is a mistake to use different jmpbuf sizes in libpthread and libc.
My patch is much more straightforward than what you suggested.
But I can live with it if everyone thinks it is the way to go.

> The patch you posted is very different from the commit link you shared
> earlier.  I still need to review it in detail.
>

Yes, I reworked the legacy cleanup buffer detection.  Now it simply checks
if shadow stack is enabled or not.

-- 
H.J.

  reply	other threads:[~2018-01-25 13:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 17:41 [PATCH 1/2] Linux/x86: Update cancel_jmp_buf to match __jmp_buf_tag [BZ #22563] H.J. Lu
2017-12-07 17:58 ` Joseph Myers
2017-12-07 18:37 ` Florian Weimer
2017-12-07 18:59   ` H.J. Lu
2017-12-07 19:09     ` Florian Weimer
2017-12-07 19:12       ` H.J. Lu
2017-12-07 19:14         ` Florian Weimer
2017-12-07 19:19           ` H.J. Lu
2017-12-07 19:25             ` Florian Weimer
2017-12-07 19:35               ` H.J. Lu
2017-12-08  2:25                 ` H.J. Lu
2017-12-14 13:06                   ` H.J. Lu
2017-12-15 17:43                     ` H.J. Lu
2017-12-18 10:25                   ` Florian Weimer
2017-12-18 11:42                     ` H.J. Lu
2017-12-18 11:49                       ` Florian Weimer
2017-12-18 12:25                         ` H.J. Lu
2017-12-18 12:52                           ` Florian Weimer
2017-12-18 13:19                             ` H.J. Lu
2017-12-18 14:13                               ` H.J. Lu
2017-12-18 14:45                                 ` Andreas Schwab
2017-12-18 14:48                                   ` H.J. Lu
2017-12-18 16:29                                     ` H.J. Lu
2018-01-09 10:47                                     ` Florian Weimer
2018-01-09 12:17                                       ` H.J. Lu
2018-01-09 16:20                                         ` Senkevich, Andrew
2018-01-21 16:16                                       ` Aurelien Jarno
2018-01-21 16:27                                         ` H.J. Lu
2018-01-21 16:50                                           ` Carlos O'Donell
2018-01-22 14:44                                           ` Senkevich, Andrew
2018-01-23 19:35                                             ` Carlos O'Donell
2018-01-23 21:13                                               ` Senkevich, Andrew
2018-01-24 18:08                                                 ` H.J. Lu
2018-01-24 18:23                                                   ` Florian Weimer
2018-01-25  0:32                                                     ` Carlos O'Donell
2018-01-25  0:56                                                       ` Joseph Myers
2018-01-25  1:09                                                       ` H.J. Lu
2018-01-25  1:44                                                         ` Carlos O'Donell
2018-01-25  1:48                                                         ` Dmitry V. Levin
2018-01-25  4:53                                                           ` [PATCH] Revert Intel CET changes to __jmp_buf_tag (Bug 22743) Carlos O'Donell
2018-01-25  5:33                                                             ` H.J. Lu
2018-01-25  9:47                                                               ` Florian Weimer
2018-01-25 12:38                                                                 ` H.J. Lu
2018-01-25 12:50                                                                   ` Florian Weimer
2018-01-25 13:00                                                                     ` H.J. Lu [this message]
2018-01-25 14:56                                                                       ` Zack Weinberg
2018-01-25 15:33                                                                         ` H.J. Lu
2018-01-25 16:22                                                                           ` Zack Weinberg
2018-01-25 16:28                                                                             ` H.J. Lu
2018-01-25 16:36                                                                               ` Carlos O'Donell
2018-01-25 16:40                                                                                 ` H.J. Lu
2018-01-25 16:46                                                                                   ` Carlos O'Donell
2018-01-25 17:01                                                                                     ` H.J. Lu
2018-01-26  7:46                                                                                       ` Carlos O'Donell
2018-01-28 18:40                                                                                         ` H.J. Lu
2018-01-25 16:47                                                                             ` Florian Weimer
2018-01-25 16:55                                                                               ` H.J. Lu
2018-01-25 18:26                                                                         ` Joseph Myers
2018-01-25 19:21                                                                     ` H.J. Lu
2018-01-25 16:37                                                               ` Carlos O'Donell
2018-01-25 16:38                                                                 ` Florian Weimer
2017-12-18 17:37                                 ` [PATCH 1/2] Linux/x86: Update cancel_jmp_buf to match __jmp_buf_tag [BZ #22563] Joseph Myers
2017-12-18 21:19                                   ` H.J. Lu

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='CAMe9rOpXJbr0ax=Z-zmJfQ2KBVJgwLoBm=7FpOGEvoEi1BHfMA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=andrew.senkevich@intel.com \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /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).