linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
@ 2018-11-30 15:08 Anders Roxell
  2018-11-30 15:21 ` Steven Rostedt
  2018-12-06  1:08 ` Kees Cook
  0 siblings, 2 replies; 8+ messages in thread
From: Anders Roxell @ 2018-11-30 15:08 UTC (permalink / raw)
  To: keescook
  Cc: rostedt, mingo, catalin.marinas, will.deacon, linux-kernel,
	linux-arm-kernel, Anders Roxell, Arnd Bergmann

Function graph tracing recurses into itself when stackleak is enabled,
causing the ftrace graph selftest to run for up to 90 seconds and
trigger the softlockup watchdog.

Breakpoint 2, ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
200             mcount_get_lr_addr        x0    //     pointer to function's saved lr
(gdb) bt
\#0  ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
\#1  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
\#2  0xffffff8008555484 in stackleak_track_stack () at ../kernel/stackleak.c:106
\#3  0xffffff8008421ff8 in ftrace_ops_test (ops=0xffffff8009eaa840 <graph_ops>, ip=18446743524091297036, regs=<optimized out>) at ../kernel/trace/ftrace.c:1507
\#4  0xffffff8008428770 in __ftrace_ops_list_func (regs=<optimized out>, ignored=<optimized out>, parent_ip=<optimized out>, ip=<optimized out>) at ../kernel/trace/ftrace.c:6286
\#5  ftrace_ops_no_ops (ip=18446743524091297036, parent_ip=18446743524091242824) at ../kernel/trace/ftrace.c:6321
\#6  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
\#7  0xffffff800832fd10 in irq_find_mapping (domain=0xffffffc03fc4bc80, hwirq=27) at ../kernel/irq/irqdomain.c:876
\#8  0xffffff800832294c in __handle_domain_irq (domain=0xffffffc03fc4bc80, hwirq=27, lookup=true, regs=0xffffff800814b840) at ../kernel/irq/irqdesc.c:650
\#9  0xffffff80081d52b4 in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:205

Rework so we mark stackleak_track_stack as notrace

Co-developed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 kernel/stackleak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index e42892926244..5de3bf596dd7 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -102,7 +102,7 @@ asmlinkage void stackleak_erase(void)
 	current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
 }
 
