From 51d003033bc15d215a6860714190edacecd724ab Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 11 Sep 2014 14:49:54 +0100 Subject: [PATCH 14/19] ppc, ppc64, ppc64le: Mark stack as non-executable. The same fix as this one, which was only fully applied to i686 & x86-64: http://caml.inria.fr/mantis/view.php?id=4564 --- asmcomp/power/emit.mlp | 3 ++- asmcomp/power64/emit.mlp | 3 ++- asmcomp/power64le/emit.mlp | 3 ++- asmrun/power-elf.S | 3 +++ asmrun/power64-elf.S | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp index 4344085..717ab12 100644 --- a/asmcomp/power/emit.mlp +++ b/asmcomp/power/emit.mlp @@ -927,4 +927,5 @@ let end_assembly() = ` .long ({emit_label lbl} - .) + {emit_int32 ofs}\n`); efa_def_label = (fun l -> `{emit_label l}:\n`); efa_string = (fun s -> emit_bytes_directive " .byte " (s ^ "\000")) - } + }; + `.section .note.GNU-stack,\"\",%progbits; .previous\n` diff --git a/asmcomp/power64/emit.mlp b/asmcomp/power64/emit.mlp index 9fd59b2..4e0317a 100644 --- a/asmcomp/power64/emit.mlp +++ b/asmcomp/power64/emit.mlp @@ -990,4 +990,5 @@ let end_assembly() = `{emit_symbol lbl}:\n`; ` .quad {emit_int (List.length !frame_descriptors)}\n`; List.iter emit_frame !frame_descriptors; - frame_descriptors := [] + frame_descriptors := []; + `.section .note.GNU-stack,\"\",%progbits; .previous\n` diff --git a/asmcomp/power64le/emit.mlp b/asmcomp/power64le/emit.mlp index 3f34102..60df72c 100644 --- a/asmcomp/power64le/emit.mlp +++ b/asmcomp/power64le/emit.mlp @@ -983,4 +983,5 @@ let end_assembly() = `{emit_symbol lbl}:\n`; ` .quad {emit_int (List.length !frame_descriptors)}\n`; List.iter emit_frame !frame_descriptors; - frame_descriptors := [] + frame_descriptors := []; + `.section .note.GNU-stack,\"\",%progbits; .previous\n` diff --git a/asmrun/power-elf.S b/asmrun/power-elf.S index facbfbf..14d28a0 100644 --- a/asmrun/power-elf.S +++ b/asmrun/power-elf.S @@ -478,3 +478,6 @@ caml_system__frametable: .long .L105 + 4 /* return address into callback */ .short -1 /* negative size count => use callback link */ .short 0 /* no roots here */ + +/* Mark stack as non-executable, PR#4564 */ + .section .note.GNU-stack,"",%progbits diff --git a/asmrun/power64-elf.S b/asmrun/power64-elf.S index 98c42e2..b7bfce4 100644 --- a/asmrun/power64-elf.S +++ b/asmrun/power64-elf.S @@ -577,3 +577,5 @@ caml_system__frametable: .short 0 /* no roots here */ .align 3 +/* Mark stack as non-executable, PR#4564 */ + .section .note.GNU-stack,"",%progbits -- 2.3.1