This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add private_function for private functions within glibc [BZ #21598]


On Thu, Aug 10, 2017 at 5:33 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/09/2017 12:58 PM, H.J. Lu wrote:
>> On Wed, Aug 9, 2017 at 3:33 AM, Florian Weimer <fweimer@redhat.com> wrote:
>>> On 08/08/2017 08:25 PM, H.J. Lu wrote:
>>>> which is incompatible with Shadow Stack in Intel Control-flow Enforcement
>>>> Technology (CET) instructions:
>>>>
>>>> https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf
>>>>
>>>> since shadow stack doesn't match return stack.  We need to use register
>>>> indirect branch via %ecx.  That means only 2 parameters can be passed
>>>> in registers for external function calls with lazy binding when shadow
>>>> stack is enabled.  However, internal_function, which should be used only
>>>> with hidden function within libc.so, are also used with private function
>>>> calls between different shared objects of glibc.
>>>
>>> I think we should work towards removing internal_function instead.  It's
>>> an unnecessary maintenance overhead for those working on other
>>> architectures besides i386.
>>
>> Some i386 assembly codes call internal functions directly:
>>
>> https://sourceware.org/ml/libc-alpha/2017-06/msg00764.html
>>
>> Removing internal_function is too risky for i386.
>
> I can use a hacked GCC which adds name mangling for regparm functions,
> so that we get link errors if there are references from assembler code,
> and rewrite that assembler code.
>
> Would that work for you?
>

It is OK to use __attribute__ ((regparm (3))) with CET as long as the
function is hidden.  We need to at least keep __attribute__ ((regparm (1)))
on ___tls_get_addr since it is the part of TLS ABI and we may have to
support  __attribute__ ((regparm (3))) for lazy binding when CET is disabled
forever.  Remove it from glibc doesn't buy us much.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]