This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86: Use pad in pthread_unwind_buf to preserve shadow stack register
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "Carlos O'Donell" <carlos at redhat dot com>, Florian Weimer <fw at deneb dot enyo dot de>, "Tsimbalist, Igor V" <igor dot v dot tsimbalist at intel dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 17 Apr 2018 16:20:19 -0700
- Subject: Re: [PATCH] x86: Use pad in pthread_unwind_buf to preserve shadow stack register
- References: <CAMe9rOpj6nYdP33emmepZ+KWFG2JDVNsHn1bve3oo5WQyFmduA@mail.gmail.com> <61a5b452-e59e-dfef-4530-a94a60480961@redhat.com> <CAMe9rOr68P6Z=rX=xeFG1PbQE1fZ14iN3NmZEpChjP6QmUfS8g@mail.gmail.com> <alpine.DEB.2.20.1804171959590.1402@digraph.polyomino.org.uk>
On Tue, Apr 17, 2018 at 1:02 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 6 Apr 2018, H.J. Lu wrote:
>
>> https://github.com/hjl-tools/glibc/commit/9bf6aefa8fb45f8df140d42ce9cf890bb24076e1
>>
>> It should be binary backward compatible. I will investigate if there is a way
>
> Increasing the size of a public type is always dangerous, because you can
> end up with one part of a program expecting the new, larger size but
> another part only allocating the old, smaller size.
That is true. The allocated ucontext size must be no less than the size
expected by ucontext consumer.
> It might in some cases be compatible to the extent that existing linked
> programs and shared libraries work with new glibc, if new glibc will never
This is done by checking CET properties. Both linker and dynamic linker
clear CET property bits if any module doesn't have CET bits set. Glibc
should access new extended fields only if CET bits are set, which means
the new ucontext is used in all .o files. That is why I want to extend
ucontext before we have found a solution so that if an object file has
CET bits set, it must use the new ucontext.
> try to write into the unallocated part of such objects allocated by an
> existing linked program or shared library. However, any such change would
> need a careful analysis of how the type gets written to, and to what
> extent external libraries have interfaces that depend on the size of the
> type, and would need a NEWS entry explaining the change and discussing the
> compatibility issues with it.
>
Agreed,
--
H.J.