[PATCH v8 3/3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-28 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com>

[PATCH v8 3/3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-28 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v8: - incorporated fixes

[PATCH v8 2/3] mm, kasan: align free_meta_offset on sizeof(void*)

2016-07-28 Thread Alexander Potapenko
When free_meta_offset is not zero, it is usually aligned on 4 bytes, because the size of preceding kasan_alloc_meta is aligned on 4 bytes. As a result, accesses to kasan_free_meta fields may be misaligned. Signed-off-by: Alexander Potapenko <gli...@google.com> --- mm/kasan/kasan.c | 3

[PATCH v8 1/3] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-28 Thread Alexander Potapenko
led to random stacks having been reported. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander Potapenko <gli...@google.com> --- v8: - Updated the patch description --- include/linux/slub_def.h | 10 ++ mm/slub.c| 2 +- 2 files chang

[PATCH v8 2/3] mm, kasan: align free_meta_offset on sizeof(void*)

2016-07-28 Thread Alexander Potapenko
When free_meta_offset is not zero, it is usually aligned on 4 bytes, because the size of preceding kasan_alloc_meta is aligned on 4 bytes. As a result, accesses to kasan_free_meta fields may be misaligned. Signed-off-by: Alexander Potapenko --- mm/kasan/kasan.c | 3 ++- 1 file changed, 2

[PATCH v8 1/3] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-28 Thread Alexander Potapenko
led to random stacks having been reported. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander Potapenko --- v8: - Updated the patch description --- include/linux/slub_def.h | 10 ++ mm/slub.c| 2 +- 2 files changed, 7 insertions(+), 5

Re: [lkp] [mm, kasan] a6efa0b2aa: Undefined behaviour in mm/kasan/quarantine.c:102:13

2016-07-27 Thread Alexander Potapenko
-59 -m 320 -smp 1 -device > e1000,netdev=net0 -netdev user,id=net0 -boot order=nc -no-reboot -watchdog > i6300esb -rtc base=localtime -drive > file=/fs/sdg1/disk0-vm-kbuild-yocto-x86_64-59,media=disk,if=virtio -pidfile > /dev/shm/kboot/pid-vm-kbuild-yocto-x86_64-59 -serial > file:/de

Re: [lkp] [mm, kasan] a6efa0b2aa: Undefined behaviour in mm/kasan/quarantine.c:102:13

2016-07-27 Thread Alexander Potapenko
t; e1000,netdev=net0 -netdev user,id=net0 -boot order=nc -no-reboot -watchdog > i6300esb -rtc base=localtime -drive > file=/fs/sdg1/disk0-vm-kbuild-yocto-x86_64-59,media=disk,if=virtio -pidfile > /dev/shm/kboot/pid-vm-kbuild-yocto-x86_64-59 -serial > file:/dev/shm/kboot/serial-vm

Re: + mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix-2.patch added to -mm tree

2016-07-22 Thread Alexander Potapenko
I've posted the link to http://article.gmane.org/gmane.linux.kernel/2266971 in the discussion, and my patch seems to have fixed the problem. Adding __GFP_NOWARN will mask further problems of the similar nature, so I think we'd better avoid it. >> use __GFP_NOWARN for stack >> >>

Re: + mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix-2.patch added to -mm tree

2016-07-22 Thread Alexander Potapenko
ux.kernel/2266971 in the discussion, and my patch seems to have fixed the problem. Adding __GFP_NOWARN will mask further problems of the similar nature, so I think we'd better avoid it. >> use __GFP_NOWARN for stack >> >> Link: http://lkml.kernel.org/r/20160720151905.gb19...@node

Re: [PATCH] mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix

2016-07-15 Thread Alexander Potapenko
ts. > > Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com> Acked-by: Alexander Potapenko <gli...@google.com> > --- > mm/kasan/kasan.c | 17 + > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan

Re: [PATCH] mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix

2016-07-15 Thread Alexander Potapenko
ey Ryabinin Acked-by: Alexander Potapenko > --- > mm/kasan/kasan.c | 17 + > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c > index d92a7a2..b6f99e8 100644 > --- a/mm/kasan/kasan.c > +++ b/m

[PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text

2016-07-15 Thread Alexander Potapenko
. Dmitry Vyukov has reported unexpected KASAN stackdepot growth (https://github.com/google/kasan/issues/36), which had been caused by the APIC handlers not being present in .irqentry.text. Signed-off-by: Alexander Potapenko <gli...@google.com> Reported-by: Dmitry Vyukov <dvyu...@google.co

[PATCH v2] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text

2016-07-15 Thread Alexander Potapenko
. Dmitry Vyukov has reported unexpected KASAN stackdepot growth (https://github.com/google/kasan/issues/36), which had been caused by the APIC handlers not being present in .irqentry.text. Signed-off-by: Alexander Potapenko Reported-by: Dmitry Vyukov --- v2: - fixed kbuild warning (incorrect

[PATCH v1] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text

2016-07-14 Thread Alexander Potapenko
. Dmitry Vyukov has reported unexpected KASAN stackdepot growth (https://github.com/google/kasan/issues/36), which had been caused by the APIC handlers not being present in .irqentry.text. Signed-off-by: Alexander Potapenko <gli...@google.com> Reported-by: Dmitry Vyukov <dvyu...@google.com&g

[PATCH v1] x86, kasan, ftrace: Put APIC interrupt handlers into .irqentry.text

2016-07-14 Thread Alexander Potapenko
. Dmitry Vyukov has reported unexpected KASAN stackdepot growth (https://github.com/google/kasan/issues/36), which had been caused by the APIC handlers not being present in .irqentry.text. Signed-off-by: Alexander Potapenko Reported-by: Dmitry Vyukov --- arch/x86/entry/entry_64.S | 11 +++ 1

Re: [PATCH v7 1/2] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-13 Thread Alexander Potapenko
, when KASAN had detected an error on an object from a cache with SLAB_RED_ZONE set, the actual start address of the object was miscalculated, which led to random stacks having been reported. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander Pota

Re: [PATCH v7 1/2] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-13 Thread Alexander Potapenko
, when KASAN had detected an error on an object from a cache with SLAB_RED_ZONE set, the actual start address of the object was miscalculated, which led to random stacks having been reported. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander

Re: [lkp] [mm, kasan] 7392becb25: BUG: KASAN: slab-out-of-bounds in bucket_table_alloc+0x79/0x1a0 at addr ffff88003e400000

2016-07-13 Thread Alexander Potapenko
wing commit: > > https://github.com/0day-ci/linux > Alexander-Potapenko/mm-kasan-switch-SLUB-to-stackdepot-enable-memory-quarantine-for-SLUB/20160708-183858 > commit 7392becb255cd6c0e7bedaabd58f638b732772f2 ("mm, kasan: switch SLUB to > stackdepot, enable memory quarantine fo

Re: [lkp] [mm, kasan] 7392becb25: BUG: KASAN: slab-out-of-bounds in bucket_table_alloc+0x79/0x1a0 at addr ffff88003e400000

2016-07-13 Thread Alexander Potapenko
Andrey, Joonsoo: FYI On Wed, Jul 13, 2016 at 10:57 AM, Alexander Potapenko <gli...@google.com> wrote: > Hello there, > > I've built my kernel with the supplied config, but haven't managed to > reproduce the failure. > The test prints the following log: > > [2

Re: [lkp] [mm, kasan] 7392becb25: BUG: KASAN: slab-out-of-bounds in bucket_table_alloc+0x79/0x1a0 at addr ffff88003e400000

2016-07-13 Thread Alexander Potapenko
s://github.com/0day-ci/linux > Alexander-Potapenko/mm-kasan-switch-SLUB-to-stackdepot-enable-memory-quarantine-for-SLUB/20160708-183858 > commit 7392becb255cd6c0e7bedaabd58f638b732772f2 ("mm, kasan: switch SLUB to > stackdepot, enable memory quarantine for SLUB") > > in tes

Re: [lkp] [mm, kasan] 7392becb25: BUG: KASAN: slab-out-of-bounds in bucket_table_alloc+0x79/0x1a0 at addr ffff88003e400000

2016-07-13 Thread Alexander Potapenko
Andrey, Joonsoo: FYI On Wed, Jul 13, 2016 at 10:57 AM, Alexander Potapenko wrote: > Hello there, > > I've built my kernel with the supplied config, but haven't managed to > reproduce the failure. > The test prints the following log: > > [2.554919] Testing concurrent rhas

[PATCH v7 0/2] mm, kasan: stackdepot and quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
This patch set enables stackdepot and quarantine for SLUB allocator and fixes a problem with incorrect calculating the offset of the nearest object in the presence of SLUB red zones. Alexander Potapenko (2): mm, kasan: account for object redzone in SLUB's nearest_obj() mm, kasan: switch SLUB

[PATCH v7 0/2] mm, kasan: stackdepot and quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
This patch set enables stackdepot and quarantine for SLUB allocator and fixes a problem with incorrect calculating the offset of the nearest object in the presence of SLUB red zones. Alexander Potapenko (2): mm, kasan: account for object redzone in SLUB's nearest_obj() mm, kasan: switch SLUB

[PATCH v7 1/2] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-12 Thread Alexander Potapenko
When looking up the nearest SLUB object for a given address, correctly calculate its offset if SLAB_RED_ZONE is enabled for that cache. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/linux/slub_def.h | 1

[PATCH v7 1/2] mm, kasan: account for object redzone in SLUB's nearest_obj()

2016-07-12 Thread Alexander Potapenko
When looking up the nearest SLUB object for a given address, correctly calculate its offset if SLAB_RED_ZONE is enabled for that cache. Fixes: 7ed2f9e663854db ("mm, kasan: SLAB support") Signed-off-by: Alexander Potapenko --- include/linux/slub_def.h | 10 ++

[PATCH v7 2/2] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com>

[PATCH v7 2/2] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v7: - addressed comments

Re: [PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Mon, Jul 11, 2016 at 8:02 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Fri, Jul 08, 2016 at 12:36:50PM +0200, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/dealloc

Re: [PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Mon, Jul 11, 2016 at 8:02 AM, Joonsoo Kim wrote: > On Fri, Jul 08, 2016 at 12:36:50PM +0200, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks in the objects; >

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Fri, Jul 8, 2016 at 5:31 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 07/08/2016 01:36 PM, Alexander Potapenko wrote: >> On Tue, Jun 28, 2016 at 6:51 PM, Andrey Ryabinin >> <aryabi...@virtuozzo.com> wrote: > >>>> *flags |=

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Fri, Jul 8, 2016 at 5:31 PM, Andrey Ryabinin wrote: > > > On 07/08/2016 01:36 PM, Alexander Potapenko wrote: >> On Tue, Jun 28, 2016 at 6:51 PM, Andrey Ryabinin >> wrote: > >>>> *flags |= SLAB_KASAN; >>>> + >>>> /* Add a

Re: [PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Fri, Jul 8, 2016 at 7:00 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 07/08/2016 01:36 PM, Alexander Potapenko wrote: >> >> diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h >> index d1faa01..07e4549 100644 >> --- a/include/

Re: [PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-12 Thread Alexander Potapenko
On Fri, Jul 8, 2016 at 7:00 PM, Andrey Ryabinin wrote: > > > On 07/08/2016 01:36 PM, Alexander Potapenko wrote: >> >> diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h >> index d1faa01..07e4549 100644 >> --- a/include/linux/slub_def.h >> +++

[PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-08 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com>

[PATCH v6] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-08 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v6: - addressed comments

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-08 Thread Alexander Potapenko
On Tue, Jun 28, 2016 at 6:51 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 06/22/2016 08:43 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation st

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-08 Thread Alexander Potapenko
On Tue, Jun 28, 2016 at 6:51 PM, Andrey Ryabinin wrote: > > > On 06/22/2016 08:43 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks in the objects; >&g

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-07 Thread Alexander Potapenko
:629) > [0.00] ? _find_next_bit (lib/find_bit.c:54) > [0.00] ? alloc_desc (kernel/irq/irqdesc.c:190) > [0.00] early_irq_init (kernel/irq/irqdesc.c:279 (discriminator 1)) > [0.00] start_kernel (init/main.c:563) > [0.00] ? thread_stack_cache_init (??:

Re: [PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-07-07 Thread Alexander Potapenko
Any idea which config option triggers this code path? I don't see it with my config, and the config from kbuild doesn't boot for me. (I'm trying to bisect the diff between them now) On Tue, Jul 5, 2016 at 1:42 AM, Sasha Levin wrote: > On 06/22/2016 01:43 PM, Alexander Potapenko wr

Re: [PATCH v5] kasan/quarantine: fix bugs on qlist_move_cache()

2016-07-06 Thread Alexander Potapenko
;> Reviewed-by: Dmitry Vyukov <dvyu...@google.com> >> Signed-off-by: Joonsoo Kim <iamjoonsoo....@lge.com> > > Fixes: 55834c59098d ("mm: kasan: initial memory quarantine implementation") > Acked-by: Andrey Ryabinin <aryabi...@virtuozzo.com> > Acked-b

Re: [PATCH v5] kasan/quarantine: fix bugs on qlist_move_cache()

2016-07-06 Thread Alexander Potapenko
t; But, the bug looks trivial and no need to attach oops. >> >> v5: rename some variable for better readability >> v4: fix cache size bug s/cache->size/obj_cache->size/ >> v3: fix build warning >> >> Reviewed-by: Dmitry Vyukov >> Signed-off-by: Joonso

[PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-22 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com>

[PATCH v5] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-22 Thread Alexander Potapenko
For KASAN builds: - switch SLUB allocator to using stackdepot instead of storing the allocation/deallocation stacks in the objects; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v5: - addressed comments

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-21 Thread Alexander Potapenko
On Mon, Jun 20, 2016 at 9:50 PM, Sasha Levin <sasha.le...@oracle.com> wrote: > On 06/20/2016 08:53 AM, Alexander Potapenko wrote: >> On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin <sasha.le...@oracle.com> wrote: >>> > On 06/19/2016 03:24 AM, Alexander

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-21 Thread Alexander Potapenko
On Mon, Jun 20, 2016 at 9:50 PM, Sasha Levin wrote: > On 06/20/2016 08:53 AM, Alexander Potapenko wrote: >> On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin wrote: >>> > On 06/19/2016 03:24 AM, Alexander Potapenko wrote: >>>> >> Hi Sasha, >>>> >

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-20 Thread Alexander Potapenko
On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin <sasha.le...@oracle.com> wrote: > On 06/19/2016 03:24 AM, Alexander Potapenko wrote: >> Hi Sasha, >> >> This commit delays the reuse of memory after it has been freed, so >> it's intended to help peopl

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-20 Thread Alexander Potapenko
On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin wrote: > On 06/19/2016 03:24 AM, Alexander Potapenko wrote: >> Hi Sasha, >> >> This commit delays the reuse of memory after it has been freed, so >> it's intended to help people find more use-after-free errors. > >

Re: [PATCH v2 6/7] mm/page_owner: use stackdepot to store stacktrace

2016-06-20 Thread Alexander Potapenko
n't support it (e.g. via refcount as one would expect). > Hopefully the occupied memory doesn't grow indefinitely over time then... The existing use case (allocation/deallocation stacks for KASAN reports) doesn't require reference counts. Introducing those would have added unwanted contention and i

Re: [PATCH v2 6/7] mm/page_owner: use stackdepot to store stacktrace

2016-06-20 Thread Alexander Potapenko
cupied memory doesn't grow indefinitely over time then... The existing use case (allocation/deallocation stacks for KASAN reports) doesn't require reference counts. Introducing those would have added unwanted contention and increase memory usage. The amount of memory used by the stack depot is bound

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-20 Thread Alexander Potapenko
On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin <sasha.le...@oracle.com> wrote: > On 06/19/2016 03:24 AM, Alexander Potapenko wrote: >> Hi Sasha, >> >> This commit delays the reuse of memory after it has been freed, so >> it's intended to help peopl

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-20 Thread Alexander Potapenko
On Sun, Jun 19, 2016 at 7:40 PM, Sasha Levin wrote: > On 06/19/2016 03:24 AM, Alexander Potapenko wrote: >> Hi Sasha, >> >> This commit delays the reuse of memory after it has been freed, so >> it's intended to help people find more use-after-free errors. > >

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-19 Thread Alexander Potapenko
On Sat, Jun 18, 2016 at 5:32 PM, Sasha Levin <sasha.le...@oracle.com> wrote: > On 06/17/2016 10:27 AM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks i

Re: [PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-19 Thread Alexander Potapenko
On Sat, Jun 18, 2016 at 5:32 PM, Sasha Levin wrote: > On 06/17/2016 10:27 AM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks in the objects; >> - define

Re: [PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
On Fri, Jun 17, 2016 at 5:12 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 06/17/2016 05:27 PM, Alexander Potapenko wrote: >> On Wed, Jun 15, 2016 at 6:50 PM, Andrey Ryabinin >> <aryabi...@virtuozzo.com> wrote: >>> >>> &g

Re: [PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
On Fri, Jun 17, 2016 at 5:12 PM, Andrey Ryabinin wrote: > > > On 06/17/2016 05:27 PM, Alexander Potapenko wrote: >> On Wed, Jun 15, 2016 at 6:50 PM, Andrey Ryabinin >> wrote: >>> >>> >>> On 06/15/2016 06:26 PM, Alexander Potapenko wrote: >

Re: [PATCHv3] kcov: reject open when kernel not instrumented

2016-06-17 Thread Alexander Potapenko
o know when this >> compiler feature is in use, wee pass the define via KBUILD_CFLAGS rather >> than CFLAGS_KCOV. >> >> Signed-off-by: Mark Rutland <mark.rutl...@arm.com> >> Cc: Alexander Potapenko <gli...@google.com> >> Cc: Andrew Morton <a...@linux

Re: [PATCHv3] kcov: reject open when kernel not instrumented

2016-06-17 Thread Alexander Potapenko
RACE_PC is not defined, the kernel will >> return -ENOTSUPP if userspace attempts to open the kcov debugfs file, >> indicating that kcov functionality is unavailable. >> >> As uninstrumented files (e.g. kernel/kcov.c) need to know when this >> compiler feature is in use, wee pass

[PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v4: - addressed comments by Andrey Ryabinin: - don't set slub_debug by default for everyone; - introduce the ___cache_free()

[PATCH v4] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v4: - addressed comments by Andrey Ryabinin: - don't set slub_debug by default for everyone; - introduce the ___cache_free() helper function. v3

Re: [PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
On Wed, Jun 15, 2016 at 6:50 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 06/15/2016 06:26 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation st

Re: [PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-17 Thread Alexander Potapenko
On Wed, Jun 15, 2016 at 6:50 PM, Andrey Ryabinin wrote: > > > On 06/15/2016 06:26 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks in the objects; >> -

[PATCH v4] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid potential crashes, disable instrumentation of the files in arch/arm64/kvm/hyp/*. Signed-off-by: Alexander Potapenko <gli...@google.com> Acked-by: Mark Rutland <mark.rutl...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> Test

[PATCH v4] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid potential crashes, disable instrumentation of the files in arch/arm64/kvm/hyp/*. Signed-off-by: Alexander Potapenko Acked-by: Mark Rutland Acked-by: Marc Zyngier Tested-by: James Morse --- v4: - added ack from Marc Zyngier and Tested-by from James

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
On Thu, Jun 16, 2016 at 6:32 PM, Mark Rutland <mark.rutl...@arm.com> wrote: > On Thu, Jun 16, 2016 at 05:25:31PM +0100, Catalin Marinas wrote: >> On Thu, Jun 16, 2016 at 04:44:12PM +0100, Mark Rutland wrote: >> > On Thu, Jun 16, 2016 at 05:20:03PM +0200, Alexander Potapen

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
On Thu, Jun 16, 2016 at 6:32 PM, Mark Rutland wrote: > On Thu, Jun 16, 2016 at 05:25:31PM +0100, Catalin Marinas wrote: >> On Thu, Jun 16, 2016 at 04:44:12PM +0100, Mark Rutland wrote: >> > On Thu, Jun 16, 2016 at 05:20:03PM +0200, Alexander Potapenko wrote: >> > >

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
On Thu, Jun 16, 2016 at 12:47 PM, James Morse <james.mo...@arm.com> wrote: > On 15/06/16 15:25, Mark Rutland wrote: >> On Wed, Jun 15, 2016 at 01:53:03PM +0200, Alexander Potapenko wrote: >>> On Wed, Jun 15, 2016 at 1:44 PM, Mark Rutland <mark.rutl...@arm.com> wr

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-16 Thread Alexander Potapenko
On Thu, Jun 16, 2016 at 12:47 PM, James Morse wrote: > On 15/06/16 15:25, Mark Rutland wrote: >> On Wed, Jun 15, 2016 at 01:53:03PM +0200, Alexander Potapenko wrote: >>> On Wed, Jun 15, 2016 at 1:44 PM, Mark Rutland wrote: >>>> On Wed, Jun 15, 2016 at 10:25:

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 8:22 PM, Alexander Potapenko <gli...@google.com> wrote: > On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> > wrote: >> >> >> On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >>> For KASAN builds: >

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 8:22 PM, Alexander Potapenko wrote: > On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin > wrote: >> >> >> On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >>> For KASAN builds: >>> - switch SLUB allocator to using stackdepo

[PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v3: - addressed comments by Andrey Ryabinin: - replaced KMALLOC_MAX_CACHE_SIZE with KMALLOC_MAX_SIZE in kasan_cache_

[PATCH v3] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
; - change the freelist hook so that parts of the freelist can be put into the quarantine. Signed-off-by: Alexander Potapenko --- v3: - addressed comments by Andrey Ryabinin: - replaced KMALLOC_MAX_CACHE_SIZE with KMALLOC_MAX_SIZE in kasan_cache_create(); - for caches

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 8:22 PM, Alexander Potapenko <gli...@google.com> wrote: > On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> > wrote: >> >> >> On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >>> For KASAN builds: >

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-15 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 8:22 PM, Alexander Potapenko wrote: > On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin > wrote: >> >> >> On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >>> For KASAN builds: >>> - switch SLUB allocator to using stackdepo

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-15 Thread Alexander Potapenko
On Wed, Jun 15, 2016 at 1:44 PM, Mark Rutland <mark.rutl...@arm.com> wrote: > On Wed, Jun 15, 2016 at 10:25:10AM +0100, Mark Rutland wrote: >> On Tue, Jun 14, 2016 at 08:16:08PM +0200, Alexander Potapenko wrote: >> > On Tue, Jun 14, 2016 at 7:55 PM, Mark Rutland <

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-15 Thread Alexander Potapenko
On Wed, Jun 15, 2016 at 1:44 PM, Mark Rutland wrote: > On Wed, Jun 15, 2016 at 10:25:10AM +0100, Mark Rutland wrote: >> On Tue, Jun 14, 2016 at 08:16:08PM +0200, Alexander Potapenko wrote: >> > On Tue, Jun 14, 2016 at 7:55 PM, Mark Rutland wrote: >> > > I built

[PATCH] arm64: allow building with kcov coverage on ARM64

2016-06-15 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid potential crashes, disable instrumentation of the files in arch/arm64/kvm/hyp/*. Signed-off-by: Alexander Potapenko <gli...@google.com> Acked-by: Mark Rutland <mark.rutl...@arm.com> --- v3: - reverted arch/arm64/boot/Makefile, the

[PATCH] arm64: allow building with kcov coverage on ARM64

2016-06-15 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid potential crashes, disable instrumentation of the files in arch/arm64/kvm/hyp/*. Signed-off-by: Alexander Potapenko Acked-by: Mark Rutland --- v3: - reverted arch/arm64/boot/Makefile, there's no code in that dir - added ack from Mark Rutland v2

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
On Tue, Jun 14, 2016 at 7:55 PM, Mark Rutland <mark.rutl...@arm.com> wrote: > On Tue, Jun 14, 2016 at 06:57:21PM +0200, Alexander Potapenko wrote: >> Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable >> instrumentation of the following files: >> >> ar

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
On Tue, Jun 14, 2016 at 7:55 PM, Mark Rutland wrote: > On Tue, Jun 14, 2016 at 06:57:21PM +0200, Alexander Potapenko wrote: >> Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable >> instrumentation of the following files: >> >> arch/arm64/boot/* >> arch

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
Hi all, On Tue, Jun 14, 2016 at 6:57 PM, Alexander Potapenko <gli...@google.com> wrote: > Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable > instrumentation of the following files: > > arch/arm64/boot/* > arch/arm64/kvm/hyp/* > > Signed-off-by: Alexander P

Re: [PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
Hi all, On Tue, Jun 14, 2016 at 6:57 PM, Alexander Potapenko wrote: > Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable > instrumentation of the following files: > > arch/arm64/boot/* > arch/arm64/kvm/hyp/* > > Signed-off-by: Alexander Potapenko > --- > v2

[PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable instrumentation of the following files: arch/arm64/boot/* arch/arm64/kvm/hyp/* Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - disable instrumentation of arch/arm64/{boot,kvm/hyp} - enable instrumentation o

[PATCH v2] arm64: allow building with kcov coverage on ARM64

2016-06-14 Thread Alexander Potapenko
Add ARCH_HAS_KCOV to ARM64 config. To avoid crashes, disable instrumentation of the following files: arch/arm64/boot/* arch/arm64/kvm/hyp/* Signed-off-by: Alexander Potapenko --- v2: - disable instrumentation of arch/arm64/{boot,kvm/hyp} - enable instrumentation of arch/arm64/lib/delay.c

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

2016-06-13 Thread Alexander Potapenko
pr_err("==\n"); > - add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > - spin_unlock_irqrestore(_lock, flags); > - kasan_enable_current(); > + > + kasan_end_report(); > +} > + > +void kasan_r

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

2016-06-13 Thread Alexander Potapenko
==\n"); > - add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > - spin_unlock_irqrestore(_lock, flags); > - kasan_enable_current(); > + > + kasan_end_report(); > +} > + > +void kasan_report_double_free(struct

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-09 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation st

Re: [PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-09 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 6:45 PM, Andrey Ryabinin wrote: > > > On 06/08/2016 09:40 PM, Alexander Potapenko wrote: >> For KASAN builds: >> - switch SLUB allocator to using stackdepot instead of storing the >>allocation/deallocation stacks in the objects; >> -

[PATCH v2] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-09 Thread Alexander Potapenko
; - refactor the slab freelist hook, put freed memory into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - incorporated kbuild fixes by Andrew Morton --- include/linux/slab.h | 9 + include/linux/slub_def.h | 4 +++ lib/Kconfig.kasan| 4 +

[PATCH v2] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-09 Thread Alexander Potapenko
; - refactor the slab freelist hook, put freed memory into the quarantine. Signed-off-by: Alexander Potapenko --- v2: - incorporated kbuild fixes by Andrew Morton --- include/linux/slab.h | 9 + include/linux/slub_def.h | 4 +++ lib/Kconfig.kasan| 4 +-- mm/kasan/Makefile

Re: [PATCH] mm: mempool: kasan: don't poot mempool objects in quarantine

2016-06-09 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 4:05 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > On 06/01/2016 07:22 PM, Andrey Ryabinin wrote: >> >> >> On 06/01/2016 03:53 PM, Alexander Potapenko wrote: >>> To avoid draining the mempools, KASAN shouldn't put the mempool e

Re: [PATCH] mm: mempool: kasan: don't poot mempool objects in quarantine

2016-06-09 Thread Alexander Potapenko
On Thu, Jun 9, 2016 at 4:05 PM, Andrey Ryabinin wrote: > On 06/01/2016 07:22 PM, Andrey Ryabinin wrote: >> >> >> On 06/01/2016 03:53 PM, Alexander Potapenko wrote: >>> To avoid draining the mempools, KASAN shouldn't put the mempool elements >>>

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

2016-06-09 Thread Alexander Potapenko
bject_err(cache, page, object, info); > +#else > object_err(cache, page, object, > "kasan: bad access detected"); > +#endif > return; > } > dump_page(page, "ka

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

2016-06-09 Thread Alexander Potapenko
object_err(cache, page, object, > "kasan: bad access detected"); > +#endif > return; > } > dump_page(page, "kasan: bad access detected"); > diff --git a/mm/slab.c b/mm/slab.c > index 763096a..b8c51a6 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -2611,6 +2611,7 @@ static void cache_init_objs(struct kmem_cache *cachep, > cachep->ctor(objp); > kasan_poison_object_data(cachep, objp); > } > + kasan_init_object(cachep, index_to_obj(cachep, page, i)); > > if (!shuffled) > set_free_obj(page, i, i); > @@ -3508,7 +3509,7 @@ static inline void __cache_free(struct kmem_cache > *cachep, void *objp, > unsigned long caller) > { > /* Put the object into the quarantine, don't touch it for now. */ > - if (kasan_slab_free(cachep, objp)) > + if (kasan_slab_free(cachep, objp, _RET_IP_)) > return; > > ___cache_free(cachep, objp, caller); > diff --git a/mm/slub.c b/mm/slub.c > index 5beeeb2..f25c0c2 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -1344,7 +1344,7 @@ static inline void slab_free_hook(struct kmem_cache *s, > void *x) > if (!(s->flags & SLAB_DEBUG_OBJECTS)) > debug_check_no_obj_freed(x, s->object_size); > > - kasan_slab_free(s, x); > + kasan_slab_free(s, x, _RET_IP_); > } > > static inline void slab_free_freelist_hook(struct kmem_cache *s, > -- > 1.7.1 > -- 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

[PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-08 Thread Alexander Potapenko
; - refactor the slab freelist hook, put freed memory into the quarantine. Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/linux/slab.h | 9 ++ include/linux/slub_def.h | 4 +++ lib/Kconfig.kasan| 4 +-- mm/kasan/Makefile| 3 +- mm/kasan/k

[PATCH] mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB

2016-06-08 Thread Alexander Potapenko
; - refactor the slab freelist hook, put freed memory into the quarantine. Signed-off-by: Alexander Potapenko --- include/linux/slab.h | 9 ++ include/linux/slub_def.h | 4 +++ lib/Kconfig.kasan| 4 +-- mm/kasan/Makefile| 3 +- mm/kasan/kasan.c | 78

Re: [PATCH v4 2/2] kasan: add double-free tests

2016-06-07 Thread Alexander Potapenko
> static int __init kmalloc_tests_init(void) > { > kmalloc_oob_right(); > @@ -436,6 +479,10 @@ static int __init kmalloc_tests_init(void) > kasan_global_oob(); > ksize_unpoisons_memory(); > copy_user_test(); > +#ifdef CONFIG_SLAB > +

Re: [PATCH v4 2/2] kasan: add double-free tests

2016-06-07 Thread Alexander Potapenko
; { > kmalloc_oob_right(); > @@ -436,6 +479,10 @@ static int __init kmalloc_tests_init(void) > kasan_global_oob(); > ksize_unpoisons_memory(); > copy_user_test(); > +#ifdef CONFIG_SLAB > + kasan_double_free(); > + kasan_double_free_concurrent(); &g

Re: [PATCH] mm, kasan: introduce a special shadow value for allocator metadata

2016-06-02 Thread Alexander Potapenko
On Thu, Jun 2, 2016 at 2:17 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 06/02/2016 03:02 PM, Alexander Potapenko wrote: >> On Wed, Jun 1, 2016 at 6:31 PM, Alexander Potapenko <gli...@google.com> >> wrote: >>> On Wed, Jun 1

Re: [PATCH] mm, kasan: introduce a special shadow value for allocator metadata

2016-06-02 Thread Alexander Potapenko
On Thu, Jun 2, 2016 at 2:17 PM, Andrey Ryabinin wrote: > > > On 06/02/2016 03:02 PM, Alexander Potapenko wrote: >> On Wed, Jun 1, 2016 at 6:31 PM, Alexander Potapenko >> wrote: >>> On Wed, Jun 1, 2016 at 5:23 PM, Andrey Ryabinin >>> wrote: >>&

<    2   3   4   5   6   7   8   9   10   11   >