* [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
@ 2017-01-25 14:25 Peter Zijlstra
2017-01-25 14:28 ` Peter Zijlstra
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Peter Zijlstra @ 2017-01-25 14:25 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov, linux-kernel
Cc: Steven Rostedt
After much waiting I finally reproduced a KASAN issue, only to find my
trace-buffer empty of useful information because it got spooled out :/
Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
interface.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
mm/kasan/report.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index b82b3e2..6ff7efc 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -300,6 +300,8 @@ void kasan_report(unsigned long addr, size_t size,
if (likely(!kasan_report_enabled()))
return;
+ disable_trace_on_warning();
+
info.access_addr = (void *)addr;
info.access_size = size;
info.is_write = is_write;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:25 [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning Peter Zijlstra
@ 2017-01-25 14:28 ` Peter Zijlstra
2017-01-25 14:32 ` Alexander Potapenko
2017-01-25 14:38 ` Alexander Potapenko
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2017-01-25 14:28 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov, linux-kernel
Cc: Steven Rostedt
On Wed, Jan 25, 2017 at 03:25:24PM +0100, Peter Zijlstra wrote:
>
> After much waiting I finally reproduced a KASAN issue, only to find my
> trace-buffer empty of useful information because it got spooled out :/
>
> Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
> interface.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
Seems to compile better when you add the required header files...
mm/kasan/report.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index b82b3e2..3653ed1 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -24,6 +24,7 @@
#include <linux/types.h>
#include <linux/kasan.h>
#include <linux/module.h>
+#include <linux/ftrace.h>
#include <asm/sections.h>
@@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
if (likely(!kasan_report_enabled()))
return;
+ disable_trace_on_warning();
+
info.access_addr = (void *)addr;
info.access_size = size;
info.is_write = is_write;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:28 ` Peter Zijlstra
@ 2017-01-25 14:32 ` Alexander Potapenko
2017-01-25 14:35 ` Peter Zijlstra
0 siblings, 1 reply; 10+ messages in thread
From: Alexander Potapenko @ 2017-01-25 14:32 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Andrey Ryabinin, Dmitry Vyukov, LKML, Steven Rostedt
On Wed, Jan 25, 2017 at 3:28 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Jan 25, 2017 at 03:25:24PM +0100, Peter Zijlstra wrote:
>>
>> After much waiting I finally reproduced a KASAN issue, only to find my
>> trace-buffer empty of useful information because it got spooled out :/
>>
>> Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
>> interface.
>>
>> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>> ---
>
> Seems to compile better when you add the required header files...
>
> mm/kasan/report.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index b82b3e2..3653ed1 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -24,6 +24,7 @@
> #include <linux/types.h>
> #include <linux/kasan.h>
> #include <linux/module.h>
> +#include <linux/ftrace.h>
>
> #include <asm/sections.h>
>
> @@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
> if (likely(!kasan_report_enabled()))
> return;
>
> + disable_trace_on_warning();
> +
Who is going to enable tracing back after we're done?
Note that KASAN errors are not fatal, and the first one may possibly
occur quite early.
> info.access_addr = (void *)addr;
> info.access_size = size;
> info.is_write = is_write;
--
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] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:32 ` Alexander Potapenko
@ 2017-01-25 14:35 ` Peter Zijlstra
2017-01-25 14:37 ` Alexander Potapenko
2017-01-30 19:18 ` Steven Rostedt
0 siblings, 2 replies; 10+ messages in thread
From: Peter Zijlstra @ 2017-01-25 14:35 UTC (permalink / raw)
To: Alexander Potapenko; +Cc: Andrey Ryabinin, Dmitry Vyukov, LKML, Steven Rostedt
On Wed, Jan 25, 2017 at 03:32:11PM +0100, Alexander Potapenko wrote:
> > @@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
> > if (likely(!kasan_report_enabled()))
> > return;
> >
> > + disable_trace_on_warning();
> > +
> Who is going to enable tracing back after we're done?
The user..
> Note that KASAN errors are not fatal, and the first one may possibly
> occur quite early.
WARN*() isn't fatal either, and it does the same thing. Note that
traceoff_on_warning is default disabled. You have to explicitly request
this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:35 ` Peter Zijlstra
@ 2017-01-25 14:37 ` Alexander Potapenko
2017-01-30 19:18 ` Steven Rostedt
1 sibling, 0 replies; 10+ messages in thread
From: Alexander Potapenko @ 2017-01-25 14:37 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Andrey Ryabinin, Dmitry Vyukov, LKML, Steven Rostedt
On Wed, Jan 25, 2017 at 3:35 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Jan 25, 2017 at 03:32:11PM +0100, Alexander Potapenko wrote:
>
>> > @@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
>> > if (likely(!kasan_report_enabled()))
>> > return;
>> >
>> > + disable_trace_on_warning();
>> > +
>> Who is going to enable tracing back after we're done?
>
> The user..
>
>> Note that KASAN errors are not fatal, and the first one may possibly
>> occur quite early.
>
> WARN*() isn't fatal either, and it does the same thing. Note that
> traceoff_on_warning is default disabled. You have to explicitly request
> this.
Ah, that makes sense. Sorry, I wasn't aware of that interface before.
--
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] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:25 [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning Peter Zijlstra
2017-01-25 14:28 ` Peter Zijlstra
@ 2017-01-25 14:38 ` Alexander Potapenko
2017-01-25 15:29 ` kbuild test robot
2017-01-25 16:41 ` Andrey Ryabinin
3 siblings, 0 replies; 10+ messages in thread
From: Alexander Potapenko @ 2017-01-25 14:38 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Andrey Ryabinin, Dmitry Vyukov, LKML, Steven Rostedt
On Wed, Jan 25, 2017 at 3:25 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> After much waiting I finally reproduced a KASAN issue, only to find my
> trace-buffer empty of useful information because it got spooled out :/
>
> Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
> interface.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Alexander Potapenko <glider@google.com>
> ---
> mm/kasan/report.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index b82b3e2..6ff7efc 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -300,6 +300,8 @@ void kasan_report(unsigned long addr, size_t size,
> if (likely(!kasan_report_enabled()))
> return;
>
> + disable_trace_on_warning();
> +
> info.access_addr = (void *)addr;
> info.access_size = size;
> info.is_write = is_write;
--
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] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:25 [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning Peter Zijlstra
2017-01-25 14:28 ` Peter Zijlstra
2017-01-25 14:38 ` Alexander Potapenko
@ 2017-01-25 15:29 ` kbuild test robot
2017-01-25 16:41 ` Andrey Ryabinin
3 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2017-01-25 15:29 UTC (permalink / raw)
To: Peter Zijlstra
Cc: kbuild-all, Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
linux-kernel, Steven Rostedt
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
Hi Peter,
[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.10-rc5 next-20170125]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Peter-Zijlstra/kasan-Respect-proc-sys-kernel-traceoff_on_warning/20170125-230535
base: git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x008-201704 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/kasan/report.c: In function 'kasan_report':
>> mm/kasan/report.c:303:2: error: implicit declaration of function 'disable_trace_on_warning' [-Werror=implicit-function-declaration]
disable_trace_on_warning();
^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/disable_trace_on_warning +303 mm/kasan/report.c
297 {
298 struct kasan_access_info info;
299
300 if (likely(!kasan_report_enabled()))
301 return;
302
> 303 disable_trace_on_warning();
304
305 info.access_addr = (void *)addr;
306 info.access_size = size;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27451 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:25 [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning Peter Zijlstra
@ 2017-01-25 16:41 ` Andrey Ryabinin
2017-01-25 14:38 ` Alexander Potapenko
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Andrey Ryabinin @ 2017-01-25 16:41 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexander Potapenko, linux-mm, linux-kernel, Peter Zijlstra,
Dmitry Vyukov, Steven Rostedt, Andrey Ryabinin
From: Peter Zijlstra <peterz@infradead.org>
After much waiting I finally reproduced a KASAN issue, only to find my
trace-buffer empty of useful information because it got spooled out :/
Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
interface.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
mm/kasan/report.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index b82b3e2..f479365 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -13,6 +13,7 @@
*
*/
+#include <linux/ftrace.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/printk.h>
@@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
if (likely(!kasan_report_enabled()))
return;
+ disable_trace_on_warning();
+
info.access_addr = (void *)addr;
info.access_size = size;
info.is_write = is_write;
--
2.10.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2] kasan: Respect /proc/sys/kernel/traceoff_on_warning
@ 2017-01-25 16:41 ` Andrey Ryabinin
0 siblings, 0 replies; 10+ messages in thread
From: Andrey Ryabinin @ 2017-01-25 16:41 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexander Potapenko, linux-mm, linux-kernel, Peter Zijlstra,
Dmitry Vyukov, Steven Rostedt, Andrey Ryabinin
From: Peter Zijlstra <peterz@infradead.org>
After much waiting I finally reproduced a KASAN issue, only to find my
trace-buffer empty of useful information because it got spooled out :/
Make kasan_report honour the /proc/sys/kernel/traceoff_on_warning
interface.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
mm/kasan/report.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index b82b3e2..f479365 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -13,6 +13,7 @@
*
*/
+#include <linux/ftrace.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/printk.h>
@@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
if (likely(!kasan_report_enabled()))
return;
+ disable_trace_on_warning();
+
info.access_addr = (void *)addr;
info.access_size = size;
info.is_write = is_write;
--
2.10.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning
2017-01-25 14:35 ` Peter Zijlstra
2017-01-25 14:37 ` Alexander Potapenko
@ 2017-01-30 19:18 ` Steven Rostedt
1 sibling, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2017-01-30 19:18 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Alexander Potapenko, Andrey Ryabinin, Dmitry Vyukov, LKML
On Wed, 25 Jan 2017 15:35:32 +0100
Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Jan 25, 2017 at 03:32:11PM +0100, Alexander Potapenko wrote:
>
> > > @@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size,
> > > if (likely(!kasan_report_enabled()))
> > > return;
> > >
> > > + disable_trace_on_warning();
> > > +
> > Who is going to enable tracing back after we're done?
>
> The user..
Yep,
# echo 1 > /sys/kernel/debug/tracing/tracing_on
Re-enables tracing.
-- Steve
>
> > Note that KASAN errors are not fatal, and the first one may possibly
> > occur quite early.
>
> WARN*() isn't fatal either, and it does the same thing. Note that
> traceoff_on_warning is default disabled. You have to explicitly request
> this.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-01-30 19:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-25 14:25 [PATCH] kasan: Respect /proc/sys/kernel/traceoff_on_warning Peter Zijlstra
2017-01-25 14:28 ` Peter Zijlstra
2017-01-25 14:32 ` Alexander Potapenko
2017-01-25 14:35 ` Peter Zijlstra
2017-01-25 14:37 ` Alexander Potapenko
2017-01-30 19:18 ` Steven Rostedt
2017-01-25 14:38 ` Alexander Potapenko
2017-01-25 15:29 ` kbuild test robot
2017-01-25 16:41 ` [PATCH v2] " Andrey Ryabinin
2017-01-25 16:41 ` Andrey Ryabinin
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.