[tip:perf/core] perf tools: Fix perf stack to non executable on x86_64

From: tip-bot for Jiri Olsa
Date: Tue Feb 07 2012 - 14:35:12 EST

Commit-ID: 7a0153ee15575a4d07b5da8c96b79e0b0fd41a12
Gitweb: http://git.kernel.org/tip/7a0153ee15575a4d07b5da8c96b79e0b0fd41a12
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Mon, 6 Feb 2012 18:54:06 -0200
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Mon, 6 Feb 2012 18:54:06 -0200

perf tools: Fix perf stack to non executable on x86_64

By adding following objects:
the x86_64 perf binary ended up with executable stack.

The reason was that above object are assembler sourced and is missing the
GNU-stack note section. In such case the linker assumes that the final binary
should not be restricted at all and mark the stack as RWX.

Adding section ".note.GNU-stack" definition to mentioned object, with all
flags disabled, thus omiting this object from linker stack flags decision.

Problem introduced in:

$ git describe ea7872b

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=783570
Reported-by: Clark Williams <williams@xxxxxxxxxx>
Acked-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: stable@xxxxxxxxxx
Link: http://lkml.kernel.org/r/1328100848-5630-1-git-send-email-jolsa@xxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
[ committer note: Backported fix to perf/urgent (3.3-rc2+) ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
tools/perf/bench/mem-memcpy-x86-64-asm.S | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S
index a57b66e..185a96d 100644
--- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
+++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
@@ -1,2 +1,8 @@

#include "../../../arch/x86/lib/memcpy_64.S"
+ * We need to provide note.GNU-stack section, saying that we want
+ * NOT executable stack. Otherwise the final linking will assume that
+ * the ELF stack should not be restricted at all and set it RWX.
+ */
+.section .note.GNU-stack,"",@progbits
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/