[PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so.

Nix nix@esperi.org.uk
Thu Dec 15 20:00:00 GMT 2016


On 15 Dec 2016, Florian Weimer verbalised:

> On 12/15/2016 06:24 PM, Nix wrote:
>> This causes (minor) problems on SPARC:
>>
>> Extra PLT reference: libc.so: __stack_chk_fail
>>
>> Whether we can disregard this, I don't know, but it does feel wrong.
>
> Well, avoiding this is the point of __stack_chk_fail_local, isn't it?
> So we surely can't ignore it.

Agreed. (I just wasn't sure I could remember what this was added for...)

> I think what is going on is that once a symbol has a hidden anywhere
> in a static link, all references to it are turned hidden. Previously,
> this hidden reference occurred in the file which *defined*
> __stack_chk_fail_local, but is now gone from there. (At the assembler

Oof. And with no such reference, it ends up visible again...

> 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.)

-- 
NULL && (void)



More information about the Libc-alpha mailing list