This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so.
* Florian Weimer:
> On 12/15/2016 09:00 PM, Nix wrote:
>
>>> Could you try this?
>>>
>>> # if defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
>>> asm (".hidden __stack_chk_fail_local");
>>> asm ("__stack_chk_fail = __stack_chk_fail_local");
>>> # endif
>>
>> No change :( the only reference to __stack_chk_fail is still inside
>> stack_chk_fail_local:
>>
>> Symbols from libc_pic.a[libc-stack_chk_fail_local.os]:
>>
>> Name Value Class Type Size Line Section
>>
>> __GI_memcpy ||GLOBAL|NOTYPE || |UNDEF
>> __GI_memmove ||GLOBAL|NOTYPE || |UNDEF
>> __GI_memset ||GLOBAL|NOTYPE || |UNDEF
>> __stack_chk_fail ||GLOBAL|NOTYPE || |UNDEF
>> __stack_chk_fail_local |0000000000000000|GLOBAL|FUNC
>> |0000000000000010| |.text
>> libc-stack_chk_fail_local.c|0000000000000000|LOCAL |FILE
>> |0000000000000000| |ABS
>>
>> (And, of course, this code is not affected by your suggestion, because
>> it's compiled with -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0.)
>
> I think this attempt at PLT avoidance within libc.so itself is subtly
> wrong. We need to mirror more closely what
> libc_hidden_proto/libc_hidden_def does, and perhaps disentangle this
> from the __stack_chk_fail_local definition used in other DSOs.
>
> I think this means removing any definition of a C function definition
> called __stack_chk_fail_local from libc.so, and instead use a strong
> alias from __stack_chk_fail to __stack_chk_fail_local to define the
> symbol. The alias will not incorporate a PLT reference. If you look at
> include/libc-symbols.h, strong_alias and hidden_def are quite similar.
It may also be a good idea to switch to a different symbol for
__stack_chk_fail_local because this collides with the name GCC uses on
some architectures for a similar purpose. Or is this the intent here?