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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 15 17:27:29 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.1.1.vz7.37.4
------>
commit 0341b6119786fe2b22efba5d32549f31ce4ca232
Author: Alexander Potapenko <glider at google.com>
Date:   Fri Sep 15 17:27:29 2017 +0300

    x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text
    
    Dmitry Vyukov has reported unexpected KASAN stackdepot growth:
    
      https://github.com/google/kasan/issues/36
    
    ... which is caused by the APIC handlers not being present in .irqentry.text:
    
    When building with CONFIG_FUNCTION_GRAPH_TRACER=y or CONFIG_KASAN=y, 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.
    
    Reported-by: Dmitry Vyukov <dvyukov at google.com>
    Signed-off-by: Alexander Potapenko <glider at google.com>
    Cc: Andy Lutomirski <luto at kernel.org>
    Cc: Borislav Petkov <bp at alien8.de>
    Cc: Brian Gerst <brgerst at gmail.com>
    Cc: Denys Vlasenko <dvlasenk at redhat.com>
    Cc: H. Peter Anvin <hpa at zytor.com>
    Cc: Josh Poimboeuf <jpoimboe at redhat.com>
    Cc: Linus Torvalds <torvalds at linux-foundation.org>
    Cc: Peter Zijlstra <peterz at infradead.org>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Cc: aryabinin at virtuozzo.com
    Cc: kasan-dev at googlegroups.com
    Cc: kcc at google.com
    Cc: rostedt at goodmis.org
    Link: http://lkml.kernel.org/r/1468575763-144889-1-git-send-email-glider@google.com
    [ Minor edits. ]
    Signed-off-by: Ingo Molnar <mingo at kernel.org>
    
    https://jira.sw.ru/browse/PSBM-69081
    (cherry picked from commit 469f00231278da68062a809306df0bac95a27507)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 arch/x86/kernel/entry_64.S | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index d9f7851..dd755f8 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -960,9 +960,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


More information about the Devel mailing list