Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-10 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 2:43 PM, Andrey Ryabinin wrote: > > > On 05/09/2016 01:31 PM, Dmitry Vyukov wrote: >> On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin >> wrote: >>> >>> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >>> index

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-10 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 2:43 PM, Andrey Ryabinin wrote: > > > On 05/09/2016 01:31 PM, Dmitry Vyukov wrote: >> On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin >> wrote: >>> >>> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >>> index b3c122d..c2b0e51 100644 >>> --- a/mm/kasan/report.c >>> +++

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 04:20 PM, Dmitry Vyukov wrote: > On Mon, May 9, 2016 at 3:01 PM, Andrey Ryabinin > wrote: >> >> >> On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: >>> >>> This patch with atomic bit op is similar in spirit to v1 except that it >>> increases metadata

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 04:20 PM, Dmitry Vyukov wrote: > On Mon, May 9, 2016 at 3:01 PM, Andrey Ryabinin > wrote: >> >> >> On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: >>> >>> This patch with atomic bit op is similar in spirit to v1 except that it >>> increases metadata size. >>> >> >> I don't think

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 3:01 PM, Andrey Ryabinin wrote: > > > On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: >> >> This patch with atomic bit op is similar in spirit to v1 except that it >> increases metadata size. >> > > I don't think that this is a big deal. That will

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 3:01 PM, Andrey Ryabinin wrote: > > > On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: >> >> This patch with atomic bit op is similar in spirit to v1 except that it >> increases metadata size. >> > > I don't think that this is a big deal. That will slightly increase size of

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: > > This patch with atomic bit op is similar in spirit to v1 except that it > increases metadata size. > I don't think that this is a big deal. That will slightly increase size of objects <= (128 - 32) bytes. And if someone think otherwise, we

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 02:35 PM, Luruo, Kuthonuzo wrote: > > This patch with atomic bit op is similar in spirit to v1 except that it > increases metadata size. > I don't think that this is a big deal. That will slightly increase size of objects <= (128 - 32) bytes. And if someone think otherwise, we

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 01:31 PM, Dmitry Vyukov wrote: > On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin > wrote: >> >> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >> index b3c122d..c2b0e51 100644 >> --- a/mm/kasan/report.c >> +++ b/mm/kasan/report.c >> @@ -140,18 +140,12

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/09/2016 01:31 PM, Dmitry Vyukov wrote: > On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin > wrote: >> >> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >> index b3c122d..c2b0e51 100644 >> --- a/mm/kasan/report.c >> +++ b/mm/kasan/report.c >> @@ -140,18 +140,12 @@ static void

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Luruo, Kuthonuzo
> > Currently, KASAN may fail to detect concurrent deallocations of the same > > object due to a race in kasan_slab_free(). This patch makes double-free > > detection more reliable by serializing access to KASAN object metadata. > > New functions kasan_meta_lock() and kasan_meta_unlock() are

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Luruo, Kuthonuzo
> > Currently, KASAN may fail to detect concurrent deallocations of the same > > object due to a race in kasan_slab_free(). This patch makes double-free > > detection more reliable by serializing access to KASAN object metadata. > > New functions kasan_meta_lock() and kasan_meta_unlock() are

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin wrote: > > > On 05/06/2016 02:47 PM, Kuthonuzo Luruo wrote: >> Currently, KASAN may fail to detect concurrent deallocations of the same >> object due to a race in kasan_slab_free(). This patch makes double-free >> detection

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Mon, May 9, 2016 at 12:26 PM, Andrey Ryabinin wrote: > > > On 05/06/2016 02:47 PM, Kuthonuzo Luruo wrote: >> Currently, KASAN may fail to detect concurrent deallocations of the same >> object due to a race in kasan_slab_free(). This patch makes double-free >> detection more reliable by

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/06/2016 02:47 PM, Kuthonuzo Luruo wrote: > Currently, KASAN may fail to detect concurrent deallocations of the same > object due to a race in kasan_slab_free(). This patch makes double-free > detection more reliable by serializing access to KASAN object metadata. > New functions

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Andrey Ryabinin
On 05/06/2016 02:47 PM, Kuthonuzo Luruo wrote: > Currently, KASAN may fail to detect concurrent deallocations of the same > object due to a race in kasan_slab_free(). This patch makes double-free > detection more reliable by serializing access to KASAN object metadata. > New functions

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Sat, May 7, 2016 at 5:15 PM, Luruo, Kuthonuzo wrote: > Thank you for the review! > >> > + >> > +/* acquire per-object lock for access to KASAN metadata. */ >> >> I believe there's strong reason not to use standard spin_lock() or >> similar. I think it's proper place to

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Sat, May 7, 2016 at 5:15 PM, Luruo, Kuthonuzo wrote: > Thank you for the review! > >> > + >> > +/* acquire per-object lock for access to KASAN metadata. */ >> >> I believe there's strong reason not to use standard spin_lock() or >> similar. I think it's proper place to explain it. >> > > will

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Luruo, Kuthonuzo
> >> Thank you for the review! > >> > >> > > + switch (alloc_data.state) { > >> > > + case KASAN_STATE_QUARANTINE: > >> > > + case KASAN_STATE_FREE: > >> > > + kasan_report((unsigned long)object, 0, false, > >> > > + (unsigned long)__builtin_return_address(1)); > >>

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Luruo, Kuthonuzo
> >> Thank you for the review! > >> > >> > > + switch (alloc_data.state) { > >> > > + case KASAN_STATE_QUARANTINE: > >> > > + case KASAN_STATE_FREE: > >> > > + kasan_report((unsigned long)object, 0, false, > >> > > + (unsigned long)__builtin_return_address(1)); > >>

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-08 Thread Dmitry Vyukov
On Sun, May 8, 2016 at 11:17 AM, Yury Norov wrote: > On Sat, May 07, 2016 at 03:15:59PM +, Luruo, Kuthonuzo wrote: >> Thank you for the review! >> >> > > + switch (alloc_data.state) { >> > > + case KASAN_STATE_QUARANTINE: >> > > + case KASAN_STATE_FREE: >> > > +

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-08 Thread Dmitry Vyukov
On Sun, May 8, 2016 at 11:17 AM, Yury Norov wrote: > On Sat, May 07, 2016 at 03:15:59PM +, Luruo, Kuthonuzo wrote: >> Thank you for the review! >> >> > > + switch (alloc_data.state) { >> > > + case KASAN_STATE_QUARANTINE: >> > > + case KASAN_STATE_FREE: >> > > + kasan_report((unsigned

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-08 Thread Yury Norov
On Sat, May 07, 2016 at 03:15:59PM +, Luruo, Kuthonuzo wrote: > Thank you for the review! > > > > + switch (alloc_data.state) { > > > + case KASAN_STATE_QUARANTINE: > > > + case KASAN_STATE_FREE: > > > + kasan_report((unsigned long)object, 0, false, > > > +

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-08 Thread Yury Norov
On Sat, May 07, 2016 at 03:15:59PM +, Luruo, Kuthonuzo wrote: > Thank you for the review! > > > > + switch (alloc_data.state) { > > > + case KASAN_STATE_QUARANTINE: > > > + case KASAN_STATE_FREE: > > > + kasan_report((unsigned long)object, 0, false, > > > +

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-07 Thread Luruo, Kuthonuzo
Thank you for the review! > > + > > +/* acquire per-object lock for access to KASAN metadata. */ > > I believe there's strong reason not to use standard spin_lock() or > similar. I think it's proper place to explain it. > will do. > > +void kasan_meta_lock(struct kasan_alloc_meta *alloc_info)

RE: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-07 Thread Luruo, Kuthonuzo
Thank you for the review! > > + > > +/* acquire per-object lock for access to KASAN metadata. */ > > I believe there's strong reason not to use standard spin_lock() or > similar. I think it's proper place to explain it. > will do. > > +void kasan_meta_lock(struct kasan_alloc_meta *alloc_info)

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-07 Thread Yury Norov
On Fri, May 06, 2016 at 05:17:27PM +0530, Kuthonuzo Luruo wrote: > Currently, KASAN may fail to detect concurrent deallocations of the same > object due to a race in kasan_slab_free(). This patch makes double-free > detection more reliable by serializing access to KASAN object metadata. > New

Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-07 Thread Yury Norov
On Fri, May 06, 2016 at 05:17:27PM +0530, Kuthonuzo Luruo wrote: > Currently, KASAN may fail to detect concurrent deallocations of the same > object due to a race in kasan_slab_free(). This patch makes double-free > detection more reliable by serializing access to KASAN object metadata. > New