On 05/02/2018 06:17 PM, Magnus Granberg wrote:
> torsdag 3 maj 2018 kl. 01:07:51 CEST skrev  Daniel Santos:
>> Hello
>>
>> On 05/01/2018 06:32 AM, Magnus Granberg wrote:
>>> New patch
>>> libgcc/ChangeLog:
>>>
>>> 2018-05-01  Magnus Granberg  <zo...@gentoo.org>
>>>
>>>     * config/i386/resms64.h: Add .note.GNU-stack section
>>>     * config/i386/resms64f.h: Likewise.
>>>     * config/i386/resms64fx.h: Likewise.
>>>     * config/i386/resms64x.h: Likewise.
>>>     * config/i386/savms64.h: Likewise.
>>>     * config/i386/savms64f.h: Likewise.
>>>
>>> ---
>> Well this isn't correct either because you are outside of the inclusion
>> guard.  Can you please move this up a line?
>>
>> Thanks,
>> Daniel
> /libgcc/ChangeLog:
> 2018-05-01  Magnus Granberg  <zo...@gentoo.org>
>
>       * config/i386/resms64.h: Add .note.GNU-stack section
>       * config/i386/resms64f.h: Likewise.
>       * config/i386/resms64fx.h: Likewise.
>       * config/i386/resms64x.h: Likewise.
>       * config/i386/savms64.h: Likewise.
>       * config/i386/savms64f.h: Likewise.
>
> ---

No, I meant to move the changes up a line so that, if for some reason
the header was included twice, that it wouldn't output the section
twice.  Example:

 MS2SYSV_STUB_END(savms64_18) 
  
+#if·defined(__linux__)·&&·defined(__ELF__) 
+.section·.note.GNU-stack,"",%progbits 
+#endif
 #endif·/*·__x86_64__·*/ 


But upon further reflection, I think it can be cleanly added to
i386-asm.h.  Does that look sane Jakub?  (I haven't tried it)

Also, for the sake of my education, I don't exactly understand what the
problem is as I haven't been keeping up with pax and hardening.  I just
want to clarify that the stack shouldn't be executable.  These are not
actual "functions" per-se (i.e., they do not adhere to any ABI), they
operate on the stack of the calling function.

Thanks,
Daniel


diff --git a/libgcc/config/i386/i386-asm.h b/libgcc/config/i386/i386-asm.h
index 267133a9b75..7eb3c12fc85 100644
--- a/libgcc/config/i386/i386-asm.h
+++ b/libgcc/config/i386/i386-asm.h
@@ -80,6 +80,10 @@ ASMNAME(fn):
 
 #ifdef MS2SYSV_STUB_PREFIX
 
+# if·defined(__linux__)·&&·defined(__ELF__)
+.section·.note.GNU-stack,"",%progbits
+# endif
+
 # define MS2SYSV_STUB_BEGIN(base_name) \
 	HIDDEN_FUNC(PASTE2(MS2SYSV_STUB_PREFIX, base_name))
 

Reply via email to