Skip to content

Commit b385083

Browse files
committed
fiber/switch_context_riscv.S: disable executable stack
Like it is done for the other assembly files, add the GNU-stack note. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 9db6d95 commit b385083

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

runtime/druntime/src/core/thread/fiber/switch_context_riscv.S

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
* Authors: Denis Feklushkin
77
*/
88

9+
#if (__linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__) && __ELF__
10+
/*
11+
* Mark the resulting object file as not requiring execution permissions on
12+
* stack memory. The absence of this section would mark the whole resulting
13+
* library as requiring an executable stack, making it impossible to
14+
* dynamically load druntime on several Linux platforms where this is
15+
* forbidden due to security policies.
16+
*/
17+
.section .note.GNU-stack,"",%progbits
18+
#endif
19+
20+
921
#if defined(__riscv)
1022

1123
// For save/load a register in memory, regardless of the size of machine register bit size

0 commit comments

Comments
 (0)