Re: [PATCH v4 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
On Fri, 6 Nov 2020 at 06:54, Arpitha Raghunandan <98.a...@gmail.com> wrote: > > On 06/11/20 1:25 am, Marco Elver wrote: > > On Thu, Nov 05, 2020 at 04:02PM +0100, Marco Elver wrote: > >> On Thu, 5 Nov 2020 at 15:30, Arpitha Raghunandan <98.a...@gmail.com> wrote:

Re: [PATCH kcsan 3/3] kcsan: Fix encoding masks and regain address bit

2020-11-06 Thread Marco Elver
On Fri, 6 Nov 2020 at 02:23, Boqun Feng wrote: > Hi Marco, > > On Thu, Nov 05, 2020 at 02:03:24PM -0800, paul...@kernel.org wrote: > > From: Marco Elver > > > > The watchpoint encoding masks for size and address were off-by-one bit > > each, with the

[PATCH] kfence: Fix parameter description for kfence_object_start()

2020-11-06 Thread Marco Elver
Describe parameter @addr correctly by delimiting with ':'. Reported-by: Stephen Rothwell Signed-off-by: Marco Elver --- include/linux/kfence.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kfence.h b/include/linux/kfence.h index 98a97f9d43cd..76246889ecdb

[PATCH v2] kcsan: Fix encoding masks and regain address bit

2020-11-06 Thread Marco Elver
is expected, since that extra address bit is insignificant for enabled architectures. Signed-off-by: Marco Elver --- v2: * Use WATCHPOINT_ADDR_BITS to avoid duplicating "BITS_PER_LONG-1 - WATCHPOINT_SIZE_BITS" per Boqun's suggestion. --- kernel/kcsan/encoding.h | 14 ++ 1 file

Re: [PATCH kcsan 3/3] kcsan: Fix encoding masks and regain address bit

2020-11-06 Thread Marco Elver
On Fri, 6 Nov 2020 at 11:19, Boqun Feng wrote: > > send a v2 for this one. > > Let me add an ack for that one, thanks! Thank you! -- Marco

Re: [PATCH v4 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
On Fri, Nov 06, 2020 at 09:11AM +0100, Marco Elver wrote: > On Fri, 6 Nov 2020 at 06:54, Arpitha Raghunandan <98.a...@gmail.com> wrote: [...] > > I think this format of output should be fine for parameterized tests. > > But, this patch has the same issue as earlier.

Re: [PATCH v5 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
generator function should return the next parameter given the > previous parameter in parameterized tests. It also provides > a macro to generate common-case generators. > > Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com> > Co-developed-by: Marco Elver > Signed-off-by:

Re: [PATCH v5 2/2] fs: ext4: Modify inode-test.c to use KUnit parameterized testing feature

2020-11-06 Thread Marco Elver
t; fs/ext4/inode-test.c | 314 ++- > 1 file changed, 158 insertions(+), 156 deletions(-) Acked-by: Marco Elver Thanks, -- Marco

Re: [PATCH v5 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
. > This generator function should return the next parameter given the > previous parameter in parameterized tests. It also provides > a macro to generate common-case generators. > > Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com> > Co-developed-by:

Re: [PATCH v5 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
On Fri, 6 Nov 2020 at 20:00, Arpitha Raghunandan <98.a...@gmail.com> wrote: > > On 07/11/20 12:15 am, Marco Elver wrote: > > On Fri, 6 Nov 2020 at 19:28, Arpitha Raghunandan <98.a...@gmail.com> wrote: > >> > >> Implementation of support for paramete

Re: [PATCH v6 1/2] kunit: Support for Parameterized Testing

2020-11-06 Thread Marco Elver
generator function should return the next parameter given the > previous parameter in parameterized tests. It also provides > a macro to generate common-case generators. > > Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com> > Co-developed-by: Marco Elver > Signed-off

Re: [PATCH v6 1/2] kunit: Support for Parameterized Testing

2020-11-07 Thread Marco Elver
ff-by: Arpitha Raghunandan <98.a...@gmail.com> > > Co-developed-by: Marco Elver > > Signed-off-by: Marco Elver > > --- > > This looks good to me! A couple of minor thoughts about the output > format below, but I'm quite happy to have this as-is regardless. > >

[PATCH v5 0/5] Add object validation in ksize()

2019-07-08 Thread Marco Elver
This version fixes several build issues -- Reported-by: kbuild test robot Previous version here: http://lkml.kernel.org/r/20190627094445.216365-1-el...@google.com Marco Elver (5): mm/kasan: Introduce __kasan_check_{read,write} mm/kasan: Change kasan_check_{read,write} to return boolean

[PATCH v5 1/5] mm/kasan: Introduce __kasan_check_{read,write}

2019-07-08 Thread Marco Elver
This introduces __kasan_check_{read,write}. __kasan_check functions may be used from anywhere, even compilation units that disable instrumentation selectively. This change eliminates the need for the __KASAN_INTERNAL definition. Signed-off-by: Marco Elver Acked-by: Mark Rutland Cc: Andrey

[PATCH v5 3/5] lib/test_kasan: Add test for double-kzfree detection

2019-07-08 Thread Marco Elver
Adds a simple test that checks if double-kzfree is being detected correctly. Signed-off-by: Marco Elver Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Mark

[PATCH v5 4/5] mm/slab: Refactor common ksize KASAN logic into slab_common.c

2019-07-08 Thread Marco Elver
This refactors common code of ksize() between the various allocators into slab_common.c: __ksize() is the allocator-specific implementation without instrumentation, whereas ksize() includes the required KASAN logic. Signed-off-by: Marco Elver Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander

[PATCH v5 5/5] mm/kasan: Add object validation in ksize()

2019-07-08 Thread Marco Elver
://bugzilla.kernel.org/show_bug.cgi?id=199359 Signed-off-by: Marco Elver Acked-by: Kees Cook Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Mark Rutland Cc: Kees Cook

[PATCH v5 2/5] mm/kasan: Change kasan_check_{read,write} to return boolean

2019-07-08 Thread Marco Elver
This changes {,__}kasan_check_{read,write} functions to return a boolean denoting if the access was valid or not. Signed-off-by: Marco Elver Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc

Re: [PATCH] mm/kasan: fix kasan_check_read() compiler warning

2019-07-09 Thread Marco Elver
On Tue, 9 Jul 2019 at 20:36, Arnd Bergmann wrote: > > The kasan_check_read() is marked 'inline', which usually includes > the 'always_inline' attribute. In some configuration, gcc decides that > it cannot inline this, causing a build failure: > > In file included from

Re: [PATCH 2/2] lib/test_kasan: Add stack overflow test

2019-07-23 Thread Marco Elver
On Tue, 23 Jul 2019 at 18:24, Mark Rutland wrote: > > On Fri, Jul 19, 2019 at 03:28:18PM +0200, Marco Elver wrote: > > Adds a simple stack overflow test, to check the error being reported on > > an overflow. Without CONFIG_STACK_GUARD_PAGE, the result is typically > >

Re: [PATCH v3 0/6] kasan: add workqueue and timer stack for generic KASAN

2020-08-25 Thread Marco Elver
d workqueue test case > kasan: update documentation for generic kasan Acked-by: Marco Elver > --- > > Changes since v2: > - modify kasan document to be more readable. > Thanks for Marco suggestion. > > Changes since v1: > - Thanks for Marco and Thomas suggestion.

Re: [PATCH 0/9] TRACE_IRQFLAGS wreckage

2020-08-20 Thread Marco Elver
>] 0x0 Suggestions? Thanks, -- Marco -- >8 -- From 4ec9dd472c978e1eba622fb22bc04e4357f10421 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Thu, 20 Aug 2020 19:06:09 +0200 Subject: [PATCH] sched: Turn inline into __always_inline due to noinstr use is_idle_task() may b

[PATCH] random32: Use rcuidle variant for tracepoint

2020-08-21 Thread Marco Elver
point for prandom_u32()") Link: https://lkml.kernel.org/r/20200820155923.3d5c4...@oasis.local.home Suggested-by: Steven Rostedt Signed-off-by: Marco Elver Cc: Eric Dumazet Cc: Peter Zijlstra --- lib/random32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/random32.c b/li

Re: [PATCH 0/9] TRACE_IRQFLAGS wreckage

2020-08-21 Thread Marco Elver
On Thu, Aug 20, 2020 at 03:59PM -0400, Steven Rostedt wrote: > On Thu, 20 Aug 2020 19:20:46 +0200 > Marco Elver wrote: > > > On Thu, Aug 20, 2020 at 04:58PM +0200, pet...@infradead.org wrote: > > > On Thu, Aug 20, 2020 at 10:36:43AM -0400, Steven Rostedt wrote: &

Re: [PATCH 0/9] TRACE_IRQFLAGS wreckage

2020-08-21 Thread Marco Elver
On Fri, 21 Aug 2020 at 08:54, wrote: > > On Thu, Aug 20, 2020 at 07:20:46PM +0200, Marco Elver wrote: > > From 4ec9dd472c978e1eba622fb22bc04e4357f10421 Mon Sep 17 00:00:00 2001 > > From: Marco Elver > > Date: Thu, 20 Aug 2020 19:06:09 +0200 > > Subje

Re: [PATCH] random32: Use rcuidle variant for tracepoint

2020-08-21 Thread Marco Elver
On Fri, 21 Aug 2020 at 08:30, Marco Elver wrote: > With KCSAN enabled, prandom_u32() may be called from any context, > including idle CPUs. > > Therefore, switch to using trace_prandom_u32_rcuidle(), to avoid various > issues due to recursion and lockdep warnings when KC

[PATCH] kcsan: Use tracing-safe version of prandom

2020-08-21 Thread Marco Elver
00821063043.1949509-1-el...@google.com Link: https://lkml.kernel.org/r/20200820172046.ga177...@elver.google.com Signed-off-by: Marco Elver --- Applies to latest -rcu/dev only. Let's wait a bit to see what happens with https://lkml.kernel.org/r/20200821063043.1949509-1-el...@google.com, just in case t

Re: [PATCH 1/3] lib, include/linux: add usercopy failure capability

2020-08-21 Thread Marco Elver
On Fri, Aug 21, 2020 at 01:51PM +0200, Dmitry Vyukov wrote: ... > > +++ b/lib/fault-inject-usercopy.c > > @@ -0,0 +1,66 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +#include > > +#include > > +#include > > + > > +static struct { > > + struct fault_attr attr; > > + u32

Re: [PATCH] random32: Use rcuidle variant for tracepoint

2020-08-21 Thread Marco Elver
On Fri, Aug 21, 2020 at 08:06AM -0700, Eric Dumazet wrote: > On Fri, Aug 21, 2020 at 1:59 AM wrote: > > > > On Fri, Aug 21, 2020 at 08:30:43AM +0200, Marco Elver wrote: > > > With KCSAN enabled, prandom_u32() may be called from any context, > > > including idle CP

Re: [PATCH kcsan 18/19] bitops, kcsan: Partially revert instrumentation for non-atomic bitops

2020-09-02 Thread Marco Elver
On Wed, Sep 02, 2020 at 11:30AM +0800, Boqun Feng wrote: > Hi Paul and Marco, > > The whole update patchset looks good to me, just one question out of > curiosity fo this one, please see below: > > On Mon, Aug 31, 2020 at 11:18:04AM -0700, paul...@kernel.org wrote: >

Re: Odd-sized kmem_cache_alloc and slub_debug=Z

2020-08-17 Thread Marco Elver
On Fri, 7 Aug 2020 at 21:06, Pekka Enberg wrote: ... > Yeah, it reproduces with defconfig too, as long as you remember to > pass "slub_debug=Z"... :-/ > > The following seems to be the culprit: > > commit 3202fa62fb43087387c65bfa9c100feffac74aa6 > Author: Kees Cook > Date: Wed Apr 1 21:04:27

Re: [PATCH] bitops, kcsan: Partially revert instrumentation for non-atomic bitops

2020-08-18 Thread Marco Elver
On Thu, 13 Aug 2020 at 18:39, Marco Elver wrote: > Previous to the change to distinguish read-write accesses, when > CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y is set, KCSAN would consider > the non-atomic bitops as atomic. We want to partially revert to this > behaviour, but with o

Re: [PATCH 35/35] kasan: add documentation for hardware tag-based mode

2020-08-28 Thread Marco Elver
On Fri, Aug 14, 2020 at 07:27PM +0200, Andrey Konovalov wrote: > Add documentation for hardware tag-based KASAN mode and also add some > clarifications for software tag-based mode. > > Signed-off-by: Andrey Konovalov > --- > Documentation/dev-tools/kasan.rst | 73 +--

Re: [GIT pull] sched/urgent for v5.9-rc2

2020-08-31 Thread Marco Elver
On Sun, 30 Aug 2020 at 20:54, Linus Torvalds wrote: > On Sun, Aug 30, 2020 at 11:04 AM Thomas Gleixner wrote: > > > > - Make is_idle_task() __always_inline to prevent the compiler from putting > >it out of line into the wrong section because it's used inside noinstr > >sections. > >

Re: [GIT pull] sched/urgent for v5.9-rc2

2020-08-31 Thread Marco Elver
On Mon, 31 Aug 2020 at 09:24, wrote: > > On Sun, Aug 30, 2020 at 11:54:19AM -0700, Linus Torvalds wrote: > > On Sun, Aug 30, 2020 at 11:04 AM Thomas Gleixner wrote: > > > > > > - Make is_idle_task() __always_inline to prevent the compiler from > > > putting > > >it out of line into the

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-06 Thread Marco Elver
On Wed, Aug 05, 2020 at 07:31PM +0200, Marco Elver wrote: ... > Oh well, it seems that KCSAN on syzbot still crashes even with this > "fix". It's harder to reproduce though, and I don't have a clear > reproducer other than "fuzz the kernel" right now. I think the

Re: Finally starting on short RCU grace periods, but...

2020-08-06 Thread Marco Elver
+Cc kasan-dev On Thu, 6 Aug 2020 at 01:08, Paul E. McKenney wrote: > > Hello! > > If I remember correctly, one of you asked for a way to shorten RCU > grace periods so that KASAN would have a better chance of detecting bugs > such as pointers being leaked out of RCU read-side critical sections.

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-06 Thread Marco Elver
On Thu, 6 Aug 2020 at 15:17, Marco Elver wrote: > > On Thu, Aug 06, 2020 at 01:32PM +0200, pet...@infradead.org wrote: > > On Thu, Aug 06, 2020 at 09:47:23AM +0200, Marco Elver wrote: > > > Testing my hypothesis that raw then nested non-raw > > > local_irq_save/resto

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-06 Thread Marco Elver
On Thu, Aug 06, 2020 at 01:32PM +0200, pet...@infradead.org wrote: > On Thu, Aug 06, 2020 at 09:47:23AM +0200, Marco Elver wrote: > > Testing my hypothesis that raw then nested non-raw > > local_irq_save/restore() breaks IRQ state tracking -- see the reproducer > > below. This

[PATCH] kcsan: Treat runtime as NMI-like with interrupt tracing

2020-08-07 Thread Marco Elver
/7d3b2d05ac1c3...@google.com Fixes: 248591f5d257 ("kcsan: Make KCSAN compatible with new IRQ state tracking") Reported-by: syzbot+8db9e1ecde74e590a...@syzkaller.appspotmail.com Co-developed-by: Peter Zijlstra (Intel) Signed-off-by: Marco Elver --- Patch Note: This patch applies to lates

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-07 Thread Marco Elver
On Thu, 6 Aug 2020 at 18:06, Marco Elver wrote: > On Thu, 6 Aug 2020 at 15:17, Marco Elver wrote: > > On Thu, Aug 06, 2020 at 01:32PM +0200, pet...@infradead.org wrote: > > > On Thu, Aug 06, 2020 at 09:47:23AM +0200, Marco Elver wrote: > > > > Testing my hypothesi

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-07 Thread Marco Elver
On Fri, Aug 07, 2020 at 12:35PM +0200, Jürgen Groß wrote: > On 07.08.20 11:50, Marco Elver wrote: > > On Fri, Aug 07, 2020 at 11:24AM +0200, Jürgen Groß wrote: > > > On 07.08.20 11:01, Marco Elver wrote: > > > > On Thu, 6 Aug 2020 at 18:06, Marco Elver wrote: > &g

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-07 Thread Marco Elver
On Fri, 7 Aug 2020 at 14:04, Jürgen Groß wrote: > > On 07.08.20 13:38, Marco Elver wrote: > > On Fri, Aug 07, 2020 at 12:35PM +0200, Jürgen Groß wrote: > >> On 07.08.20 11:50, Marco Elver wrote: > >>> On Fri, Aug 07, 2020 at 11:24AM +0200, Jürgen Groß wrote: >

Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers

2020-08-07 Thread Marco Elver
On Fri, Aug 07, 2020 at 02:08PM +0200, Marco Elver wrote: > On Fri, 7 Aug 2020 at 14:04, Jürgen Groß wrote: > > > > On 07.08.20 13:38, Marco Elver wrote: > > > On Fri, Aug 07, 2020 at 12:35PM +0200, Jürgen Groß wrote: > > >> On 07.08.20 11:50, Marco Elver wrote

Odd-sized kmem_cache_alloc and slub_debug=Z

2020-08-07 Thread Marco Elver
Hi, I found that the below debug-code using kmem_cache_alloc(), when using slub_debug=Z, results in the following crash: general protection fault, probably for non-canonical address 0xcca41caea170: [#1] PREEMPT SMP PTI CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.8.0+ #1

Re: Odd-sized kmem_cache_alloc and slub_debug=Z

2020-08-07 Thread Marco Elver
On Fri, Aug 07, 2020 at 08:06PM +0300, Pekka Enberg wrote: > Hi Marco, > > On Fri, Aug 7, 2020 at 7:07 PM Marco Elver wrote: > > I found that the below debug-code using kmem_cache_alloc(), when using > > slub_debug=Z, results in the following crash: > > > >

Re: Odd-sized kmem_cache_alloc and slub_debug=Z

2020-08-07 Thread Marco Elver
On Fri, Aug 07, 2020 at 10:16AM -0700, Kees Cook wrote: > On Fri, Aug 07, 2020 at 06:06:27PM +0200, Marco Elver wrote: > > I found that the below debug-code using kmem_cache_alloc(), when using > > slub_debug=Z, results in the following crash: > > > > general

Re: [PATCH] Documentation: kunit: Add naming guidelines

2020-09-07 Thread Marco Elver
On Fri, Sep 04, 2020 at 12:22PM +0800, David Gow wrote: [...] > > This is a good point -- renaming files is definitely a pain. It's > obviously my hope that KUnit sticks around long enough that it's not > being added/removed as a dependency too often, particularly for the > unit tests, so

[PATCH RFC 07/10] kfence, kmemleak: make KFENCE compatible with KMEMLEAK

2020-09-07 Thread Marco Elver
From: Alexander Potapenko Add compatibility with KMEMLEAK, by making KMEMLEAK aware of the KFENCE memory pool. This allows building debug kernels with both enabled, which also helped in debugging KFENCE. Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander

Re: [PATCH RFC 01/10] mm: add Kernel Electric-Fence infrastructure

2020-09-07 Thread Marco Elver
On Mon, 7 Sep 2020 at 17:43, Jonathan Cameron wrote: ... > Interesting bit of work. A few trivial things inline I spotted whilst having > a first read through. > > Thanks, > > Jonathan Thank you for having a look! We'll address these for v2. Thanks, -- Marco

Re: [PATCH RFC 09/10] kfence, Documentation: add KFENCE documentation

2020-09-07 Thread Marco Elver
On Mon, 7 Sep 2020 at 17:34, Andrey Konovalov wrote: > > On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote: > > > > Add KFENCE documentation in dev-tools/kfence.rst, and add to index. > > > > Co-developed-by: Alexander Potapenko > > Signed-off-by: Alexander

[PATCH RFC 10/10] kfence: add test suite

2020-09-07 Thread Marco Elver
-by: Alexander Potapenko Signed-off-by: Marco Elver --- lib/Kconfig.kfence | 12 + mm/kfence/Makefile | 3 + mm/kfence/kfence-test.c | 777 3 files changed, 792 insertions(+) create mode 100644 mm/kfence/kfence-test.c diff --git a/lib

[PATCH RFC 09/10] kfence, Documentation: add KFENCE documentation

2020-09-07 Thread Marco Elver
Add KFENCE documentation in dev-tools/kfence.rst, and add to index. Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- Documentation/dev-tools/index.rst | 1 + Documentation/dev-tools/kfence.rst | 285 + 2

[PATCH RFC 08/10] kfence, lockdep: make KFENCE compatible with lockdep

2020-09-07 Thread Marco Elver
KFENCE-allocated objects in static_obj(). Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- kernel/locking/lockdep.c | 8 1 file changed, 8 insertions(+) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index

[PATCH RFC 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-07 Thread Marco Elver
is_kfence_address(). Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- For ARM64, we would like to solicit feedback on what the best option is to obtain a constant address for __kfence_pool. One option is to declare a memory range in the memory layout

[PATCH RFC 04/10] mm, kfence: insert KFENCE hooks for SLAB

2020-09-07 Thread Marco Elver
are __always_inline. Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- mm/slab.c| 46 ++ mm/slab_common.c | 6 +- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/mm/slab.c b/mm

[PATCH RFC 05/10] mm, kfence: insert KFENCE hooks for SLUB

2020-09-07 Thread Marco Elver
are __always_inline. Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- mm/slub.c | 72 --- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index d4177aecedf6

[PATCH RFC 02/10] x86, kfence: enable KFENCE for x86

2020-09-07 Thread Marco Elver
need to ensure that the pool uses 4K pages, which is done using the set_memory_4k() helper function. Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- arch/x86/Kconfig | 2 ++ arch/x86/include/asm/kfence.h | 60

[PATCH RFC 06/10] kfence, kasan: make KFENCE compatible with KASAN

2020-09-07 Thread Marco Elver
of the two is generally discouraged, CONFIG_EXPERT=y should be set. It also gives us the nice property that KFENCE will be build-tested by allyesconfig builds. Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- lib/Kconfig.kfence | 2 +- mm/kasan

[PATCH RFC 01/10] mm: add Kernel Electric-Fence infrastructure

2020-09-07 Thread Marco Elver
l compared to the non-KFENCE baseline. For more details, see Documentation/dev-tools/kfence.rst (added later in the series). Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- MAINTAINERS| 11 + include/linux/kfence.h | 174 ++ i

[PATCH RFC 00/10] KFENCE: A low-overhead sampling-based memory safety error detector

2020-09-07 Thread Marco Elver
ernel Electric-Fence infrastructure x86, kfence: enable KFENCE for x86 mm, kfence: insert KFENCE hooks for SLAB mm, kfence: insert KFENCE hooks for SLUB kfence, kasan: make KFENCE compatible with KASAN kfence, kmemleak: make KFENCE compatible with KMEMLEAK Marco Elver (4): arm64, kfence: ena

Re: [PATCH RFC 09/10] kfence, Documentation: add KFENCE documentation

2020-09-07 Thread Marco Elver
On Mon, 7 Sep 2020 at 19:55, Andrey Konovalov wrote: > On Mon, Sep 7, 2020 at 6:33 PM Marco Elver wrote: [...] > > > > +Guarded allocations are set up based on the sample interval. After > > > > expiration > > > > +of the sample interval, a gu

Re: [RFC PATCH 1/2] lib/string: Disable instrumentation

2020-09-08 Thread Marco Elver
On Sun, 6 Sep 2020 at 00:23, Arvind Sankar wrote: > > String functions can be useful in early boot, but using instrumented > versions can be problematic: eg on x86, some of the early boot code is > executing out of an identity mapping rather than the kernel virtual > addresses. Accessing any

Re: [PATCH RFC 00/10] KFENCE: A low-overhead sampling-based memory safety error detector

2020-09-08 Thread Marco Elver
On Tue, Sep 08, 2020 at 05:36PM +0200, Vlastimil Babka wrote: > On 9/8/20 5:31 PM, Marco Elver wrote: > >> > >> How much memory overhead does this end up having? I know it depends on > >> the object size and so forth. But, could you give some real-world >

Re: [PATCH RFC 09/10] kfence, Documentation: add KFENCE documentation

2020-09-08 Thread Marco Elver
On Tue, Sep 08, 2020 at 08:54AM -0700, Dave Hansen wrote: > On 9/7/20 6:40 AM, Marco Elver wrote: > > +The most important parameter is KFENCE's sample interval, which can be set > > via > > +the kernel boot parameter ``kfence.sample_interval`` in milliseconds. The > >

Re: [PATCH 8/8] locking/atomics: Use read-write instrumentation for atomic RMWs

2020-08-14 Thread Marco Elver
On Fri, 14 Aug 2020 at 13:31, Mark Rutland wrote: > On Fri, Aug 14, 2020 at 12:28:26PM +0100, Mark Rutland wrote: > > Hi, > > > > Sorry to come to this rather late -- this comment equally applies to v2 > > so I'm replying here to have context. > > ... and now I see that was already applied, so

Re: [PATCH] kcsan: Treat runtime as NMI-like with interrupt tracing

2020-08-17 Thread Marco Elver
On Tue, 11 Aug 2020 at 08:56, Marco Elver wrote: > On Mon, 10 Aug 2020 at 22:18, Thomas Gleixner wrote: > > Marco Elver writes: > > > Since KCSAN instrumentation is everywhere, we need to treat the hooks > > > NMI-like for interrupt tracing. In order to present an as

Re: [PATCH v2 33/37] kasan, arm64: implement HW_TAGS runtime

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: [...] > arch/arm64/include/asm/memory.h | 4 +- > arch/arm64/kernel/setup.c | 1 - > include/linux/kasan.h | 6 +-- > include/linux/mm.h| 2 +- > include/linux/page-flags-layout.h | 2 +- >

Re: [PATCH v2 31/37] kasan, x86, s390: update undef CONFIG_KASAN

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: [...] > arch/s390/boot/string.c | 1 + > arch/x86/boot/compressed/misc.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/arch/s390/boot/string.c b/arch/s390/boot/string.c > index b11e8108773a..faccb33b462c 100644 >

Re: [PATCH v2 00/10] KFENCE: A low-overhead sampling-based memory safety error detector

2020-09-18 Thread Marco Elver
On Fri, 18 Sep 2020 at 13:17, Qian Cai wrote: > > On Tue, 2020-09-15 at 15:20 +0200, Marco Elver wrote: > > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a > > low-overhead sampling-based memory safety error detector of heap > > use-after-fre

Re: [PATCH v2 21/37] kasan: introduce CONFIG_KASAN_HW_TAGS

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: > This patch adds a configuration option for a new KASAN mode called > hardware tag-based KASAN. This mode uses the memory tagging approach > like the software tag-based mode, but relies on arm64 Memory Tagging > Extension feature for

Re: [PATCH v2 33/37] kasan, arm64: implement HW_TAGS runtime

2020-09-18 Thread Marco Elver
[ Sorry for the additional email on this patch; trying to consolidate comments now. ] On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: > Provide implementation of KASAN functions required for the hardware > tag-based mode. Those include core functions for memory and pointer >

Re: [PATCH v2 23/37] arm64: kasan: Add arch layer for memory tagging helpers

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, 'Andrey Konovalov' via kasan-dev wrote: > This patch add a set of arch_*() memory tagging helpers currently only > defined for arm64 when hardware tag-based KASAN is enabled. These helpers > will be used by KASAN runtime to implement the hardware tag-based

Re: [PATCH v2 35/37] kasan, slub: reset tags when accessing metadata

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: [...] > static void set_track(struct kmem_cache *s, void *object, > @@ -583,7 +585,8 @@ static void set_track(struct kmem_cache *s, void *object, > unsigned int nr_entries; > > metadata_access_enable(); >

Re: [PATCH 03/35] kasan: shadow declarations only for software modes

2020-09-18 Thread Marco Elver
On Fri, Aug 14, 2020 at 07:26PM +0200, Andrey Konovalov wrote: > This is a preparatory commit for the upcoming addition of a new hardware > tag-based (MTE-based) KASAN mode. > > Group shadow-related KASAN function declarations and only define them > for the two existing software modes. > > No

Re: [PATCH v2 33/37] kasan, arm64: implement HW_TAGS runtime

2020-09-18 Thread Marco Elver
On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: > diff --git a/include/linux/kasan.h b/include/linux/kasan.h > index 875bbcedd994..613c9d38eee5 100644 > --- a/include/linux/kasan.h > +++ b/include/linux/kasan.h > @@ -184,7 +184,7 @@ static inline void kasan_record_aux_stack(void

Re: [PATCH v2 21/37] kasan: introduce CONFIG_KASAN_HW_TAGS

2020-09-18 Thread Marco Elver
On Fri, 18 Sep 2020 at 17:06, 'Andrey Konovalov' via kasan-dev wrote: > > On Fri, Sep 18, 2020 at 2:32 PM Marco Elver wrote: > > > > On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote: > > > This patch adds a configuration option for a new KASAN mode call

Re: [PATCH] ubsan: introducing CONFIG_UBSAN_BOUNDS_LOCAL for Clang

2020-09-19 Thread Marco Elver
On Fri, 18 Sep 2020 at 15:36, George-Aurelian Popescu wrote: > > From: George Popescu > [...] > Suggested-by: Marco Elver > Reviewed-by: David Brazdil > Signed-off-by: George Popescu There's a mismatch between From/Author and Signed-off-by email address. > --- > lib

Re: [PATCH v4 3/6] kasan: print timer and workqueue stack

2020-09-24 Thread Marco Elver
ange the auxiliary stack title for common title, > > print them in KASAN report. > > > > Signed-off-by: Walter Wu > > Suggested-by: Marco Elver > > Acked-by: Marco Elver > > Reviewed-by: Dmitry Vyukov > > Reviewed-by: Andrey Konovalov > > Cc:

Re: [PATCH v4 3/6] kasan: print timer and workqueue stack

2020-09-24 Thread Marco Elver
On Thu, 24 Sep 2020 at 14:11, Alexander Potapenko wrote: > > On Thu, Sep 24, 2020 at 1:55 PM Marco Elver wrote: > > > > On Thu, 24 Sep 2020 at 13:47, Alexander Potapenko wrote: > > > > > > On Thu, Sep 24, 2020 at 6:05 AM Walter Wu > > > wrot

[PATCH v6 1/9] mm: add Kernel Electric-Fence infrastructure

2020-10-29 Thread Marco Elver
-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v6: * Record allocation and free task pids, and show them in reports. This information helps more easily identify e.g. racy use-after-frees. v5: * MAJOR CHANGE: Removal of HAVE_ARCH_KFENCE_STATIC_POOL and s

[PATCH v6 0/9] KFENCE: A low-overhead sampling-based memory safety error detector

2020-10-29 Thread Marco Elver
mm: add Kernel Electric-Fence infrastructure x86, kfence: enable KFENCE for x86 mm, kfence: insert KFENCE hooks for SLAB mm, kfence: insert KFENCE hooks for SLUB kfence, kasan: make KFENCE compatible with KASAN Marco Elver (4): arm64, kfence: enable KFENCE for ARM64 kfence, Documentation: add

[PATCH v6 8/9] kfence: add test suite

2020-10-29 Thread Marco Elver
-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v5: * Add better memory corruption test. * Test sl*b_def.h primitives. v4: * Clarify RCU test comment [reported by Paul E. McKenney]. v3: * Lower line buffer size to avoid warnings of using more than 1024 bytes

[PATCH v6 2/9] x86, kfence: enable KFENCE for x86

2020-10-29 Thread Marco Elver
need to ensure that the pool uses 4K pages, which is done using the set_memory_4k() helper function. Reviewed-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v5: * MAJOR CHANGE: Switch to the memblock_alloc'd pool. Running

[PATCH v6 9/9] MAINTAINERS: Add entry for KFENCE

2020-10-29 Thread Marco Elver
Add entry for KFENCE maintainers. Reviewed-by: Dmitry Vyukov Reviewed-by: SeongJae Park Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v4: * Split out from first patch. --- MAINTAINERS | 11 +++ 1 file changed, 11 insertions

[PATCH v6 7/9] kfence, Documentation: add KFENCE documentation

2020-10-29 Thread Marco Elver
Add KFENCE documentation in dev-tools/kfence.rst, and add to index. Reviewed-by: Dmitry Vyukov Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v3: * Re-introduce reference to Documentation/dev-tools/kfence.rst. v2: * Many clarifications

[PATCH v6 5/9] mm, kfence: insert KFENCE hooks for SLUB

2020-10-29 Thread Marco Elver
-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v5: * Fix obj_to_index for kfence objects. v3: * Rewrite patch description to clarify need for 'orig_size' [reported by Christopher Lameter]. --- include/linux/slub_def.h | 3 ++ mm

[PATCH v6 6/9] kfence, kasan: make KFENCE compatible with KASAN

2020-10-29 Thread Marco Elver
of the two is generally discouraged, CONFIG_EXPERT=y should be set. It also gives us the nice property that KFENCE will be build-tested by allyesconfig builds. Reviewed-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v5: * Also

[PATCH v6 4/9] mm, kfence: insert KFENCE hooks for SLAB

2020-10-29 Thread Marco Elver
-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v5: * New kfence_shutdown_cache(): we need to defer kfence_shutdown_cache() to before the cache is actually freed. In case of SLAB_TYPESAFE_BY_RCU, the objects may still legally

[PATCH v6 3/9] arm64, kfence: enable KFENCE for ARM64

2020-10-29 Thread Marco Elver
-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v5: * Move generic page allocation code to core.c [suggested by Jann Horn]. * Remove comment about HAVE_ARCH_KFENCE_STATIC_POOL, since we no longer support static pools. * Force page granularity

Re: [PATCH v5 3/3] mac80211: add KCOV remote annotations to incoming frame processing

2020-10-29 Thread Marco Elver
On Thu, 29 Oct 2020 at 18:44, Johannes Berg wrote: > On Thu, 2020-10-29 at 17:36 +, Aleksandr Nogikh wrote: > > From: Aleksandr Nogikh > > > > Add KCOV remote annotations to ieee80211_iface_work() and > > ieee80211_rx_list(). This will enable coverage-guided fuzzing of > > mac80211 code that

Re: [PATCH v3 01/10] mm: add Kernel Electric-Fence infrastructure

2020-09-25 Thread Marco Elver
On Fri, 25 Sep 2020 at 13:24, 'SeongJae Park' via kasan-dev wrote: > > On Mon, 21 Sep 2020 15:26:02 +0200 Marco Elver wrote: > > > From: Alexander Potapenko > > > > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a > > low-overhead s

Re: [PATCH v7 0/9] KFENCE: A low-overhead sampling-based memory safety error detector

2020-11-04 Thread Marco Elver
On Wed, 4 Nov 2020 at 01:31, Andrew Morton wrote: > On Tue, 3 Nov 2020 18:58:32 +0100 Marco Elver wrote: > > > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a > > low-overhead sampling-based memory safety error detector of heap > > use-after-fre

Re: [PATCH v7 3/9] arm64, kfence: enable KFENCE for ARM64

2020-11-04 Thread Marco Elver
On Wed, 4 Nov 2020 at 14:06, Mark Rutland wrote: > On Tue, Nov 03, 2020 at 06:58:35PM +0100, Marco Elver wrote: > > Add architecture specific implementation details for KFENCE and enable > > KFENCE for the arm64 architecture. In particular, this implements the > &g

Re: [PATCH v4 1/2] kunit: Support for Parameterized Testing

2020-11-05 Thread Marco Elver
On Thu, 5 Nov 2020 at 08:32, Arpitha Raghunandan <98.a...@gmail.com> wrote: > > On 28/10/20 12:51 am, Marco Elver wrote: > > On Tue, 27 Oct 2020 at 18:47, Arpitha Raghunandan <98.a...@gmail.com> wrote: > >> > >> Implementation of support for paramete

[PATCH] kfence: Use pt_regs to generate stack trace on faults

2020-11-05 Thread Marco Elver
errors, where pt_regs is used to generate the stack trace. If the kernel is a DEBUG_KERNEL, also show registers for more information. Suggested-by: Mark Rutland Signed-off-by: Marco Elver --- arch/arm64/include/asm/kfence.h | 2 -- arch/arm64/mm/fault.c | 2 +- arch/x86/include/asm

Re: [PATCH] kfence: Use pt_regs to generate stack trace on faults

2020-11-05 Thread Marco Elver
On Thu, 5 Nov 2020 at 11:52, Mark Rutland wrote: > On Thu, Nov 05, 2020 at 10:21:33AM +0100, Marco Elver wrote: > > Instead of removing the fault handling portion of the stack trace based > > on the fault handler's name, just use struct pt_regs directly. > > > > Chan

Re: [PATCH v4 1/2] kunit: Support for Parameterized Testing

2020-11-05 Thread Marco Elver
On Thu, 5 Nov 2020 at 15:30, Arpitha Raghunandan <98.a...@gmail.com> wrote: > > On 05/11/20 2:00 pm, Marco Elver wrote: > > On Thu, 5 Nov 2020 at 08:32, Arpitha Raghunandan <98.a...@gmail.com> wrote: > >> > >> On 28/10/20 12:51 am, Marco Elver wrote: &

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-22 Thread Marco Elver
On Mon, 21 Sep 2020 at 19:44, Will Deacon wrote: [...] > > > > > For ARM64, we would like to solicit feedback on what the best option > > > > > is > > > > > to obtain a constant address for __kfence_pool. One option is to > > > > > declare > > > > > a memory range in the memory layout to be

Re: general protection fault in perf_misc_flags

2020-09-28 Thread Marco Elver
On Mon, 28 Sep 2020 at 07:18, Dmitry Vyukov wrote: > > On Sun, Sep 27, 2020 at 4:57 PM Borislav Petkov wrote: > > > > On Sat, Sep 19, 2020 at 01:32:14AM -0700, syzbot wrote: > > > Hello, > > > > > > syzbot found the following issue on: > > > > > > HEAD commit:92ab97ad Merge tag

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