[swift-dev] Standard shared libraries with executable stack

Dmitri Gribenko gribozavr at gmail.com
Fri Jun 17 02:27:49 CDT 2016


Hi,

While there wight be an issue in WSL with executable stacks, Swift
does not really need one.  If the binary is actually asking for one,
it would be great if we could figure out a way to ask the gold linker
to not mark stacks as executable.

Dmitri

On Thu, Jun 16, 2016 at 11:39 PM, Sangjin Han <tinysun.net at gmail.com> wrote:
> Hi, Kim.
>
> The test result is same on WSL build 14342.
>
> There is similar report in
> https://github.com/Microsoft/BashOnWindows/issues/286 .
> MS engineer recognized this and replied that give them feedback on the
> uservoice for prioritizing, currently it has only 3 votes.
>
> -Han Sangjin
>
> 2016-06-16 21:17 GMT+09:00 Jongsu Kim via swift-dev <swift-dev at swift.org>:
>>
>> Hi,
>>
>>> This could have been caused by our switch from the BFD linker to gold.
>>> Could you try linking a hello world program using gold linker and
>>> running it in WSL?
>>
>>
>> I tried to build Swift by not using -fuse-gold option and the result was
>> same.
>>
>>
>>> Are you sure that PROT_GROWSDOWN is the flag that enables executable
>>> stack?  I thought that's what PROT_EXEC is for.  I'm not sure what
>>> PROT_GROWSDOWN actually changes, if I were to speculate, I'd say it
>>> could be a marker that means "this is a stack" or maybe even be just a
>>> performance hint.
>>
>>
>> You are right. The executable stack is enabled by PROT_EXEC.
>>
>> But Swift shared library's executable stack seems to set PROT_EXEC AND
>> PROT_GROWSDOWN according to strace.
>>
>> I don't know what causes Swift shared library to have executable stack
>> since Febrary 25 snapshot. Febrary 8 snapshot and Swift 2.X branches have no
>> such executable stack shared library.
>>
>> Thanks,
>>
>>
>> -Kim, Jongsu
>>
>> _______________________________________________
>> swift-dev mailing list
>> swift-dev at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-dev
>>
>



-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-dev mailing list