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


Groups > linux.kernel > #1444126

[PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text

From Alexander Potapenko <glider@google.com>
Newsgroups linux.kernel
Subject [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text
Date 2016-07-15 11:50 +0200
Message-ID <rV7UR-5ff-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


When building with CONFIG_FUNCTION_GRAPH_TRACER or CONFIG_KASAN, put the
APIC interrupt handlers into the .irqentry.text section. This is needed
because both KASAN and function graph tracer use __irqentry_text_start and
__irqentry_text_end to determine whether a function is an IRQ entry point.

Dmitry Vyukov has reported unexpected KASAN stackdepot growth
(https://github.com/google/kasan/issues/36), which had been caused by
the APIC handlers not being present in .irqentry.text.

Signed-off-by: Alexander Potapenko <glider@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
---
v2: - fixed kbuild warning (incorrect #if directive)
---
 arch/x86/entry/entry_64.S | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9ee0da1..2ef4f0b 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -601,9 +601,20 @@ apicinterrupt3 \num trace(\sym) smp_trace(\sym)
 .endm
 #endif
 
+/* Make sure APIC interrupt handlers end up in the irqentry section. */
+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+#define PUSH_SECTION_IRQENTRY	.pushsection .irqentry.text, "ax"
+#define POP_SECTION_IRQENTRY	.popsection
+#else
+#define PUSH_SECTION_IRQENTRY
+#define POP_SECTION_IRQENTRY
+#endif
+
 .macro apicinterrupt num sym do_sym
+PUSH_SECTION_IRQENTRY
 apicinterrupt3 \num \sym \do_sym
 trace_apicinterrupt \num \sym
+POP_SECTION_IRQENTRY
 .endm
 
 #ifdef CONFIG_SMP
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text Alexander Potapenko <glider@google.com> - 2016-07-15 11:50 +0200

csiph-web