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 08/12] De-PLTize __stack_chk_fail internal calls within libc.so.


On 15 Dec 2016, Florian Weimer said:

> On 11/28/2016 01:32 PM, Nix wrote:
>> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
[...]
>> diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
>> index ce576c9..36908b5 100644
>> --- a/sysdeps/generic/symbol-hacks.h
>> +++ b/sysdeps/generic/symbol-hacks.h
>> @@ -4,4 +4,8 @@
>>  asm ("memmove = __GI_memmove");
>>  asm ("memset = __GI_memset");
>>  asm ("memcpy = __GI_memcpy");
>> +
>> +/* -fstack-protector generates calls to __stack_chk_fail, which need
>> +   similar adjustments to avoid going through the PLT.  */
>> +asm ("__stack_chk_fail = __stack_chk_fail_local");
>>  #endif
>
> We should do this only if we compile glibc with stack protector support enabled, and disable this for the files which we compile
> without stack protector.  I hope this will fix an assembler error while compiling __stack_chk_fail.c on ia64:

I don't think we need to disable it for *all* such files -- but at the
very least it must be disabled for debug/stack_chk_fail.c, and if we're
doing that it's probably easier to do as you suggest (though it's
invasive enough I'll have to kick another test cycle off, sigh).

Possible fix, untested:

diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index 36908b5..0679354 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -7,5 +7,7 @@ asm ("memcpy = __GI_memcpy");
 
 /* -fstack-protector generates calls to __stack_chk_fail, which need
    similar adjustments to avoid going through the PLT.  */
+#if defined __SSP__ || defined __SSP_ALL__ || defined __SSP_STRONG__
 asm ("__stack_chk_fail = __stack_chk_fail_local");
 #endif
+#endif


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