-void __used stackleak_track_stack(void)
+void __used notrace stackleak_track_stack(void)
 {
 	/*
 	 * N.B. stackleak_erase() fills the kernel stack with the poison value,
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-11-30 15:08 [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace Anders Roxell
@ 2018-11-30 15:21 ` Steven Rostedt
  2018-12-06  1:08 ` Kees Cook
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2018-11-30 15:21 UTC (permalink / raw)
  To: Anders Roxell
  Cc: keescook, mingo, catalin.marinas, will.deacon, linux-kernel,
	linux-arm-kernel, Arnd Bergmann

On Fri, 30 Nov 2018 16:08:59 +0100
Anders Roxell <anders.roxell@linaro.org> wrote:

> Function graph tracing recurses into itself when stackleak is enabled,
> causing the ftrace graph selftest to run for up to 90 seconds and
> trigger the softlockup watchdog.
> 
> Breakpoint 2, ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
> 200             mcount_get_lr_addr        x0    //     pointer to function's saved lr
> (gdb) bt
> \#0  ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
> \#1  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
> \#2  0xffffff8008555484 in stackleak_track_stack () at ../kernel/stackleak.c:106
> \#3  0xffffff8008421ff8 in ftrace_ops_test (ops=0xffffff8009eaa840 <graph_ops>, ip=18446743524091297036, regs=<optimized out>) at ../kernel/trace/ftrace.c:1507
> \#4  0xffffff8008428770 in __ftrace_ops_list_func (regs=<optimized out>, ignored=<optimized out>, parent_ip=<optimized out>, ip=<optimized out>) at ../kernel/trace/ftrace.c:6286
> \#5  ftrace_ops_no_ops (ip=18446743524091297036, parent_ip=18446743524091242824) at ../kernel/trace/ftrace.c:6321
> \#6  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
> \#7  0xffffff800832fd10 in irq_find_mapping (domain=0xffffffc03fc4bc80, hwirq=27) at ../kernel/irq/irqdomain.c:876
> \#8  0xffffff800832294c in __handle_domain_irq (domain=0xffffffc03fc4bc80, hwirq=27, lookup=true, regs=0xffffff800814b840) at ../kernel/irq/irqdesc.c:650
> \#9  0xffffff80081d52b4 in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:205
> 
> Rework so we mark stackleak_track_stack as notrace
> 
> Co-developed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> ---
>  kernel/stackleak.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/stackleak.c b/kernel/stackleak.c
> index e42892926244..5de3bf596dd7 100644
> --- a/kernel/stackleak.c
> +++ b/kernel/stackleak.c
> @@ -102,7 +102,7 @@ asmlinkage void stackleak_erase(void)
>  	current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
>  }
>  
> -void __used stackleak_track_stack(void)
> +void __used notrace stackleak_track_stack(void)
>  {
>  	/*
>  	 * N.B. stackleak_erase() fills the kernel stack with the poison value,


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-11-30 15:08 [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace Anders Roxell
  2018-11-30 15:21 ` Steven Rostedt
@ 2018-12-06  1:08 ` Kees Cook
  2018-12-06  2:26   ` Steven Rostedt
  1 sibling, 1 reply; 8+ messages in thread
From: Kees Cook @ 2018-12-06  1:08 UTC (permalink / raw)
  To: Anders Roxell
  Cc: Steven Rostedt, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Fri, Nov 30, 2018 at 7:09 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> Function graph tracing recurses into itself when stackleak is enabled,
> causing the ftrace graph selftest to run for up to 90 seconds and
> trigger the softlockup watchdog.
>
> Breakpoint 2, ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
> 200             mcount_get_lr_addr        x0    //     pointer to function's saved lr
> (gdb) bt
> \#0  ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200
> \#1  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
> \#2  0xffffff8008555484 in stackleak_track_stack () at ../kernel/stackleak.c:106
> \#3  0xffffff8008421ff8 in ftrace_ops_test (ops=0xffffff8009eaa840 <graph_ops>, ip=18446743524091297036, regs=<optimized out>) at ../kernel/trace/ftrace.c:1507
> \#4  0xffffff8008428770 in __ftrace_ops_list_func (regs=<optimized out>, ignored=<optimized out>, parent_ip=<optimized out>, ip=<optimized out>) at ../kernel/trace/ftrace.c:6286
> \#5  ftrace_ops_no_ops (ip=18446743524091297036, parent_ip=18446743524091242824) at ../kernel/trace/ftrace.c:6321
> \#6  0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153
> \#7  0xffffff800832fd10 in irq_find_mapping (domain=0xffffffc03fc4bc80, hwirq=27) at ../kernel/irq/irqdomain.c:876
> \#8  0xffffff800832294c in __handle_domain_irq (domain=0xffffffc03fc4bc80, hwirq=27, lookup=true, regs=0xffffff800814b840) at ../kernel/irq/irqdesc.c:650
> \#9  0xffffff80081d52b4 in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:205
>
> Rework so we mark stackleak_track_stack as notrace
>
> Co-developed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  kernel/stackleak.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/stackleak.c b/kernel/stackleak.c
> index e42892926244..5de3bf596dd7 100644
> --- a/kernel/stackleak.c
> +++ b/kernel/stackleak.c
> @@ -102,7 +102,7 @@ asmlinkage void stackleak_erase(void)
>         current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
>  }
>
> -void __used stackleak_track_stack(void)
> +void __used notrace stackleak_track_stack(void)
>  {
>         /*
>          * N.B. stackleak_erase() fills the kernel stack with the poison value,
> --
> 2.19.2
>

Acked-by: Kees Cook <keescook@chromium.org>

Steven, I assume this series going via your tree?

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-12-06  1:08 ` Kees Cook
@ 2018-12-06  2:26   ` Steven Rostedt
  2018-12-06  2:29     ` Steven Rostedt
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2018-12-06  2:26 UTC (permalink / raw)
  To: Kees Cook
  Cc: Anders Roxell, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Wed, 5 Dec 2018 17:08:34 -0800
Kees Cook <keescook@chromium.org> wrote:

> > diff --git a/kernel/stackleak.c b/kernel/stackleak.c
> > index e42892926244..5de3bf596dd7 100644
> > --- a/kernel/stackleak.c
> > +++ b/kernel/stackleak.c
> > @@ -102,7 +102,7 @@ asmlinkage void stackleak_erase(void)
> >         current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
> >  }
> >
> > -void __used stackleak_track_stack(void)
> > +void __used notrace stackleak_track_stack(void)
> >  {
> >         /*
> >          * N.B. stackleak_erase() fills the kernel stack with the poison value,
> > --
> > 2.19.2
> >  
> 
> Acked-by: Kees Cook <keescook@chromium.org>
> 
> Steven, I assume this series going via your tree?

??

A notrace addition doesn't make it mine.

I added changes for the cond_resched in a different patch series that
I'll pull in (they are independent from this). I'll Ack the Makefile
change in the tracing directory, but the rest belongs to others.

-- Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-12-06  2:26   ` Steven Rostedt
@ 2018-12-06  2:29     ` Steven Rostedt
  2018-12-06  3:29       ` Kees Cook
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2018-12-06  2:29 UTC (permalink / raw)
  To: Kees Cook
  Cc: Anders Roxell, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Wed, 5 Dec 2018 21:26:51 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 5 Dec 2018 17:08:34 -0800
> Kees Cook <keescook@chromium.org> wrote:
> 

> I'll Ack the Makefile
> change in the tracing directory, but the rest belongs to others.
> 

I see I already acked that patch. BTW, when sending a patch series, you
really need a 0/3 patch as a header and the rest be threaded. I had a
hard time finding that patch in the sea of my INBOX.

If I was the one to pull it in, I wouldn't do it if the series was
unthreaded like this.

-- Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-12-06  2:29     ` Steven Rostedt
@ 2018-12-06  3:29       ` Kees Cook
  2018-12-06  3:43         ` Steven Rostedt
  0 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2018-12-06  3:29 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Anders Roxell, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Wed, Dec 5, 2018 at 6:29 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 5 Dec 2018 21:26:51 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > On Wed, 5 Dec 2018 17:08:34 -0800
> > Kees Cook <keescook@chromium.org> wrote:
> >
>
> > I'll Ack the Makefile
> > change in the tracing directory, but the rest belongs to others.

Okay, I wasn't sure. Anders's patch was marked "1/3" so I thought it
was directed at you. :)

I'll grab this one in the gcc-plugins tree.

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-12-06  3:29       ` Kees Cook
@ 2018-12-06  3:43         ` Steven Rostedt
  2018-12-06  3:55           ` Kees Cook
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2018-12-06  3:43 UTC (permalink / raw)
  To: Kees Cook
  Cc: Anders Roxell, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Wed, 5 Dec 2018 19:29:11 -0800
Kees Cook <keescook@chromium.org> wrote:

> On Wed, Dec 5, 2018 at 6:29 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Wed, 5 Dec 2018 21:26:51 -0500
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >  
> > > On Wed, 5 Dec 2018 17:08:34 -0800
> > > Kees Cook <keescook@chromium.org> wrote:
> > >  
> >  
> > > I'll Ack the Makefile
> > > change in the tracing directory, but the rest belongs to others.  
> 
> Okay, I wasn't sure. Anders's patch was marked "1/3" so I thought it
> was directed at you. :)
> 
> I'll grab this one in the gcc-plugins tree.

Should I just take patch 2 then? I'm thinking it's independent too.

I'm collecting patches for the next merge window right now so it wont
really be an issue if I do.

-- Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace
  2018-12-06  3:43         ` Steven Rostedt
@ 2018-12-06  3:55           ` Kees Cook
  0 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2018-12-06  3:55 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Anders Roxell, Ingo Molnar, Catalin Marinas, Will Deacon, LKML,
	linux-arm-kernel, Arnd Bergmann

On Wed, Dec 5, 2018 at 7:43 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 5 Dec 2018 19:29:11 -0800
> Kees Cook <keescook@chromium.org> wrote:
>
> > On Wed, Dec 5, 2018 at 6:29 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Wed, 5 Dec 2018 21:26:51 -0500
> > > Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > > On Wed, 5 Dec 2018 17:08:34 -0800
> > > > Kees Cook <keescook@chromium.org> wrote:
> > > >
> > >
> > > > I'll Ack the Makefile
> > > > change in the tracing directory, but the rest belongs to others.
> >
> > Okay, I wasn't sure. Anders's patch was marked "1/3" so I thought it
> > was directed at you. :)
> >
> > I'll grab this one in the gcc-plugins tree.
>
> Should I just take patch 2 then? I'm thinking it's independent too.
>
> I'm collecting patches for the next merge window right now so it wont
> really be an issue if I do.

Sure! I'm not sure what Anders's intention was, but yeah. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-06  3:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-30 15:08 [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace Anders Roxell
2018-11-30 15:21 ` Steven Rostedt
2018-12-06  1:08 ` Kees Cook
2018-12-06  2:26   ` Steven Rostedt
2018-12-06  2:29     ` Steven Rostedt
2018-12-06  3:29       ` Kees Cook
2018-12-06  3:43         ` Steven Rostedt
2018-12-06  3:55           ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).