summaryrefslogtreecommitdiff
path: root/execstack.patch
blob: f8370a4787c2dc5da3aa3cfbb9f7cd52bdd6498e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 3739e565f8fa09b3a31ba8f563c518480585f6f9 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Sat, 11 Jun 2022 23:29:24 +0200
Subject: [PATCH] RTS: Add stack marker to StgCRunAsm.S

Every object file must be properly marked for non-executable stack, even if it
contains no code.
---
 rts/StgCRunAsm.S | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S
index aed3241d12..9216e6c759 100644
--- a/rts/StgCRunAsm.S
+++ b/rts/StgCRunAsm.S
@@ -66,8 +66,6 @@ StgReturn:
         addi 12,1,-(8*18)
         bl _restgpr1_14
         b _restfpr_14
-
-	.section	.note.GNU-stack,"",@progbits
 # else // linux_HOST_OS
 # error Only Linux support for power64 little endian right now.
 # endif
@@ -231,8 +229,6 @@ StgReturn:
 	.cfi_endproc
 	.size StgReturn, .-StgReturn
 
-	.section	.note.GNU-stack,"",@progbits
-
 #elif defined(riscv64_HOST_ARCH)
 # define STACK_FRAME_SIZE (RESERVED_C_STACK_BYTES+208)
 	.text
@@ -374,8 +370,11 @@ StgReturn:
 	ret
 	.cfi_endproc
 	.size StgReturn, .-StgReturn
-
-	.section	.note.GNU-stack,"",@progbits
 #endif
 
 #endif /* !USE_MINIINTERPRETER */
+
+/* mark stack as nonexecutable */
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",@progbits
+#endif
-- 
2.37.0