Skip to contentSkip to conversation

arm64: ftrace: Define ftrace_stub_graph only with FUNCTION_GRAPH_TRACER

PATCH Applied Sami Tolvanen 5 participants 5 messages Nov 9, 2022 – Nov 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: ftrace: Define ftrace_stub_graph only with FUNCTION_GRAPH_TRACER

The 0-day bot reports that arm64 builds with CONFIG_CFI_CLANG + CONFIG_FTRACE are broken when CONFIG_FUNCTION_GRAPH_TRACER is not enabled:

ld.lld: error: undefined symbol: __kcfi_typeid_ftrace_stub_graph

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by entry-ftrace.S:299 (arch/arm64/kernel/entry-ftrace.S:299)

              arch/arm64/kernel/entry-ftrace.o:(.text+0x48) in archive vmlinux.a

This is caused by ftrace_stub_graph using SYM_TYPE_FUNC_START when the address of the function is not taken in any C translation unit.

Fix the build by only defining ftrace_stub_graph when it's actually needed, i.e. with CONFIG_FUNCTION_GRAPH_TRACER.

Fixes 883bbbffa5a4 ("ftrace,kcfi: Separate ftrace_stub() and ftrace_stub_graph()")
---
 arch/arm64/kernel/entry-ftrace.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/entry-ftrace.S +1 -1
index 795344ab4ec4..322a831f8ede 100644
@@ -299,11 +299,11 @@ SYM_TYPED_FUNC_START(ftrace_stub)
 	ret
 SYM_FUNC_END(ftrace_stub)
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 SYM_TYPED_FUNC_START(ftrace_stub_graph)
 	ret
 SYM_FUNC_END(ftrace_stub_graph)
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 /*
  * void return_to_handler(void)
  *

base-commit: f141df371335645ce29a87d9683a3f79fba7fd67

Signature · 1 line
2.38.1.431.g37b22c650d-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Wed, 9 Nov 2022 19:28:31 +0000 Sami Tolvanen <[email protected]>…

The 0-day bot reports that arm64 builds with CONFIG_CFI_CLANG + CONFIG_FTRACE are broken when CONFIG_FUNCTION_GRAPH_TRACER is not enabled:

ld.lld: error: undefined symbol: __kcfi_typeid_ftrace_stub_graph

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by entry-ftrace.S:299 (arch/arm64/kernel/entry-ftrace.S:299)

              arch/arm64/kernel/entry-ftrace.o:(.text+0x48) in archive vmlinux.a

This is caused by ftrace_stub_graph using SYM_TYPE_FUNC_START when the address of the function is not taken in any C translation unit.

Quoted 7 lines

Fix the build by only defining ftrace_stub_graph when it's actually needed, i.e. with CONFIG_FUNCTION_GRAPH_TRACER.

Fixes 883bbbffa5a4 ("ftrace,kcfi: Separate ftrace_stub() and ftrace_stub_graph()")

This looks good to me.

Thanks!

Quoted 26 lines
---
 arch/arm64/kernel/entry-ftrace.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/entry-ftrace.S +1 -1
index 795344ab4ec4..322a831f8ede 100644
@@ -299,11 +299,11 @@ SYM_TYPED_FUNC_START(ftrace_stub)
 	ret
 SYM_FUNC_END(ftrace_stub)
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 SYM_TYPED_FUNC_START(ftrace_stub_graph)
 	ret
 SYM_FUNC_END(ftrace_stub_graph)
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 /*
  * void return_to_handler(void)
  *

base-commit: f141df371335645ce29a87d9683a3f79fba7fd67

Signature · 1 line
2.38.1.431.g37b22c650d-goog
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
reviewer Acked-by on v1 1/1
#2 lore raw
In reply to Sami Tolvanen
Quoted 11 lines · Sami Tolvanen

The 0-day bot reports that arm64 builds with CONFIG_CFI_CLANG + CONFIG_FTRACE are broken when CONFIG_FUNCTION_GRAPH_TRACER is not enabled:

ld.lld: error: undefined symbol: __kcfi_typeid_ftrace_stub_graph

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by entry-ftrace.S:299 (arch/arm64/kernel/entry-ftrace.S:299)

              arch/arm64/kernel/entry-ftrace.o:(.text+0x48) in archive vmlinux.a

This is caused by ftrace_stub_graph using SYM_TYPE_FUNC_START when the address of the function is not taken in any C translation unit.

Quoted 7 lines

Fix the build by only defining ftrace_stub_graph when it's actually needed, i.e. with CONFIG_FUNCTION_GRAPH_TRACER.

Fixes 883bbbffa5a4 ("ftrace,kcfi: Separate ftrace_stub() and ftrace_stub_graph()")

Mark.

Quoted 26 lines
---
 arch/arm64/kernel/entry-ftrace.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/entry-ftrace.S +1 -1
index 795344ab4ec4..322a831f8ede 100644
@@ -299,11 +299,11 @@ SYM_TYPED_FUNC_START(ftrace_stub)
 	ret
 SYM_FUNC_END(ftrace_stub)
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 SYM_TYPED_FUNC_START(ftrace_stub_graph)
 	ret
 SYM_FUNC_END(ftrace_stub_graph)
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 /*
  * void return_to_handler(void)
  *

base-commit: f141df371335645ce29a87d9683a3f79fba7fd67

Signature · 1 line
2.38.1.431.g37b22c650d-goog
Reviewed-by on v1 1/1
#3 lore raw
In reply to Sami Tolvanen
Quoted 11 lines · Sami Tolvanen

The 0-day bot reports that arm64 builds with CONFIG_CFI_CLANG + CONFIG_FTRACE are broken when CONFIG_FUNCTION_GRAPH_TRACER is not enabled:

ld.lld: error: undefined symbol: __kcfi_typeid_ftrace_stub_graph

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by entry-ftrace.S:299 (arch/arm64/kernel/entry-ftrace.S:299)

              arch/arm64/kernel/entry-ftrace.o:(.text+0x48) in archive vmlinux.a

This is caused by ftrace_stub_graph using SYM_TYPE_FUNC_START when the address of the function is not taken in any C translation unit.

Quoted 7 lines

Fix the build by only defining ftrace_stub_graph when it's actually needed, i.e. with CONFIG_FUNCTION_GRAPH_TRACER.

Fixes 883bbbffa5a4 ("ftrace,kcfi: Separate ftrace_stub() and ftrace_stub_graph()")
Signature · 1 line
Kees Cook
maintainer Applied
#4 lore raw
In reply to Sami Tolvanen
Quoted 9 lines · Sami Tolvanen

The 0-day bot reports that arm64 builds with CONFIG_CFI_CLANG + CONFIG_FTRACE are broken when CONFIG_FUNCTION_GRAPH_TRACER is not enabled:

ld.lld: error: undefined symbol: __kcfi_typeid_ftrace_stub_graph

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by entry-ftrace.S:299 (arch/arm64/kernel/entry-ftrace.S:299)

              arch/arm64/kernel/entry-ftrace.o:(.text+0x48) in archive vmlinux.a

[...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: ftrace: Define ftrace_stub_graph only with FUNCTION_GRAPH_TRACER

      https://git.kernel.org/arm64/c/2598ac6ec493
Signature · 1 line
Catalin