This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [x86-64 psABI] RFC: Extend x86-64 PLT entry to support MPX
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, Roland McGrath <roland at hack dot frob dot com>, GNU C Library <libc-alpha at sourceware dot org>, GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>, "Girkar, Milind" <milind dot girkar at intel dot com>, "Kreitzer, David L" <david dot l dot kreitzer at intel dot com>
- Date: Thu, 25 Jul 2013 09:33:39 -0700
- Subject: Re: [x86-64 psABI] RFC: Extend x86-64 PLT entry to support MPX
- References: <CAMe9rOp=1v38F_aV-pbv50YOGSEr_ju+byZP1L_G_h4bm5Ad3w at mail dot gmail dot com> <20130724233621 dot DA6942C08C at topped-with-meat dot com> <CAKOQZ8zn2KHayUrdKPOB0ys0Y794c5-t8Zw6hefeB5NGXTXKRw at mail dot gmail dot com> <CAMbmDYawnf5yucwySAEa7U7fNFX45ji7YzjiXYfMaFB9qzNVCg at mail dot gmail dot com>
On Thu, Jul 25, 2013 at 4:08 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> 2013/7/25 Ian Lance Taylor <iant@google.com>:
>> On Wed, Jul 24, 2013 at 4:36 PM, Roland McGrath <roland@hack.frob.com> wrote:
>>>
>>> Will an MPX-using binary require an MPX-supporting dynamic linker to run
>>> correctly?
>>>
>>> * An old dynamic linker won't clobber %bndN directly, so that's not a
>>> problem.
>>
>> These are my answers and likely incorrect.
>
> Hi,
>
> I want add some comments to your answers.
>
>>
>> It will clobber the registers indirectly, though, as soon as it
>> executes a branching instruction. The effect will be that calls from
>> bnd-checked code to bnd-checked code through the dynamic linker will
>> not succeed.
>
> I would not say that call will fail. Some bound info will just be
> lost. MPX binaries should still work correctly with old dynamic
> linker. The problem here is that when you decrease level of MPX
> support (use legacy dynamic linker, and legacy libraries) you decrease
> a quality of bound violation detection. BTW if new PLT section is used
> then table fixup after the first call will lead to correct bounds
> transfer in subsequent calls.
To make it clear, the sequence is
MPX code -> PLT -> ld.so -> PLT -> MPX library
If ld.so doesn't preserve bound registers, bound registers
will be cleared, which means the lower bound is 0 and
upper bound is -1 (MAX), when MPX library is reached.
The MPX library will work correctly, but without MPX
protections on pointers passed in registers.
--
H.J.