]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.22/perf-tools-fix-perf-stack-to-non-executable-on-x86_64.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.0.22 / perf-tools-fix-perf-stack-to-non-executable-on-x86_64.patch
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
5
6 From: Jiri Olsa <jolsa@redhat.com>
7
8 commit 7a0153ee15575a4d07b5da8c96b79e0b0fd41a12 upstream.
9
10 By adding following objects:
11 bench/mem-memcpy-x86-64-asm.o
12 the x86_64 perf binary ended up with executable stack.
13
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.
17
18 Adding section ".note.GNU-stack" definition to mentioned object, with all
19 flags disabled, thus omiting this object from linker stack flags decision.
20
21 Problem introduced in:
22
23 $ git describe ea7872b
24 v2.6.37-rc2-19-gea7872b
25
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>
38
39 ---
40 tools/perf/bench/mem-memcpy-x86-64-asm.S | 6 ++++++
41 1 file changed, 6 insertions(+)
42
43 --- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
44 +++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
45 @@ -1,2 +1,8 @@
46
47 #include "../../../arch/x86/lib/memcpy_64.S"
48 +/*
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.
52 + */
53 +.section .note.GNU-stack,"",@progbits