[swift-dev] Standard shared libraries with executable stack

Dmitri Gribenko gribozavr at gmail.com
Mon Jun 13 22:33:04 CDT 2016


On Sat, Jun 11, 2016 at 8:12 AM, 김종수 via swift-dev <swift-dev at swift.org> wrote:
> I am testing Swift in "Windows Subsystem for Linux" which is a new feature
> of Windows 10 Anniversary Update scheduled in this year. WSL is Ubuntu LTS
> 14.04 compatible in user space.
>
> Swift runtime libraries such as libswiftCore.so are marked Executable Stack,
> which have no problem in Linux.
>
> dlopen()'ing swift runtime libraries causes mprotect() with PROT_GROWSDOWN,
> which is not documented but verified with strace.
>
> WSL has not implemented PROT_GROWSDOWN feature because of clean room
> development.
>
> Swift runtime libraries had not been marked Executable Stack before Febrary
> snapshot. And cmark and llvm/clang shared libraries are not marked too.
>
> ***My request is swift runtime libraries be not marked Executable Stack.***

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?

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.

Dmitri

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