[PATCH 2/2] mm: kasan: unified support for SLUB and SLAB allocators

2015-10-28 Thread Alexander Potapenko
for small objects. The redzone size is calculated based on the object size. This is the second part of the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Dmitry Chernenkov <dmit...@google.com> Signed-off-by: Ale

[PATCH 1/2] mm, kasan: Added GFP flags to KASAN API

2015-10-28 Thread Alexander Potapenko
Add GFP flags to KASAN hooks for future patches to use. This is the first part of the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Dmitry Chernenkov <dmit...@google.com> Signed-off-by: Alexande

Re: [PATCH 2/2] mm: kasan: unified support for SLUB and SLAB allocators

2015-11-02 Thread Alexander Potapenko
0/28/2015 07:41 PM, Alexander Potapenko wrote: >> With this patch kasan can be compiled with both SLAB and SLUB allocators, >> using minimal dependencies on allocator internal structures and minimum >> allocator-dependent code. >> >> Dependency from SLUB_DEBUG is als

Re: [PATCH 1/2] mm, kasan: Added GFP flags to KASAN API

2015-11-02 Thread Alexander Potapenko
07:39 PM, Alexander Potapenko wrote: >> Add GFP flags to KASAN hooks for future patches to use. > > Really? These flags are still not used in the next patch (unless I missed > something). > >> This is the first part of the "mm: kasan: unified support for SLUB and >>

