This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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, GOLD, AArch64] default stack not executable


Testcase attached.

On Thu, Sep 21, 2017 at 1:26 PM, Jim Wilson <jim.wilson@linaro.org> wrote:
> For aarch64, ld.bfd makes the stack not executable when a GNU-stack note is
> missing.  Note that elf_backend_default_execstack is 0 in bfd/elfnn-aarch64.c.
>
> However, ld.gold makes the stack executable when a GNU-stack note is missing.
> Note that is_default_stack_executable is true in gold/aarch64.cc.
>
> This appears to be a bug in gold.  It also looks like 64-bit ppc gets this
> wrong also, though I have not tested that.
>
> The following patch fixes this for aarch64 by changing gold aarch64 to make
> is_default_stack_executable false.  This was tested with a make check, and
> there were no regressions.  It was also verified against a testcase using a
> .s file with a missing GNU-stack note.
>
>         gold/
>         * aarch64.cc (Target_aarch64::aarch64_info): Set
>         is_default_stack_executable to false.
> ---
>  gold/aarch64.cc | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gold/aarch64.cc b/gold/aarch64.cc
> index a72e2c3..4c6e920 100644
> --- a/gold/aarch64.cc
> +++ b/gold/aarch64.cc
> @@ -3523,7 +3523,7 @@ const Target::Target_info Target_aarch64<64, false>::aarch64_info =
>    false,               // has_make_symbol
>    false,               // has_resolve
>    false,               // has_code_fill
> -  true,                        // is_default_stack_executable
> +  false,               // is_default_stack_executable
>    true,                        // can_icf_inline_merge_sections
>    '\0',                        // wrap_char
>    "/lib/ld.so.1",      // program interpreter
> @@ -3551,7 +3551,7 @@ const Target::Target_info Target_aarch64<32, false>::aarch64_info =
>    false,               // has_make_symbol
>    false,               // has_resolve
>    false,               // has_code_fill
> -  true,                        // is_default_stack_executable
> +  false,               // is_default_stack_executable
>    false,               // can_icf_inline_merge_sections
>    '\0',                        // wrap_char
>    "/lib/ld.so.1",      // program interpreter
> @@ -3579,7 +3579,7 @@ const Target::Target_info Target_aarch64<64, true>::aarch64_info =
>    false,               // has_make_symbol
>    false,               // has_resolve
>    false,               // has_code_fill
> -  true,                        // is_default_stack_executable
> +  false,               // is_default_stack_executable
>    true,                        // can_icf_inline_merge_sections
>    '\0',                        // wrap_char
>    "/lib/ld.so.1",      // program interpreter
> @@ -3607,7 +3607,7 @@ const Target::Target_info Target_aarch64<32, true>::aarch64_info =
>    false,               // has_make_symbol
>    false,               // has_resolve
>    false,               // has_code_fill
> -  true,                        // is_default_stack_executable
> +  false,               // is_default_stack_executable
>    false,               // can_icf_inline_merge_sections
>    '\0',                        // wrap_char
>    "/lib/ld.so.1",      // program interpreter
> --
> 2.7.4
>

Attachment: reproduce.txt
Description: Text document


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