From df973763bbc34c8cc258c48f6508f2f072c13acc Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 29 Aug 2019 14:12:43 +0100 Subject: [PATCH] Fix linker marking entire executable as executable stack See: https://wiki.ubuntu.com/SecurityTeam/Roadmap/ExecutableStacks See: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart --- src/crypto/cn/asm/CryptonightR_template.S | 4 ++++ src/crypto/cn/asm/cn_main_loop.S | 4 ++++ src/crypto/cn/asm/win64/cn_main_loop.S | 4 ++++ src/crypto/randomx/jit_compiler_x86_static.S | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/crypto/cn/asm/CryptonightR_template.S b/src/crypto/cn/asm/CryptonightR_template.S index d2974d160..bfedeb303 100644 --- a/src/crypto/cn/asm/CryptonightR_template.S +++ b/src/crypto/cn/asm/CryptonightR_template.S @@ -1593,3 +1593,7 @@ FN_PREFIX(CryptonightR_instruction_mov254): FN_PREFIX(CryptonightR_instruction_mov255): FN_PREFIX(CryptonightR_instruction_mov256): + +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif diff --git a/src/crypto/cn/asm/cn_main_loop.S b/src/crypto/cn/asm/cn_main_loop.S index 7aed6c20b..609b0fe8e 100644 --- a/src/crypto/cn/asm/cn_main_loop.S +++ b/src/crypto/cn/asm/cn_main_loop.S @@ -71,3 +71,7 @@ FN_PREFIX(cnv2_rwz_double_mainloop_asm): add rsp, 48 ret 0 mov eax, 3735929054 + +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif diff --git a/src/crypto/cn/asm/win64/cn_main_loop.S b/src/crypto/cn/asm/win64/cn_main_loop.S index 63c3a8ba6..7dcad89e8 100644 --- a/src/crypto/cn/asm/win64/cn_main_loop.S +++ b/src/crypto/cn/asm/win64/cn_main_loop.S @@ -43,3 +43,7 @@ cnv2_rwz_double_mainloop_asm: #include "cn2/cnv2_rwz_double_main_loop.inc" ret 0 mov eax, 3735929054 + +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif diff --git a/src/crypto/randomx/jit_compiler_x86_static.S b/src/crypto/randomx/jit_compiler_x86_static.S index 67d2bdbc8..b6338d85c 100644 --- a/src/crypto/randomx/jit_compiler_x86_static.S +++ b/src/crypto/randomx/jit_compiler_x86_static.S @@ -206,3 +206,7 @@ DECL(randomx_reciprocal_fast): mov rcx, rdi #endif #include "asm/randomx_reciprocal.inc" + +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif