* [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text
@ 2016-07-15 9:42 Alexander Potapenko
2016-08-05 16:33 ` Alexander Potapenko
2016-08-10 18:07 ` [tip:x86/mm] " tip-bot for Alexander Potapenko
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Potapenko @ 2016-07-15 9:42 UTC (permalink / raw)
To: dvyukov, kcc, aryabinin, x86, rostedt, mingo; +Cc: kasan-dev, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text
2016-07-15 9:42 [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text Alexander Potapenko
@ 2016-08-05 16:33 ` Alexander Potapenko
2016-08-10 18:07 ` [tip:x86/mm] " tip-bot for Alexander Potapenko
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Potapenko @ 2016-08-05 16:33 UTC (permalink / raw)
To: Dmitriy Vyukov, Kostya Serebryany, Andrey Ryabinin, x86,
Steven Rostedt, mingo
Cc: kasan-dev, LKML
On Fri, Jul 15, 2016 at 11:42 AM, Alexander Potapenko <glider@google.com> wrote:
> 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
>
A friendly ping.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/mm] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text
2016-07-15 9:42 [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text Alexander Potapenko
2016-08-05 16:33 ` Alexander Potapenko
@ 2016-08-10 18:07 ` tip-bot for Alexander Potapenko
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Alexander Potapenko @ 2016-08-10 18:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: luto, bp, dvlasenk, brgerst, jpoimboe, hpa, peterz, dvyukov,
torvalds, tglx, glider, linux-kernel, mingo
Commit-ID: 469f00231278da68062a809306df0bac95a27507
Gitweb: http://git.kernel.org/tip/469f00231278da68062a809306df0bac95a27507
Author: Alexander Potapenko <glider@google.com>
AuthorDate: Fri, 15 Jul 2016 11:42:43 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 10 Aug 2016 14:19:33 +0200
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@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: aryabinin@virtuozzo.com
Cc: kasan-dev@googlegroups.com
Cc: kcc@google.com
Cc: rostedt@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@kernel.org>
---
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 b846875..9f85827 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-10 18:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 9:42 [PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text Alexander Potapenko
2016-08-05 16:33 ` Alexander Potapenko
2016-08-10 18:07 ` [tip:x86/mm] " tip-bot for Alexander Potapenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.