Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507622

[PATCH] x86: Fix export for mcount and __fentry__

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [PATCH] x86: Fix export for mcount and __fentry__
Date 2016-10-24 21:10 +0200
Message-ID <svSNc-3nI-43@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Commit 784d5699eddc5 ("x86: move exports to actual definitions") removed the
EXPORT_SYMBOL(__fentry__) and EXPORT_SYMBOL(mcount) from x8664_ksyms_64.c,
and added EXPORT_SYMBOL(function_hook) in mcount_64.S instead. The problem
is that function_hook isn't a function at all, but a macro that is defined
as either mcount or __fentry__ depending on the support from gcc.

Originally, I thought this was a macro issue, like what __stringify()
is used for. But the problem is a bit deeper. The Makefile.build has
some magic that does post processing of files to create the CRC
bindings. It does some searches for EXPORT_SYMBOL() and because it
finds a macro name and not the actual functions, this causes
function_hook not to be converted into mcount or __fentry__ and they
are missed.

Instead of adding more magic to Makefile.build, just add
EXPORT_SYMBOL() for mcount and __fentry__ where the ifdef is used.
Since this is assembly and not C, it doesn't require being set after
the function is defined.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/mcount_64.S |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-trace.git/arch/x86/kernel/mcount_64.S
===================================================================
--- linux-trace.git.orig/arch/x86/kernel/mcount_64.S	2016-10-24 11:35:14.410524414 -0400
+++ linux-trace.git/arch/x86/kernel/mcount_64.S	2016-10-24 11:37:23.593443665 -0400
@@ -18,8 +18,10 @@
 
 #ifdef CC_USING_FENTRY
 # define function_hook	__fentry__
+EXPORT_SYMBOL(__fentry__)
 #else
 # define function_hook	mcount
+EXPORT_SYMBOL(mcount)
 #endif
 
 /* All cases save the original rbp (8 bytes) */
@@ -295,7 +297,6 @@ trace:
 	jmp fgraph_trace
 END(function_hook)
 #endif /* CONFIG_DYNAMIC_FTRACE */
-EXPORT_SYMBOL(function_hook)
 #endif /* CONFIG_FUNCTION_TRACER */
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86: Fix export for mcount and __fentry__ Steven Rostedt <rostedt@goodmis.org> - 2016-10-24 21:10 +0200
  Re: [PATCH] x86: Fix export for mcount and __fentry__ Borislav Petkov <bp@alien8.de> - 2016-10-24 21:20 +0200
  [tip:x86/urgent] x86: Fix export for mcount and __fentry__ tip-bot for Steven Rostedt <tipbot@zytor.com> - 2016-10-26 12:50 +0200

csiph-web