diff options
author | Peter Oberparleiter <oberpar@linux.vnet.ibm.com> | 2009-07-05 15:08:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-06 16:57:03 -0400 |
commit | f386c61fe1a1f36f0e434f1b577e6b112698caf7 (patch) | |
tree | 40578bc7a067fdb397c1d6dfcc165a433a7c4933 /arch/x86/kernel/Makefile | |
parent | 28df30e61b46a33d1f0bb60757747396886ef687 (diff) |
gcov: exclude code operating in userspace from profiling
Fix for this issue on x86_64:
rostedt@goodmis.org wrote:
> On bootup of the latest kernel my init segfaults. Debugging it,
> I found that vread_tsc (a vsyscall) increments some strange
> kernel memory:
>
> 0000000000000000 <vread_tsc>:
> 0: 55 push %rbp
> 1: 48 ff 05 00 00 00 00 incq 0(%rip)
> # 8 <vread_tsc+0x8>
> 4: R_X86_64_PC32 .bss+0x3c
> 8: 48 89 e5 mov %rsp,%rbp
> b: 66 66 90 xchg %ax,%ax
> e: 48 ff 05 00 00 00 00 incq 0(%rip)
> # 15 <vread_tsc+0x15>
> 11: R_X86_64_PC32 .bss+0x44
> 15: 66 66 90 xchg %ax,%ax
> 18: 48 ff 05 00 00 00 00 incq 0(%rip)
> # 1f <vread_tsc+0x1f>
> 1b: R_X86_64_PC32 .bss+0x4c
> 1f: 0f 31 rdtsc
>
>
> Those "incq" is very bad to happen in vsyscall memory, since
> userspace can not modify it. You need to make something prevent
> profiling of vsyscall memory (like I do with ftrace).
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel/Makefile')
-rw-r--r-- | arch/x86/kernel/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 6c327b852e23..430d5b24af7b 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -26,6 +26,8 @@ CFLAGS_tsc.o := $(nostackp) | |||
26 | CFLAGS_paravirt.o := $(nostackp) | 26 | CFLAGS_paravirt.o := $(nostackp) |
27 | GCOV_PROFILE_vsyscall_64.o := n | 27 | GCOV_PROFILE_vsyscall_64.o := n |
28 | GCOV_PROFILE_hpet.o := n | 28 | GCOV_PROFILE_hpet.o := n |
29 | GCOV_PROFILE_tsc.o := n | ||
30 | GCOV_PROFILE_paravirt.o := n | ||
29 | 31 | ||
30 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o | 32 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o |
31 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o | 33 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o |