Skip to contentSkip to conversation

x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER

PATCH Applied Eric Biggers 3 participants 4 messages Feb 9, 2018 – Feb 13, 2018

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

PATCH 1/1 x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER

This is a build fix for the 4.4 PTI backport. 4.4 kernels do not have commit be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections") which went into 4.6. Consequently, the irqentry sections are only created when CONFIG_FUNCTION_GRAPH_TRACER is enabled, not also when CONFIG_KASAN is enabled. Therefore, fix the condition for trying to add a user mapping for this section.

This fixes the following build error:

arch/x86/mm/kaiser.c: In function ‘kaiser_init’:
arch/x86/mm/kaiser.c:367:33: error: ‘__irqentry_text_start’ undeclared (first use in this function)
kaiser_add_user_map_ptrs_early(__irqentry_text_start,
[...]

---
 arch/x86/mm/kaiser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kaiser.c +1 -1
index 2298434f7bdb..7a72e32e4806 100644
@@ -363,7 +363,7 @@ void __init kaiser_init(void)
 	kaiser_add_user_map_ptrs_early(__entry_text_start, __entry_text_end,
 				       __PAGE_KERNEL_RX);
 
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	kaiser_add_user_map_ptrs_early(__irqentry_text_start,
 				       __irqentry_text_end,
 				       __PAGE_KERNEL_RX);
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Eric Biggers

This is a build fix for the 4.4 PTI backport. 4.4 kernels do not have commit be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections") which went into 4.6. Consequently, the irqentry sections are only created when CONFIG_FUNCTION_GRAPH_TRACER is enabled, not also when CONFIG_KASAN is enabled. Therefore, fix the condition for trying to add a user mapping for this section.

Quoted 8 lines

This fixes the following build error:

arch/x86/mm/kaiser.c: In function ‘kaiser_init’:
arch/x86/mm/kaiser.c:367:33: error: ‘__irqentry_text_start’ undeclared (first use in this function)
kaiser_add_user_map_ptrs_early(__irqentry_text_start,
[...]

Yep, sorry about that, thanks Eric:

Quoted 19 lines
---
 arch/x86/mm/kaiser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kaiser.c +1 -1
index 2298434f7bdb..7a72e32e4806 100644
@@ -363,7 +363,7 @@ void __init kaiser_init(void)
 	kaiser_add_user_map_ptrs_early(__entry_text_start, __entry_text_end,
 				       __PAGE_KERNEL_RX);
 
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	kaiser_add_user_map_ptrs_early(__irqentry_text_start,
 				       __irqentry_text_end,
 				       __PAGE_KERNEL_RX);
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
#2 lore raw
Quoted 16 lines · Hugh Dickins
Quoted 14 lines · Eric Biggers

This is a build fix for the 4.4 PTI backport. 4.4 kernels do not have commit be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections") which went into 4.6. Consequently, the irqentry sections are only created when CONFIG_FUNCTION_GRAPH_TRACER is enabled, not also when CONFIG_KASAN is enabled. Therefore, fix the condition for trying to add a user mapping for this section.

This fixes the following build error:

arch/x86/mm/kaiser.c: In function ‘kaiser_init’:
arch/x86/mm/kaiser.c:367:33: error: ‘__irqentry_text_start’ undeclared (first use in this function)
kaiser_add_user_map_ptrs_early(__irqentry_text_start,
[...]

Quoted 4 lines
Quoted 1 line

Yep, sorry about that, thanks Eric:

Thanks, now queued up.

greg k-h

maintainer Applied
#3 lore raw

Patch "x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER" has been added to the 4.4-stable tree

In reply to Eric Biggers

This is a note to let you know that I've just added the patch titled

    x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
x86-kaiser-fix-build-error-with-kasan-function_graph_tracer.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From [email protected] Tue Feb 13 16:43:57 2018

From: Eric Biggers <[email protected]>
Date: Fri, 9 Feb 2018 15:21:31 -0800
Subject: x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER
To: [email protected], Greg Kroah-Hartman <[email protected]>
Cc: Alexander Potapenko <[email protected]>, Dave Hansen <[email protected]>, Hugh Dickins <[email protected]>, [email protected], Eric Biggers <[email protected]>
Message-ID: <[email protected]>

From: Eric Biggers <[email protected]>

This is a build fix for the 4.4 PTI backport. 4.4 kernels do not have commit be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections") which went into 4.6. Consequently, the irqentry sections are only created when CONFIG_FUNCTION_GRAPH_TRACER is enabled, not also when CONFIG_KASAN is enabled. Therefore, fix the condition for trying to add a user mapping for this section.

This fixes the following build error:

arch/x86/mm/kaiser.c: In function ‘kaiser_init’:
arch/x86/mm/kaiser.c:367:33: error: ‘__irqentry_text_start’ undeclared (first use in this function)
kaiser_add_user_map_ptrs_early(__irqentry_text_start,
[...]

---
 arch/x86/mm/kaiser.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kaiser.c +1 -1
@@ -363,7 +363,7 @@ void __init kaiser_init(void)
 	kaiser_add_user_map_ptrs_early(__entry_text_start, __entry_text_end,
 				       __PAGE_KERNEL_RX);
 
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	kaiser_add_user_map_ptrs_early(__irqentry_text_start,
 				       __irqentry_text_end,
 				       __PAGE_KERNEL_RX);

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/keys-encrypted-fix-buffer-overread-in-valid_master_desc.patch queue-4.4/x86-kaiser-fix-build-error-with-kasan-function_graph_tracer.patch