This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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][RFA/RFC] Stack clash mitigation patch 02/08 - V3


On Sep 18 2017, Jeff Law <law@redhat.com> wrote:

> On 09/18/2017 10:09 AM, Andreas Schwab wrote:
>> On Sep 18 2017, Jeff Law <law@redhat.com> wrote:
>> 
>>> Can you confirm if the probe was in the red zone vs the live areas on
>>> the stack?
>> 
>> It overwrites a nearby variable.  sp + 8 happens to be the address of
>> file_entries_new_size.
>> 
>>    0x000140e8 <+1172>:  mov     r6, sp
>>    0x000140ec <+1176>:  add     r3, r3, #7
>>    0x000140f0 <+1180>:  bic     r3, r3, #7
>>    0x000140f4 <+1184>:  cmp     r3, #4096       ; 0x1000
>>    0x000140f8 <+1188>:  bcc     0x14110 <save_cache+1212>
>>    0x000140fc <+1192>:  sub     r3, r3, #4096   ; 0x1000
>>    0x00014100 <+1196>:  sub     sp, sp, #4096   ; 0x1000
>>    0x00014104 <+1200>:  cmp     r3, #4096       ; 0x1000
>>    0x00014108 <+1204>:  str     r0, [sp, #8]
>>    0x0001410c <+1208>:  bcs     0x140fc <save_cache+1192>
>>    0x00014110 <+1212>:  ldr     r7, [r11, #-56] ; 0xffffffc8
>>    0x00014114 <+1216>:  sub     sp, sp, r3
>>    0x00014118 <+1220>:  mov     r1, #0
>>    0x0001411c <+1224>:  add     r3, sp, #8
>>    0x00014120 <+1228>:  mov     r0, r3
>> => 0x00014124 <+1232>:  str     r0, [sp, #8]
>> 
>> Andreas.
>> 
> Or better yet, include your .i and .s files in their entirety and the
> gcc -v output

This was generated with a very simple and incomplete backport of
-fstack-clash-protection to gcc7.  What I get with your full patches
with gcc8 looks correct.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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