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
bsolete > > > > setsockopt SO_BSDCOMPAT > > > > [ 31.310289] > > > > == > > > > [ 31.311490] BUG: KASAN: slab-out-of-bounds in > > > > perf_callchain_user+0x494/0x530: &

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

2017-12-05 Thread Namhyung Kim
> > > [ 30.357729] trinity-main uses obsolete (PF_INET,SOCK_PACKET) > > > [ 31.301433] sock: process `trinity-main' is using obsolete setsockopt > > > SO_BSDCOMPAT > > > [ 31.310289] > > > ====

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

2017-11-30 Thread Arnaldo Carvalho de Melo
ain' is using obsolete setsockopt > > SO_BSDCOMPAT > > [ 31.310289] > > ========================== > > [ 31.311490] BUG: KASAN: slab-out-of-bounds in > > perf_callchain_user+0x494/0x530: >

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

2017-11-30 Thread Peter Zijlstra
===== > [ 31.311490] BUG: KASAN: slab-out-of-bounds in > perf_callchain_user+0x494/0x530: > perf_callchain_store at > include/linux/perf_event.h:1128 >(inlined by) > perf_callcha