1 From 7a0153ee15575a4d07b5da8c96b79e0b0fd41a12 Mon Sep 17 00:00:00 2001
2 From: Jiri Olsa <jolsa@redhat.com>
3 Date: Mon, 6 Feb 2012 18:54:06 -0200
4 Subject: perf tools: Fix perf stack to non executable on x86_64
6 From: Jiri Olsa <jolsa@redhat.com>
8 commit 7a0153ee15575a4d07b5da8c96b79e0b0fd41a12 upstream.
10 By adding following objects:
11 bench/mem-memcpy-x86-64-asm.o
12 the x86_64 perf binary ended up with executable stack.
14 The reason was that above object are assembler sourced and is missing the
15 GNU-stack note section. In such case the linker assumes that the final binary
16 should not be restricted at all and mark the stack as RWX.
18 Adding section ".note.GNU-stack" definition to mentioned object, with all
19 flags disabled, thus omiting this object from linker stack flags decision.
21 Problem introduced in:
23 $ git describe ea7872b
24 v2.6.37-rc2-19-gea7872b
26 Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=783570
27 Reported-by: Clark Williams <williams@redhat.com>
28 Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
29 Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
30 Cc: Ingo Molnar <mingo@elte.hu>
31 Cc: Paul Mackerras <paulus@samba.org>
32 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
33 Link: http://lkml.kernel.org/r/1328100848-5630-1-git-send-email-jolsa@redhat.com
34 Signed-off-by: Jiri Olsa <jolsa@redhat.com>
35 [ committer note: Backported fix to perf/urgent (3.3-rc2+) ]
36 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
40 tools/perf/bench/mem-memcpy-x86-64-asm.S | 6 ++++++
41 1 file changed, 6 insertions(+)
43 --- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
44 +++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
47 #include "../../../arch/x86/lib/memcpy_64.S"
49 + * We need to provide note.GNU-stack section, saying that we want
50 + * NOT executable stack. Otherwise the final linking will assume that
51 + * the ELF stack should not be restricted at all and set it RWX.
53 +.section .note.GNU-stack,"",@progbits