[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

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

[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 +

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 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] 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 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

[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

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

[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

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 <

[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_

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 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

[PATCH v1] [mm] Set page->slab_cache for every page allocated for a kmem_cache.

2016-05-27 Thread Alexander Potapenko
ntine implementation") Signed-off-by: Alexander Potapenko <gli...@google.com> --- mm/slab.c | 7 ++- mm/slub.c | 8 +--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index cc8bbc1..ac6c251 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2703,8 +2703,1

Re: [PATCH v1] [mm] Set page->slab_cache for every page allocated for a kmem_cache.

2016-05-27 Thread Alexander Potapenko
On Fri, May 27, 2016 at 7:30 PM, Christoph Lameter <c...@linux.com> wrote: > On Fri, 27 May 2016, Alexander Potapenko wrote: > >> It's reasonable to rely on the fact that for every page allocated for a >> kmem_cache the |slab_cache| field points to that cache. Without tha

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

2016-06-02 Thread Alexander Potapenko
On Wed, Jun 1, 2016 at 6:31 PM, Alexander Potapenko <gli...@google.com> wrote: > On Wed, Jun 1, 2016 at 5:23 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> > wrote: >> On 05/31/2016 08:49 PM, Alexander Potapenko wrote: >>> On Tue, May 31, 2016 at 1:5

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-01 Thread Alexander Potapenko
On Wed, Jun 1, 2016 at 5:23 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > On 05/31/2016 08:49 PM, Alexander Potapenko wrote: >> On Tue, May 31, 2016 at 1:52 PM, Andrey Ryabinin >> <aryabi...@virtuozzo.com> wrote: >>> >>> >>> On 05

[PATCH] mm: kasan: don't touch metadata in kasan_[un]poison_element()

2016-06-01 Thread Alexander Potapenko
. Signed-off-by: Alexander Potapenko <gli...@google.com> Reported-by: Kuthonuzo Luruo <kuthonuzo.lu...@hpe.com> --- include/linux/kasan.h | 8 ++-- mm/kasan/kasan.c | 48 +--- mm/mempool.c | 5 +++-- mm/slab.c |

Re: [PATCH] kasan: change memory hot-add error messages to info messages

2016-06-01 Thread Alexander Potapenko
s/ryabinin/aryabinin/ On Wed, Jun 1, 2016 at 5:22 PM, Alexander Potapenko <gli...@google.com> wrote: > On Wed, Jun 1, 2016 at 5:20 PM, Shuah Khan <shua...@osg.samsung.com> wrote: >> Change the following memory hot-add error messages to info messages. There >> is no

Re: [PATCH] kasan: change memory hot-add error messages to info messages

2016-06-01 Thread Alexander Potapenko
WARNING: KASAN doesn't support memory hot-add\n"); > - pr_err("Memory hot-add will be disabled\n"); > + pr_info("WARNING: KASAN doesn't support memory hot-add\n"); > + pr_info("Memory hot-add will be disabled\n"); No objections, but let's wait for

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

2016-05-31 Thread Alexander Potapenko
On Tue, May 31, 2016 at 1:52 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote: > > > On 05/31/2016 01:44 PM, Alexander Potapenko wrote: >> Add a special shadow value to distinguish accesses to KASAN-specific >> allocator metadata. >> >> Unlike Addres

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

2016-05-31 Thread Alexander Potapenko
and induce crashes later on. Warning about such corruptions will ease the debugging. Signed-off-by: Alexander Potapenko <gli...@google.com> --- mm/kasan/kasan.c | 15 +++ mm/kasan/kasan.h | 1 + mm/kasan/report.c | 3 +++ 3 files changed, 19 insertions(+) diff --git a/mm

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: >

[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>

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 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-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-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 <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 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] 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 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

[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] 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()

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: [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 v1 4/8] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-01-29 Thread Alexander Potapenko
Agreed. Once I receive more comments I will make a new patch set and include this change as well. On Thu, Jan 28, 2016 at 3:53 PM, Steven Rostedt <rost...@goodmis.org> wrote: > On Wed, 27 Jan 2016 19:25:09 +0100 > Alexander Potapenko <gli...@google.com> wrote: > >> -

Re: [PATCH v1 4/8] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-01-29 Thread Alexander Potapenko
this file. * * Thanks. --rmk */ Do we really want to put anything into that header? On Fri, Jan 29, 2016 at 12:33 PM, Alexander Potapenko <gli...@google.com> wrote: > Agreed. Once I receive more comments I will make a new patch set and > include this change as well. > > On Thu, Jan 2

[PATCH v1 7/8] kasan: Changed kmalloc_large_oob_right, added kmalloc_pagealloc_oob_right

2016-01-27 Thread Alexander Potapenko
Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 5498a78..822c804 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -65,7

[PATCH v1 6/8] kasan: Test fix: Warn if the UAF could not be detected in kmalloc_uaf2

2016-01-27 Thread Alexander Potapenko
Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 66dd92f..5498a78 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -286,6 +286,8 @@ static noinline void

Re: [PATCH v1 5/8] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-01-28 Thread Alexander Potapenko
On Thu, Jan 28, 2016 at 1:51 PM, Alexander Potapenko <gli...@google.com> wrote: > > On Jan 28, 2016 8:40 AM, "Joonsoo Kim" <iamjoonsoo@lge.com> wrote: >> >> Hello, >> >> On Wed, Jan 27, 2016 at 07:25:10PM +0100, Alexander Potapenko wrote

Re: [PATCH v1 2/8] mm, kasan: SLAB support

2016-01-28 Thread Alexander Potapenko
On Thu, Jan 28, 2016 at 1:37 PM, Alexander Potapenko <gli...@google.com> wrote: > > On Jan 28, 2016 8:44 AM, "Joonsoo Kim" <iamjoonsoo@lge.com> wrote: >> >> On Wed, Jan 27, 2016 at 07:25:07PM +0100, Alexander Potapenko wrote: >> &

[PATCH v1 8/8] mm: kasan: Initial memory quarantine implementation

2016-01-27 Thread Alexander Potapenko
support is only enabled in SLAB allocator. Unification of KASAN features in SLAB and SLUB will be done later. This patch is based on the "mm: kasan: quarantine" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/lin

[PATCH v1 0/8] SLAB support for KASAN

2016-01-27 Thread Alexander Potapenko
the dependency on SLUB_DEBUG. Also neither SLUB nor SLAB delay the reuse of freed memory chunks, which is necessary for better detection of use-after-free errors. We introduce memory quarantine (mm/kasan/quarantine.c), which allows delayed reuse of deallocated memory. Alexander Potapenko (8): kasan

[PATCH v1 5/8] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-01-27 Thread Alexander Potapenko
kasan: stack depots" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- arch/x86/kernel/Makefile | 1 + mm/kasan/Makefile| 3 + mm/kasan/kasan.c | 51 +- mm/kasan/kasan.h | 11 +++ mm/kasan/repor

[PATCH v1 3/8] mm, kasan: Added GFP flags to KASAN API

2016-01-27 Thread Alexander Potapenko
Add GFP flags to KASAN hooks for future patches to use. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/li

[PATCH v1 4/8] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-01-27 Thread Alexander Potapenko
KASAN needs to know whether the allocation happens in an IRQ handler. This lets us strip everything below the IRQ entry point to reduce the number of unique stack traces needed to be stored. Signed-off-by: Alexander Potapenko <gli...@google.com> --- arch/arm/kernel/vmlinux.lds.S

[PATCH v1 2/8] mm, kasan: SLAB support

2016-01-27 Thread Alexander Potapenko
This patch adds KASAN hooks to SLAB allocator. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- Documentation/kasan.txt | 5 ++- inclu

[PATCH v1 1/8] kasan: Change the behavior of kmalloc_large_oob_right test

2016-01-27 Thread Alexander Potapenko
depending on which allocator (SLAB or SLUB) is being used Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index c32f3b0..66dd92f 100644 ---

Re: [PATCH v1 1/8] kasan: Change the behavior of kmalloc_large_oob_right test

2016-02-02 Thread Alexander Potapenko
ator. >>> + */ >>> +size = KMALLOC_MAX_CACHE_SIZE + 10; >>> +} >> >> This seems a weird way of working out whether we're using SLAB or SLUB. >> >> Can't we use, umm, #ifdef CONFIG_SLAB? If not that then let's coo

Re: [PATCH v4 2/7] mm, kasan: SLAB support

2016-02-29 Thread Alexander Potapenko
On Mon, Feb 29, 2016 at 7:28 PM, Alexander Potapenko <gli...@google.com> wrote: > On Mon, Feb 29, 2016 at 4:10 PM, Andrey Ryabinin <ryabinin@gmail.com> > wrote: >> >> >> On 02/26/2016 07:48 PM, Alexander Potapenko wrote: >>> Add KASAN hooks t

Re: [PATCH v4 2/7] mm, kasan: SLAB support

2016-02-29 Thread Alexander Potapenko
On Mon, Feb 29, 2016 at 4:10 PM, Andrey Ryabinin <ryabinin@gmail.com> wrote: > > > On 02/26/2016 07:48 PM, Alexander Potapenko wrote: >> Add KASAN hooks to SLAB allocator. >> >> This patch is based on the "mm: kasan: unified support for SLUB and >>

[PATCH v3 2/7] mm, kasan: SLAB support

2016-02-26 Thread Alexander Potapenko
Add KASAN hooks to SLAB allocator. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v3: - minor description changes - store d

[PATCH v3 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-02-26 Thread Alexander Potapenko
the __softirq_entry macro which is similar to __irq_entry, but puts the corresponding functions to the .softirqentry.text section. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Steven Rostedt, moved the declarations of __softirq_entry and __irq_entry to v3: -

[PATCH v3 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-26 Thread Alexander Potapenko
. This patch is based on the "mm: kasan: stack depots" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Joonsoo Kim, moved the stackdepot implementation to lib/, as there's a plan to use it for page o

[PATCH v3 7/7] mm: kasan: Initial memory quarantine implementation

2016-02-26 Thread Alexander Potapenko
support is only enabled in SLAB allocator. Unification of KASAN features in SLAB and SLUB will be done later. This patch is based on the "mm: kasan: quarantine" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - added co

[PATCH v3 6/7] kasan: Test fix: Warn if the UAF could not be detected in kmalloc_uaf2

2016-02-26 Thread Alexander Potapenko
Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 90ad74f..82169fb 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -294,6 +294,8 @@ static noinline void

[PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend.

2016-02-26 Thread Alexander Potapenko
not return. This may cause false positive stack buffer overflow reports from KASAN. The solution is to record the stack pointer value just before the CPU is suspended, and unpoison the part of stack between the saved value and the stack pointer upon resume. Signed-off-by: Alexander Potapenko <

[PATCH v3 0/7] SLAB support for KASAN

2016-02-26 Thread Alexander Potapenko
allows delayed reuse of deallocated memory. Alexander Potapenko (7): kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right() mm, kasan: SLAB support mm, kasan: Added GFP flags to KASAN API arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections mm

[PATCH v3 3/7] mm, kasan: Added GFP flags to KASAN API

2016-02-26 Thread Alexander Potapenko
Add GFP flags to KASAN hooks for future patches to use. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/li

[PATCH v3 1/7] kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()

2016-02-26 Thread Alexander Potapenko
-by: Alexander Potapenko <gli...@google.com> --- v2: - Merged "kasan: Change the behavior of kmalloc_large_oob_right" and "kasan: Changed kmalloc_large_oob_right, added kmalloc_pagealloc_oob_right" from v1 v3: - Minor description changes --- lib/test_kasan.c | 28 +

Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend.

2016-02-26 Thread Alexander Potapenko
On Fri, Feb 26, 2016 at 2:53 PM, Mark Rutland <mark.rutl...@arm.com> wrote: > Hi, > > On Fri, Feb 26, 2016 at 01:38:37PM +0100, Alexander Potapenko wrote: >> Before an ARM64 CPU is suspended, the kernel saves the context which will >> be used to initialize the regist

[PATCH v4 7/7] mm: kasan: Initial memory quarantine implementation

2016-02-26 Thread Alexander Potapenko
support is only enabled in SLAB allocator. Unification of KASAN features in SLAB and SLUB will be done later. This patch is based on the "mm: kasan: quarantine" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - added co

[PATCH v4 3/7] mm, kasan: Added GFP flags to KASAN API

2016-02-26 Thread Alexander Potapenko
Add GFP flags to KASAN hooks for future patches to use. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v4: - fix kbuild compilatio

[PATCH v4 1/7] kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()

2016-02-26 Thread Alexander Potapenko
-by: Alexander Potapenko <gli...@google.com> --- v2: - Merged "kasan: Change the behavior of kmalloc_large_oob_right" and "kasan: Changed kmalloc_large_oob_right, added kmalloc_pagealloc_oob_right" from v1 v3: - Minor description changes --- lib/test_kasan.c | 28 +

[PATCH v4 0/7] SLAB support for KASAN

2016-02-26 Thread Alexander Potapenko
allows delayed reuse of deallocated memory. Alexander Potapenko (7): kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right() mm, kasan: SLAB support mm, kasan: Added GFP flags to KASAN API arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections mm

[PATCH v4 6/7] kasan: Test fix: Warn if the UAF could not be detected in kmalloc_uaf2

2016-02-26 Thread Alexander Potapenko
Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 90ad74f..82169fb 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -294,6 +294,8 @@ static noinline void

[PATCH v4 2/7] mm, kasan: SLAB support

2016-02-26 Thread Alexander Potapenko
Add KASAN hooks to SLAB allocator. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v3: - minor description changes - store d

[PATCH v4 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-26 Thread Alexander Potapenko
. This patch is based on the "mm: kasan: stack depots" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Joonsoo Kim, moved the stackdepot implementation to lib/, as there's a plan to use it for page o

[PATCH v4 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-02-26 Thread Alexander Potapenko
the __softirq_entry macro which is similar to __irq_entry, but puts the corresponding functions to the .softirqentry.text section. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Steven Rostedt, moved the declarations of __softirq_entry and __irq_entry to v3: -

Re: [PATCH v1 5/8] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-16 Thread Alexander Potapenko
On Mon, Feb 1, 2016 at 3:55 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Thu, Jan 28, 2016 at 02:27:44PM +0100, Alexander Potapenko wrote: >> On Thu, Jan 28, 2016 at 1:51 PM, Alexander Potapenko <gli...@google.com> >> wrote: >> > >> > On Ja

Re: [PATCH v1 5/8] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-17 Thread Alexander Potapenko
On Tue, Feb 16, 2016 at 7:37 PM, Alexander Potapenko <gli...@google.com> wrote: > On Mon, Feb 1, 2016 at 3:55 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: >> On Thu, Jan 28, 2016 at 02:27:44PM +0100, Alexander Potapenko wrote: >>> On Thu, Jan 28, 2016 at 1:5

Re: [PATCH v1 2/8] mm, kasan: SLAB support

2016-02-18 Thread Alexander Potapenko
n Thu, Jan 28, 2016 at 02:29:42PM +0100, Alexander Potapenko wrote: >> On Thu, Jan 28, 2016 at 1:37 PM, Alexander Potapenko <gli...@google.com> >> wrote: >> > >> > On Jan 28, 2016 8:44 AM, "Joonsoo Kim" <iamjoonsoo@lge.com> wrote: >>

Re: [PATCH v1 8/8] mm: kasan: Initial memory quarantine implementation

2016-02-18 Thread Alexander Potapenko
On Mon, Feb 1, 2016 at 3:47 AM, Joonsoo Kim <iamjoonsoo@lge.com> wrote: > On Wed, Jan 27, 2016 at 07:25:13PM +0100, Alexander Potapenko wrote: >> Quarantine isolates freed objects in a separate queue. The objects are >> returned to the allocator later, which helps to

Re: [PATCH v1 5/8] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-18 Thread Alexander Potapenko
On Thu, Feb 18, 2016 at 9:13 AM, Joonsoo Kim <js1...@gmail.com> wrote: > 2016-02-18 3:29 GMT+09:00 Alexander Potapenko <gli...@google.com>: >> On Tue, Feb 16, 2016 at 7:37 PM, Alexander Potapenko <gli...@google.com> >> wrote: >>> On Mon, Feb 1, 2016 at 3:

[PATCH v2 1/7] kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()

2016-02-18 Thread Alexander Potapenko
. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - Merged "kasan: Change the behavior of kmalloc_large_oob_right" and "kasan: Changed kmalloc_large_oob_right, added kmalloc_pagealloc_oob_right" from v1 --- lib/test_kasan.c | 28 ++

[PATCH v2 0/7] SLAB support for KASAN

2016-02-18 Thread Alexander Potapenko
the dependency on SLUB_DEBUG. Also neither SLUB nor SLAB delay the reuse of freed memory chunks, which is necessary for better detection of use-after-free errors. We introduce memory quarantine (mm/kasan/quarantine.c), which allows delayed reuse of deallocated memory. Alexander Potapenko (7): kasan

[PATCH v2 6/7] kasan: Test fix: Warn if the UAF could not be detected in kmalloc_uaf2

2016-02-18 Thread Alexander Potapenko
Signed-off-by: Alexander Potapenko <gli...@google.com> --- lib/test_kasan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 90ad74f..82169fb 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -294,6 +294,8 @@ static noinline void

[PATCH v2 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-02-18 Thread Alexander Potapenko
kasan: stack depots" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Joonsoo Kim, moved the stackdepot implementation to lib/, as there's a plan to use it for page owner - added copyright comments

[PATCH v2 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-02-18 Thread Alexander Potapenko
introduces the __softirq_entry macro which is similar to __irq_entry, but puts the corresponding functions to the .softirqentry.text section. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - per request from Steven Rostedt, moved the declarations of __softirq_entry and __irq

[PATCH v2 7/7] mm: kasan: Initial memory quarantine implementation

2016-02-18 Thread Alexander Potapenko
support is only enabled in SLAB allocator. Unification of KASAN features in SLAB and SLUB will be done later. This patch is based on the "mm: kasan: quarantine" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- v2: - added co

[PATCH v2 3/7] mm, kasan: Added GFP flags to KASAN API

2016-02-18 Thread Alexander Potapenko
Add GFP flags to KASAN hooks for future patches to use. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- include/li

[PATCH v2 2/7] mm, kasan: SLAB support

2016-02-18 Thread Alexander Potapenko
This patch adds KASAN hooks to SLAB allocator. This patch is based on the "mm: kasan: unified support for SLUB and SLAB allocators" patch originally prepared by Dmitry Chernenkov. Signed-off-by: Alexander Potapenko <gli...@google.com> --- Documentation/kasan.txt | 5 ++- inclu

Re: [PATCH v2 0/7] SLAB support for KASAN

2016-02-18 Thread Alexander Potapenko
a lot of memory. On Thu, Feb 18, 2016 at 6:32 PM, Christoph Lameter <c...@linux.com> wrote: > On Thu, 18 Feb 2016, Alexander Potapenko wrote: > >> Unlike SLUB, SLAB doesn't store allocation/deallocation stacks for heap >> objects, therefore we reimplement this feature

Re: [PATCH v1 2/8] mm, kasan: SLAB support

2016-02-19 Thread Alexander Potapenko
;> On Thu, Jan 28, 2016 at 02:29:42PM +0100, Alexander Potapenko wrote: >>>> On Thu, Jan 28, 2016 at 1:37 PM, Alexander Potapenko <gli...@google.com> >>>> wrote: >>>> > >>>> > On Jan 28, 2016 8:44 AM, "Joonsoo Kim" <i

Re: [PATCH v1 1/8] kasan: Change the behavior of kmalloc_large_oob_right test

2016-02-15 Thread Alexander Potapenko
in both SLAB and SLUB modes. I'll send the updated patch set later today. On Tue, Feb 2, 2016 at 5:25 PM, Alexander Potapenko <gli...@google.com> wrote: > The intention was to detect the situation in which a new allocator > appears for which we don't know how it behaves if we allocate

Re: [PATCH v1 4/8] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-02-16 Thread Alexander Potapenko
Ok, interrupt.h sounds good. On Fri, Jan 29, 2016 at 3:45 PM, Steven Rostedt <rost...@goodmis.org> wrote: > On Fri, 29 Jan 2016 12:59:13 +0100 > Alexander Potapenko <gli...@google.com> wrote: > >> On the other hand, this will require including into >>

Re: [PATCH v5 7/7] mm: kasan: Initial memory quarantine implementation

2016-03-10 Thread Alexander Potapenko
On Wed, Mar 9, 2016 at 9:21 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Wed, 9 Mar 2016 12:05:48 +0100 Alexander Potapenko <gli...@google.com> > wrote: > >> Quarantine isolates freed objects in a separate queue. The objects are >> returned to

Re: [PATCH v5 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-03-10 Thread Alexander Potapenko
On Wed, Mar 9, 2016 at 9:09 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Wed, 9 Mar 2016 12:05:46 +0100 Alexander Potapenko <gli...@google.com> > wrote: > >> Implement the stack depot and provide CONFIG_STACKDEPOT. >> Stack depot will allow KASAN st

Re: [PATCH v7 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB

2016-03-18 Thread Alexander Potapenko
On Tue, Mar 15, 2016 at 1:22 PM, Andrey Ryabinin <ryabinin@gmail.com> wrote: > 2016-03-15 12:27 GMT+03:00 Alexander Potapenko <gli...@google.com>: >> On Mon, Mar 14, 2016 at 5:56 PM, Andrey Ryabinin <ryabinin@gmail.com> >> wrote: >>> 2016-03-1

Re: [PATCH v5 7/7] mm: kasan: Initial memory quarantine implementation

2016-03-11 Thread Alexander Potapenko
On Thu, Mar 10, 2016 at 9:14 PM, Andrew Morton <a...@linux-foundation.org> wrote: > On Thu, 10 Mar 2016 14:50:56 +0100 Alexander Potapenko <gli...@google.com> > wrote: > >> On Wed, Mar 9, 2016 at 9:21 PM, Andrew Morton <a...@linux-foundation.org> >> wrote:

[PATCH v7 0/7] SLAB support for KASAN

2016-03-14 Thread Alexander Potapenko
allows delayed reuse of deallocated memory. Alexander Potapenko (7): kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right() mm, kasan: SLAB support mm, kasan: Added GFP flags to KASAN API arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections mm

[PATCH v7 1/7] kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()

2016-03-14 Thread Alexander Potapenko
-by: Alexander Potapenko <gli...@google.com> --- v2: - Merged "kasan: Change the behavior of kmalloc_large_oob_right" and "kasan: Changed kmalloc_large_oob_right, added kmalloc_pagealloc_oob_right" from v1 v3: - Minor description changes --- lib/test_kasan.c | 28 +

[PATCH v7 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections

2016-03-14 Thread Alexander Potapenko
the __softirq_entry macro which is similar to __irq_entry, but puts the corresponding functions to the .softirqentry.text section. Signed-off-by: Alexander Potapenko <gli...@google.com> Acked-by: Steven Rostedt <rost...@goodmis.org> --- v2: - per request from Steven Rostedt, moved the

  1   2   3   4   5   6   7   8   9   10   >