Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Peter Zijlstra
On Thu, Dec 07, 2017 at 12:49:57AM +0900, Namhyung Kim wrote: > So, are you ok with this? yeah, that should work. > diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c > index 1b2be63c8528..ee0ba22d3993 100644 > --- a/kernel/events/callchain.c > +++ b/kernel/events/callchain.c > @

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Namhyung Kim
On Wed, Dec 06, 2017 at 04:45:44PM +0100, Peter Zijlstra wrote: > On Wed, Dec 06, 2017 at 11:31:30PM +0900, Namhyung Kim wrote: > > > > There's also a race against put_callchain_buffers() there, consider: > > > > > > > > > get_callchain_buffers() put_callchain_buffers() > > > mutex

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Namhyung Kim
On Wed, Dec 6, 2017 at 11:31 PM, Namhyung Kim wrote: > Hi Peter, > > On Wed, Dec 06, 2017 at 02:47:06PM +0100, Peter Zijlstra wrote: >> On Tue, Dec 05, 2017 at 11:47:18PM +0900, Namhyung Kim wrote: >> > Sure, I mean the following code: >> > >> > mutex_lock(&callchain_mutex); >> > >> > coun

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Peter Zijlstra
On Wed, Dec 06, 2017 at 11:31:30PM +0900, Namhyung Kim wrote: > > There's also a race against put_callchain_buffers() there, consider: > > > > > > get_callchain_buffers() put_callchain_buffers() > > mutex_lock(); > > inc() > > dec_and

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Namhyung Kim
Hi Peter, On Wed, Dec 06, 2017 at 02:47:06PM +0100, Peter Zijlstra wrote: > On Tue, Dec 05, 2017 at 11:47:18PM +0900, Namhyung Kim wrote: > > Sure, I mean the following code: > > > > mutex_lock(&callchain_mutex); > > > > count = atomic_inc_return(&nr_callchain_events); > > if (WARN_O

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Arnaldo Carvalho de Melo
Em Wed, Dec 06, 2017 at 02:47:06PM +0100, Peter Zijlstra escreveu: > On Tue, Dec 05, 2017 at 11:47:18PM +0900, Namhyung Kim wrote: > > Sure, I mean the following code: > > > > mutex_lock(&callchain_mutex); > > > > count = atomic_inc_return(&nr_callchain_events); > > if (WARN_ON_ONCE(c

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Peter Zijlstra
On Tue, Dec 05, 2017 at 11:47:18PM +0900, Namhyung Kim wrote: > Sure, I mean the following code: > > mutex_lock(&callchain_mutex); > > count = atomic_inc_return(&nr_callchain_events); > if (WARN_ON_ONCE(count < 1)) { > err = -EINVAL; > goto exit; >

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-06 Thread Peter Zijlstra
On Tue, Dec 05, 2017 at 05:11:56PM +0900, Namhyung Kim wrote: > From c12126c4ff9835f0899619db3ee7b4a3151ff2bb Mon Sep 17 00:00:00 2001 > From: Namhyung Kim > Date: Tue, 5 Dec 2017 16:54:50 +0900 > Subject: [PATCH] perf/core: Fix overflow on perf_callchain_entry > > The commit 97c79a38cd45 add a c

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-05 Thread Namhyung Kim
Hi Arnaldo, On Tue, Dec 05, 2017 at 10:37:40AM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Dec 05, 2017 at 05:11:56PM +0900, Namhyung Kim escreveu: > > Also I'm not sure that the allocation failure check would work > > correctly since it decrements nr_callchain_events when it fails. > > Can

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-05 Thread Arnaldo Carvalho de Melo
Em Tue, Dec 05, 2017 at 05:11:56PM +0900, Namhyung Kim escreveu: > Hello, > > On Thu, Nov 30, 2017 at 04:37:12PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Thu, Nov 30, 2017 at 09:20:26AM +0100, Peter Zijlstra escreveu: > > > On Thu, Nov 30, 2017 at 10:32:19AM +0800, Fengguang Wu wrote: > > > >

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-12-05 Thread Namhyung Kim
Hello, On Thu, Nov 30, 2017 at 04:37:12PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Nov 30, 2017 at 09:20:26AM +0100, Peter Zijlstra escreveu: > > On Thu, Nov 30, 2017 at 10:32:19AM +0800, Fengguang Wu wrote: > > > Hello, > > > > > > FYI this happens in mainline kernel 4.15.0-rc1. > > > It

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-11-30 Thread Arnaldo Carvalho de Melo
Em Thu, Nov 30, 2017 at 09:20:26AM +0100, Peter Zijlstra escreveu: > On Thu, Nov 30, 2017 at 10:32:19AM +0800, Fengguang Wu wrote: > > Hello, > > > > FYI this happens in mainline kernel 4.15.0-rc1. > > It looks like a new regression and hard to bisect. > > > > It occurs in 1 out of 57 boots. > >

Re: BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0x494/0x530

2017-11-30 Thread Peter Zijlstra
On Thu, Nov 30, 2017 at 10:32:19AM +0800, Fengguang Wu wrote: > Hello, > > FYI this happens in mainline kernel 4.15.0-rc1. > It looks like a new regression and hard to bisect. > > It occurs in 1 out of 57 boots. > > [ 10.009610] chown (367) used greatest stack depth: 26944 bytes left > Kernel