summarylogtreecommitdiffstats
path: root/0001-Mark-stack-as-not-executable-in-assembler-sources.patch
blob: c225f6541da1ac581b2432f3d5a74a7aa3d23a4e (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From c09e5b4b9346a5b52acbabb0b8870343cc79e366 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <grubber@grubber.cz>
Date: Thu, 18 Feb 2016 10:56:03 +0100
Subject: [PATCH 1/2] Mark stack as not executable in assembler sources

---
 src/asm_ia32/a.asm     | 10 ++++++++++
 src/asm_ia32/misc.asm  | 10 ++++++++++
 src/asm_ia32/tmap.asm  | 10 ++++++++++
 src/asm_ia32/tmap2.asm | 10 ++++++++++
 src/asm_ia32/tmap3.asm | 10 ++++++++++
 src/asm_x86_64/tmap3.s |  1 +
 6 files changed, 51 insertions(+)

diff --git a/src/asm_ia32/a.asm b/src/asm_ia32/a.asm
index 786396d..9530e4c 100644
--- a/src/asm_ia32/a.asm
+++ b/src/asm_ia32/a.asm
@@ -810,3 +810,13 @@ align 16
 GLOBAL _rtext_a_end
 _rtext_a_end:
 %endif
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf32
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf64
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
diff --git a/src/asm_ia32/misc.asm b/src/asm_ia32/misc.asm
index b825a4d..c694124 100644
--- a/src/asm_ia32/misc.asm
+++ b/src/asm_ia32/misc.asm
@@ -198,3 +198,13 @@ BestColor_MMX:
 		pop		ebx
 		emms
 		ret
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf32
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf64
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
diff --git a/src/asm_ia32/tmap.asm b/src/asm_ia32/tmap.asm
index fb372d4..05c90fd 100644
--- a/src/asm_ia32/tmap.asm
+++ b/src/asm_ia32/tmap.asm
@@ -1891,3 +1891,13 @@ _ASM_PatchPitch:
 		selfmod rtext_start, rtext_end
 		call	setpitch3
 		jmp		setvlinebpl_
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf32
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf64
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
diff --git a/src/asm_ia32/tmap2.asm b/src/asm_ia32/tmap2.asm
index 8fa141e..81d92be 100644
--- a/src/asm_ia32/tmap2.asm
+++ b/src/asm_ia32/tmap2.asm
@@ -638,3 +638,13 @@ rtext_end:
 GLOBAL _rtext_tmap2_end
 _rtext_tmap2_end:
 %endif
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf32
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf64
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
diff --git a/src/asm_ia32/tmap3.asm b/src/asm_ia32/tmap3.asm
index bafc336..7379cb7 100644
--- a/src/asm_ia32/tmap3.asm
+++ b/src/asm_ia32/tmap3.asm
@@ -342,3 +342,13 @@ shift12:	shr	ecx,16
 GLOBAL _rtext_tmap3_end
 _rtext_tmap3_end:
 %endif
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf32
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+%ifidn __OUTPUT_FORMAT__,elf64
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
diff --git a/src/asm_x86_64/tmap3.s b/src/asm_x86_64/tmap3.s
index 867d11c..e27f05f 100644
--- a/src/asm_x86_64/tmap3.s
+++ b/src/asm_x86_64/tmap3.s
@@ -139,3 +139,4 @@ vltepilog:
 		.align 16
 
 
+		.section	.note.GNU-stack,"",@progbits
-- 
2.7.2