Re: [PATCH 1/4] tracing: add error_report trace points

2021-01-14 Thread Marco Elver
On Thu, 14 Jan 2021 at 08:50, Alexander Potapenko wrote: > > On Wed, Jan 13, 2021 at 10:10 PM Steven Rostedt wrote: > > > > On Wed, 13 Jan 2021 10:16:54 +0100 > > Alexander Potapenko wrote: > > > > > +DECLARE_EVENT_CLASS(error_report_template, > > > + TP_PROTO(const char

Re: [PATCH] kcsan: Add missing license and copyright headers

2021-01-15 Thread Marco Elver
On Fri, 15 Jan 2021 at 22:58, Paul E. McKenney wrote: > This one seemed straightforward and I heard no objections to the previous > two-patch series, so I queued them for the v5.13 merge window, thank you! > > If any of them need adjustment, please send me the updated patch and > tell me which

Re: [PATCH] kcsan: Add missing license and copyright headers

2021-01-15 Thread Marco Elver
On Sat, 16 Jan 2021 at 00:31, Paul E. McKenney wrote: > On Sat, Jan 16, 2021 at 12:21:53AM +0100, Marco Elver wrote: > > On Fri, 15 Jan 2021 at 22:58, Paul E. McKenney wrote: > > > > > This one seemed straightforward and I heard no objections to the previous > > &

Re: UBSAN: array-index-out-of-bounds in decode_data

2021-01-21 Thread Marco Elver
On Thu, 21 Jan 2021 at 19:30, syzbot wrote: > syzbot has found a reproducer for the following issue on: > > HEAD commit:9791581c Merge tag 'for-5.11-rc4-tag' of git://git.kernel... > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=13cd09a4d0 > kernel

Re: [PATCH] kasan: fix HW_TAGS boot parameters

2021-01-18 Thread Marco Elver
.googlesource.com/id/Ib3694ed90b1e8ccac6cf77dfd301847af4aba7b8 > Signed-off-by: Andrey Konovalov Thanks for the simplification. Reviewed-by: Marco Elver > --- > Documentation/dev-tools/kasan.rst | 27 +++ > mm/kasan/hw_tags.c| 77 +--

Re: [PATCH v2 04/14] kasan: add macros to simplify checking test constraints

2021-01-13 Thread Marco Elver
w.googlesource.com/id/I237484a7fddfedf4a4aae9cc61ecbcdbe85a0a63 > Suggested-by: Alexander Potapenko > Signed-off-by: Andrey Konovalov Nice! Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 101 +++ > 1 file changed, 31 insertions(+), 70 deletions(-) >

Re: [PATCH v2 09/14] kasan: adapt kmalloc_uaf2 test to HW_TAGS mode

2021-01-13 Thread Marco Elver
00bf36388d55 > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > index 283feda9882a..a1a35d75ee1e 100644 > --- a/lib/test_kasan.

Re: [PATCH v2 14/14] kasan: don't run tests when KASAN is not enabled

2021-01-13 Thread Marco Elver
On Wed, 13 Jan 2021 at 17:22, Andrey Konovalov wrote: > > Don't run KASAN tests when it's disabled with kasan.mode=off to avoid > corrupting kernel memory. > > Link: > https://linux-review.googlesource.com/id/I6447af436a69a94bfc35477f6bf4e2122948355e > Signed-off-by: Andrey Konovalov > --- >

Re: [PATCH v2 08/14] kasan: add compiler barriers to KUNIT_EXPECT_KASAN_FAIL

2021-01-13 Thread Marco Elver
l fail. > > Add compiler barriers around the expression in KUNIT_EXPECT_KASAN_FAIL > and use READ/WRITE_ONCE() for accessing fail_data fields. > > Link: > https://linux-review.googlesource.com/id/I046079f48641a1d36fe627fc8827a9249102fd50 > Signed-off-by: Andrey Konovalov Rev

Re: [PATCH v2 03/14] kasan: clean up comments in tests

2021-01-13 Thread Marco Elver
On Wed, 13 Jan 2021 at 17:21, Andrey Konovalov wrote: > > Clarify and update comments in KASAN tests. > > Link: > https://linux-review.googlesource.com/id/I6c816c51fa1e0eb7aa3dead6bda1f339d2af46c8 > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --

Re: [PATCH v2 13/14] kasan: add a test for kmem_cache_alloc/free_bulk

2021-01-13 Thread Marco Elver
On Wed, 13 Jan 2021 at 17:22, Andrey Konovalov wrote: > > Add a test for kmem_cache_alloc/free_bulk to make sure there are now > false-positives when these functions are used. s/now/no/ (but by itself doesn't necessarily demand a v3) > Link: >

Re: [PATCH v2 05/14] kasan: add match-all tag tests

2021-01-13 Thread Marco Elver
> Note, that test #3 causes a significant number (255) of KASAN reports > to be printed during execution for the SW_TAGS mode. > > Link: > https://linux-review.googlesource.com/id/I78f1375efafa162b37f3abcb2c5bc2f3955dfd8e > Signed-off-by: Andrey Konovalov Reviewed-by: Marco

Re: [PATCH v2 11/14] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-13 Thread Marco Elver
On Wed, 13 Jan 2021 at 17:22, Andrey Konovalov wrote: > > The currently existing kasan_check_read/write() annotations are intended > to be used for kernel modules that have KASAN compiler instrumentation > disabled. Thus, they are only relevant for the software KASAN modes that > rely on compiler

Re: [PATCH v2 11/14] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-14 Thread Marco Elver
On Thu, 14 Jan 2021 at 19:01, 'Andrey Konovalov' via kasan-dev wrote: > On Wed, Jan 13, 2021 at 5:54 PM Marco Elver wrote: > > > > > +/* > > > + * Unlike kasan_check_read/write(), kasan_check_byte() is performed even > > > for > > > + * the hardware

Re: upstream build error (12)

2021-01-14 Thread Marco Elver
On Thu, 14 Jan 2021 at 19:07, Nick Desaulniers wrote: > On Thu, Jan 14, 2021 at 4:38 AM 'Dmitry Vyukov' via Clang Built Linux > wrote: > > > > On Thu, Jan 14, 2021 at 12:32 PM Dmitry Vyukov wrote: > > > > > > On Tue, Jan 12, 2021 at 8:41 PM Nathan Chancellor > > > wrote: > > > > > > > > Would

Re: upstream build error (12)

2021-01-12 Thread Marco Elver
On Tue, 12 Jan 2021 at 21:32, Nathan Chancellor wrote: > > On Tue, Jan 12, 2021 at 12:40:58PM -0700, Nathan Chancellor wrote: > > On Tue, Jan 12, 2021 at 11:20:27AM -0800, syzbot wrote: > > > Hello, > > > > > > syzbot found the following issue on: > > > > > > HEAD commit:e609571b Merge tag

Re: [PATCH 10/11] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-12 Thread Marco Elver
On Tue, 12 Jan 2021 at 22:16, Andrey Konovalov wrote: > > On Tue, Jan 12, 2021 at 3:32 PM Marco Elver wrote: > > > > > +/* > > > + * Unlike kasan_check_read/write(), kasan_check_byte() is performed even > > > for > > > + * the hardw

Re: [PATCH v2] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols

2021-01-14 Thread Marco Elver
for unreferenced > undefined symbols so the module loader is reading too much. If we ever > need to ignore more symbols, the code should be refactored to ignore > unreferenced symbols. > > Reported-by: Marco Elver > Link: https://github.com/ClangBuiltLinux/linux/issues/12

Re: [PATCH v3 15/15] kasan: don't run tests when KASAN is not enabled

2021-01-15 Thread Marco Elver
: Andrey Konovalov Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > index a96376aa7293..6238b56127f8 100644 > --- a/lib/test_kasan.c > +++ b/lib/test_kasan.c

Re: [PATCH v3 14/15] kasan: add a test for kmem_cache_alloc/free_bulk

2021-01-15 Thread Marco Elver
3d > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 38 +- > 1 file changed, 33 insertions(+), 5 deletions(-) > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > index ab22a653762e..a96376aa7293 100644

Re: [PATCH v3 11/15] kasan: move _RET_IP_ to inline wrappers

2021-01-15 Thread Marco Elver
> > Now that KASAN has inline wrappers for all of its annotations, move > _RET_IP_ to those wrappers to simplify annotation call sites. > > Link: > https://linux-review.googlesource.com/id/I8fb3c06d49671305ee184175a39591bc26647a67 > Signed-off-by: Andrey Konovalov Much ni

Re: [PATCH v3 12/15] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-15 Thread Marco Elver
nd via plain accesses that happen later. > > Link: > https://linux-review.googlesource.com/id/Iaabf771881d0f9ce1b969f2a62938e99d3308ec5 > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > include/linux/kasan-checks.h | 6 ++ > include

[PATCH] kcsan: Add missing license and copyright headers

2021-01-15 Thread Marco Elver
Adds missing license and/or copyright headers for KCSAN source files. Signed-off-by: Marco Elver --- Documentation/dev-tools/kcsan.rst | 3 +++ include/linux/kcsan-checks.h | 6 ++ include/linux/kcsan.h | 7 +++ kernel/kcsan/atomic.h | 5 + kernel/kcsan

[PATCH mm 1/4] kfence: add missing copyright and description headers

2021-01-18 Thread Marco Elver
Add missing copyright and description headers to KFENCE source files. Signed-off-by: Marco Elver --- If appropriate, to be squashed into: mm: add Kernel Electric-Fence infrastructure --- include/linux/kfence.h | 6 ++ mm/kfence/core.c | 5 + mm/kfence/kfence.h | 6

[PATCH mm 2/4] kfence, x86: add missing copyright and description header

2021-01-18 Thread Marco Elver
Add missing copyright and description header to KFENCE source file. Signed-off-by: Marco Elver --- If appropriate, to be squashed into: x86, kfence: enable KFENCE for x86 --- arch/x86/include/asm/kfence.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm

[PATCH mm 4/4] kfence: add missing copyright header to documentation

2021-01-18 Thread Marco Elver
Add missing copyright header to KFENCE documentation. Signed-off-by: Marco Elver --- If appropriate, to be squashed into: kfence, Documentation: add KFENCE documentation --- Documentation/dev-tools/kfence.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/dev-tools

[PATCH mm 3/4] kfence, arm64: add missing copyright and description header

2021-01-18 Thread Marco Elver
Add missing copyright and description header to KFENCE source file. Signed-off-by: Marco Elver --- If appropriate, to be squashed into: arm64, kfence: enable KFENCE for ARM64 --- arch/arm64/include/asm/kfence.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/include

Re: [PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-10-05 Thread Marco Elver
On Fri, 2 Oct 2020 at 20:28, Jann Horn wrote: [...] > > > > > > Do you have performance numbers or a description of why you believe > > > that this part of kfence is exceptionally performance-sensitive? If > > > not, it might be a good idea to remove this optimization, at least for > > > the

Re: [PATCH v4 02/11] x86, kfence: enable KFENCE for x86

2020-10-07 Thread Marco Elver
On Fri, 2 Oct 2020 at 07:45, Jann Horn wrote: > > On Tue, Sep 29, 2020 at 3:38 PM Marco Elver wrote: > > Add architecture specific implementation details for KFENCE and enable > > KFENCE for the x86 architecture. In particular, this implements the > > required inte

Re: [PATCH v4 02/11] x86, kfence: enable KFENCE for x86

2020-10-07 Thread Marco Elver
On Wed, 7 Oct 2020 at 16:15, Jann Horn wrote: > > On Wed, Oct 7, 2020 at 3:09 PM Marco Elver wrote: > > On Fri, 2 Oct 2020 at 07:45, Jann Horn wrote: > > > On Tue, Sep 29, 2020 at 3:38 PM Marco Elver wrote: > > > > Add architecture specific implementat

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

2020-08-05 Thread Marco Elver
On Wed, Aug 05, 2020 at 03:42PM +0200, pet...@infradead.org wrote: > On Wed, Aug 05, 2020 at 03:26:29PM +0200, Marco Elver wrote: > > Add missing noinstr to arch_local*() helpers, as they may be called from > > noinstr code. > > > > On a KCSAN config with CONFIG_PARAVIR

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

2020-08-05 Thread Marco Elver
On Wed, 5 Aug 2020 at 16:36, Marco Elver wrote: > > On Wed, 5 Aug 2020 at 16:17, wrote: > > > > On Wed, Aug 05, 2020 at 04:12:37PM +0200, pet...@infradead.org wrote: > > > On Wed, Aug 05, 2020 at 03:59:40PM +0200, Marco Elver wrote: > > > > On

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

2020-08-05 Thread Marco Elver
save_flags() in paravirt.h, which is called from noinstr functions in smp_processor_id.c, which in turn are called from lockdep. Link: https://lkml.kernel.org/r/7d3b2d05ac1c3...@google.com Reported-by: syzbot+8db9e1ecde74e590a...@syzkaller.appspotmail.com Signed-off-by: Marco Elver --- arch/x86/i

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

2020-08-05 Thread Marco Elver
On Wed, 5 Aug 2020 at 16:17, wrote: > > On Wed, Aug 05, 2020 at 04:12:37PM +0200, pet...@infradead.org wrote: > > On Wed, Aug 05, 2020 at 03:59:40PM +0200, Marco Elver wrote: > > > On Wed, Aug 05, 2020 at 03:42PM +0200, pet...@infradead.org wrote: > > > > >

Re: [PATCH v4 03/11] arm64, kfence: enable KFENCE for ARM64

2020-10-02 Thread Marco Elver
On Fri, 2 Oct 2020 at 08:48, Jann Horn wrote: > > On Tue, Sep 29, 2020 at 3:38 PM Marco Elver wrote: > > Add architecture specific implementation details for KFENCE and enable > > KFENCE for the arm64 architecture. In particular, this implements the > > required

Re: [PATCH v3] ubsan: introducing CONFIG_UBSAN_LOCAL_BOUNDS for Clang

2020-10-02 Thread Marco Elver
> > > [1] http://lists.llvm.org/pipermail/llvm-dev/2012-May/049972.html > > [2] > > http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131021/091536.html > > > > Suggested-by: Marco Elver > > Reviewed-by: David Brazdil > > Reviewed-by: Ma

Re: [PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-10-02 Thread Marco Elver
Hi Jann, Thanks for your comments!! On Fri, Oct 02, 2020 at 08:33AM +0200, Jann Horn wrote: > On Tue, Sep 29, 2020 at 3:38 PM Marco Elver wrote: > > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a > > low-overhead sampling-based memory safety error d

Re: [PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-10-02 Thread Marco Elver
On Fri, Oct 02, 2020 at 09:31PM +0200, Jann Horn wrote: [...] > > > > > > If !CONFIG_HAVE_ARCH_KFENCE_STATIC_POOL, this should probably always > > > return false if __kfence_pool is NULL, right? > > > > That's another check; we don't want to make this more expensive. > > Ah, right, I missed that

Re: [PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-10-02 Thread Marco Elver
On Fri, 2 Oct 2020 at 21:32, Jann Horn wrote: > > That's another check; we don't want to make this more expensive. > > Ah, right, I missed that this is the one piece of KFENCE that is > actually really hot code until Dmitry pointed that out. > > But actually, can't you reduce how hot this is for

[PATCH] kcsan: Optimize debugfs stats counters

2020-08-10 Thread Marco Elver
usage sites at compile-time. Signed-off-by: Marco Elver --- kernel/kcsan/core.c| 22 +++--- kernel/kcsan/debugfs.c | 21 + kernel/kcsan/kcsan.h | 12 ++-- kernel/kcsan/report.c | 2 +- 4 files changed, 23 insertions(+), 34 deletions(-) diff

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

2020-08-10 Thread Marco Elver
On Fri, 7 Aug 2020 at 19:06, Paul E. McKenney wrote: > On Fri, Aug 07, 2020 at 11:00:31AM +0200, Marco Elver wrote: > > Since KCSAN instrumentation is everywhere, we need to treat the hooks > > NMI-like for interrupt tracing. In order to present an as 'normal' as > > possibl

Re: KCSAN: data-race in __xa_clear_mark / xas_find_marked

2020-08-10 Thread Marco Elver
[+Cc XArray maintainer] Hi Matthew, On Mon, Aug 10, 2020 at 05:41AM -0700, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit:fc80c51f Merge tag 'kbuild-v5.9' of git://git.kernel.org/p.. > git tree: upstream > console output:

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

2020-08-11 Thread Marco Elver
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 'normal' as > > possible context to the code called by KCSAN

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

2020-08-11 Thread Marco Elver
On Fri, 7 Aug 2020 at 17:19, Marco Elver wrote: > 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,

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

2020-09-29 Thread Marco Elver
On Tue, Sep 29, 2020 at 02:42PM +0200, Andrey Konovalov wrote: [...] > > +*/ > > + index = (addr - (unsigned long)__kfence_pool) / (PAGE_SIZE * 2) - 1; > > Why do we subtract 1 here? We do have the metadata entry reserved for > something? Above the declaration of __kfence_pool it

[PATCH v4 04/11] mm, kfence: insert KFENCE hooks for SLAB

2020-09-29 Thread Marco Elver
-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v3: * Rewrite patch description to clarify need for 'orig_size' [reported by Christopher Lameter]. --- mm/slab.c| 46 ++ mm

[PATCH v4 03/11] arm64, kfence: enable KFENCE for ARM64

2020-09-29 Thread Marco Elver
is_kfence_address(). Reviewed-by: Dmitry Vyukov Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/kfence.h | 39 + arch/arm64/mm/fault.c | 4

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

2020-09-29 Thread Marco Elver
m, kfence: insert KFENCE hooks for SLUB kfence, kasan: make KFENCE compatible with KASAN kfence, kmemleak: make KFENCE compatible with KMEMLEAK Marco Elver (5): arm64, kfence: enable KFENCE for ARM64 kfence, lockdep: make KFENCE compatible with lockdep kfence, Documentation: add KFENCE do

[PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-09-29 Thread Marco Elver
-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v4 * Make static memory pool's attrs entirely arch-dependent. * Revert MAINTAINERS, and make separate patch. * Fix report generation if __slab_free tail-called. v3: * Reports by SeongJae Park: * Remove

[PATCH v4 08/11] kfence, lockdep: make KFENCE compatible with lockdep

2020-09-29 Thread Marco Elver
KFENCE-allocated objects in static_obj(). Reviewed-by: Dmitry Vyukov 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

[PATCH v4 11/11] MAINTAINERS: Add entry for KFENCE

2020-09-29 Thread Marco Elver
Add entry for KFENCE maintainers. Reviewed-by: Dmitry Vyukov 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(+) diff --git a/MAINTAINERS b

[PATCH v4 05/11] mm, kfence: insert KFENCE hooks for SLUB

2020-09-29 Thread Marco Elver
-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Alexander Potapenko --- v3: * Rewrite patch description to clarify need for 'orig_size' [reported by Christopher Lameter]. --- mm/slub.c | 72 --- 1 file

[PATCH v4 02/11] x86, kfence: enable KFENCE for x86

2020-09-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 --- v4: * Define __kfence_pool_attrs. --- arch/x86/Kconfig | 2

[PATCH v4 07/11] kfence, kmemleak: make KFENCE compatible with KMEMLEAK

2020-09-29 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. Reviewed-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver

[PATCH v4 09/11] kfence, Documentation: add KFENCE documentation

2020-09-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 v4 10/11] kfence: add test suite

2020-09-29 Thread Marco Elver
-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v4: * Clarify RCU test comment [reported by Paul E. McKenney]. v3: * Lower line buffer size to avoid warnings of using more than 1024 bytes stack usage [reported by kernel test robot ]. v2: * Update

[PATCH v4 06/11] kfence, kasan: make KFENCE compatible with KASAN

2020-09-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 --- lib

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

2020-09-29 Thread Marco Elver
On Tue, 29 Sep 2020 at 15:48, Andrey Konovalov wrote: > On Tue, Sep 29, 2020 at 3:11 PM Marco Elver wrote: > > > > On Tue, Sep 29, 2020 at 02:42PM +0200, Andrey Konovalov wrote: > > [...] > > > > +*/ > > > > + index = (addr - (

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

2020-09-29 Thread Marco Elver
On Tue, 29 Sep 2020 at 16:24, Mark Rutland wrote: [...] > > From other sub-threads it sounds like these addresses are not part of > the linear/direct map. Having kmalloc return addresses outside of the > linear map is going to break anything that relies on virt<->phys > conversions, and is liable

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

2020-10-14 Thread Marco Elver
On Thu, 8 Oct 2020 at 12:45, Mark Rutland wrote: > On Thu, Oct 08, 2020 at 11:40:52AM +0200, Marco Elver wrote: > > On Thu, 1 Oct 2020 at 19:58, Mark Rutland wrote: > > [...] > > > > > If you need virt_to_page() to work, the address has to be part of t

Re: [PATCH RFC 5/8] kasan: mark kasan_init_tags as __init

2020-10-15 Thread Marco Elver
On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote: > > Similarly to kasan_init() mark kasan_init_tags() as __init. > > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/I8792e22f1ca5a703c5e979969147968a99312558 > --- > include/linux/kasan.h | 4 ++-- >

Re: [PATCH RFC 8/8] kasan: add and integrate kasan_mode boot param

2020-10-15 Thread Marco Elver
On Wed, 14 Oct 2020 at 22:45, Andrey Konovalov wrote: > > TODO: no meaningful description here yet, please see the cover letter > for this RFC series. > > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4 > --- >

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

2020-10-15 Thread Marco Elver
On Thu, 15 Oct 2020 at 15:39, Mark Rutland wrote: > On Wed, Oct 14, 2020 at 09:12:37PM +0200, Marco Elver wrote: > > On Thu, 8 Oct 2020 at 12:45, Mark Rutland wrote: > > > On Thu, Oct 08, 2020 at 11:40:52AM +0200, Marco Elver wrote: > > > > On Thu, 1 Oct 2020

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-15 Thread Marco Elver
On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote: > This patchset is not complete (see particular TODOs in the last patch), > and I haven't performed any benchmarking yet, but I would like to start the > discussion now and hear people's opinions regarding the questions mentioned > below. > >

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-16 Thread Marco Elver
On Fri, 16 Oct 2020 at 15:17, 'Andrey Konovalov' via kasan-dev wrote: [...] > > > The intention with this kind of a high level switch is to hide the > > > implementation details. Arguably, we could add multiple switches that > > > allow > > > to separately control each KASAN or MTE feature, but

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

2020-10-08 Thread Marco Elver
On Thu, 1 Oct 2020 at 19:58, Mark Rutland wrote: [...] > > > If you need virt_to_page() to work, the address has to be part of the > > > linear/direct map. [...] > > What's the underlying requirement here? Is this a performance concern, > codegen/codesize, or something else? It used to be

Re: [PATCH] slub: Actually fix freelist pointer vs redzoning

2020-10-09 Thread Marco Elver
_): 00 00 00 00 00 00 00 00 > > Adjust the offset to stay within s->object_size. > > (Note that there appear to be no such small-sized caches in the kernel > currently.) > > Reported-by: Marco Elver > Link: > https://lore.kernel.org/linux-mm/2020080

Re: [PATCH v4 02/11] x86, kfence: enable KFENCE for x86

2020-10-09 Thread Marco Elver
On Wed, Oct 07, 2020 at 04:41PM +0200, Marco Elver wrote: > On Wed, 7 Oct 2020 at 16:15, Jann Horn wrote: [...] > > > > > + return false; > > > > > + > > > > > + if (protect) > > > > > + set_pte(pte,

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

2020-10-12 Thread Marco Elver
On Sat, 10 Oct 2020 at 16:54, Arpitha Raghunandan <98.a...@gmail.com> wrote: > Implementation of support for parameterized testing in KUnit. > > Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com> > --- > include/kunit/test.h | 29 + > lib/kunit/test.c | 44

Re: [PATCH] Documentation: kunit: Update Kconfig parts for KUNIT's module support

2020-10-12 Thread Marco Elver
On Mon, 12 Oct 2020 at 12:54, 'SeongJae Park' via KUnit Development wrote: > > From: SeongJae Park > > If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable > module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile > errors. This commit updates the document for

Re: [PATCH v4 01/11] mm: add Kernel Electric-Fence infrastructure

2020-10-12 Thread Marco Elver
[ Sorry for delay, just noticed this one doesn't have a reply yet. ] On Sat, 3 Oct 2020 at 00:27, Jann Horn wrote: > On Fri, Oct 2, 2020 at 11:28 PM Marco Elver wrote: > > On Fri, 2 Oct 2020 at 21:32, Jann Horn wrote: > > > > That's another check; we don't want to mak

Re: [PATCH v3] kcov, usb: specify contexts for remote coverage sections

2020-10-12 Thread Marco Elver
mote_start_context(u64 handle, unsigned int context); > +void kcov_remote_stop_context(unsigned int context); > u64 kcov_common_handle(void); > > +static inline void kcov_remote_start(u64 handle) > +{ > + return kcov_remote_start_context(handle, KCOV_CONTEXT_MASK); > +} >

Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e

2020-09-16 Thread Marco Elver
On Wed, 16 Sep 2020 at 20:22, 'Nick Desaulniers' via kasan-dev wrote: > > On Wed, Sep 16, 2020 at 1:46 AM Marco Elver wrote: > > > > On Wed, 16 Sep 2020 at 10:30, wrote: > > > On Tue, Sep 15, 2020 at 08:09:16PM +0200, Marco Elver wrote: > > > > On Tue,

Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang

2020-09-16 Thread Marco Elver
On Wed, Sep 16, 2020 at 12:14PM +, George Popescu wrote: > On Wed, Sep 16, 2020 at 10:32:40AM +0200, Marco Elver wrote: > > On Wed, 16 Sep 2020 at 09:40, George Popescu wrote: > > > On Tue, Sep 15, 2020 at 07:32:28PM +0200, Marco Elver wrote: > > > > On Tue

Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang

2020-09-17 Thread Marco Elver
On Wed, 16 Sep 2020 at 15:40, Marco Elver wrote: > On Wed, Sep 16, 2020 at 12:14PM +, George Popescu wrote: > > On Wed, Sep 16, 2020 at 10:32:40AM +0200, Marco Elver wrote: > > > On Wed, 16 Sep 2020 at 09:40, George Popescu > > > wrote: > > > > O

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

2020-08-26 Thread Marco Elver
On Fri, 21 Aug 2020 at 14:31, Marco Elver wrote: > In the core runtime, we must minimize any calls to external library > functions to avoid any kind of recursion. This can happen even though > instrumentation is disabled for called functions, but tracing is > enabled. >

Re: [PATCH] lib: kunit: add list_sort test conversion to KUnit

2020-08-27 Thread Marco Elver
On Wed, Jul 29, 2020 at 04:23PM -0300, Vitor Massaru Iha wrote: > This adds the conversion of the runtime tests of test_list_sort, > from `lib/test_list_sort.c` to KUnit tests. > > Please apply this commit first (linux-kselftest/kunit-fixes): > 3f37d14b8a3152441f36b6bc74000996679f0998 kunit:

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

2020-08-27 Thread Marco Elver
On Thu, Jul 02, 2020 at 12:14AM -0700, David Gow wrote: > As discussed in [1], KUnit tests have hitherto not had a particularly > consistent naming scheme. This adds documentation outlining how tests > and test suites should be named, including how those names should be > used in Kconfig entries

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

2020-08-27 Thread Marco Elver
On Thu, 27 Aug 2020 at 18:17, David Gow wrote: [...] > > First of all, thanks for the talk yesterday! I only looked at this > > because somebody pasted the LKML link. :-) > > No worries! Clearly this document needed linking -- even I was > starting to suspect the reason no-one was complaining

Re: [PATCH] compiler-clang: add build check for clang 10.0.1

2020-08-27 Thread Marco Elver
re not going to clean up behind us, this > should be a warning and not an error. There are also some other documentation that would go stale. We probably have to change KASAN docs to look something like the below. I wish we could also remove the "but detection of out-of-bounds accesses f

Re: [PATCH] kcsan: Optimize debugfs stats counters

2020-08-12 Thread Marco Elver
On Mon, 10 Aug 2020 at 10:06, Marco Elver wrote: > Remove kcsan_counter_inc/dec() functions, as they perform no other > logic, and are no longer needed. > > This avoids several calls in kcsan_setup_watchpoint() and > kcsan_found_watchpoint(), as well as lets the compiler warn us ab

Re: [PATCH 1/5] timer: kasan: record and print timer stack

2020-08-12 Thread Marco Elver
On Mon, 10 Aug 2020 at 09:23, Walter Wu wrote: > This patch records the last two timer queueing stacks and prints > up to 2 timer stacks in KASAN report. It is useful for programmers > to solve use-after-free or double-free memory timer issues. > > When timer_setup() or timer_setup_on_stack() is

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

2020-08-13 Thread Marco Elver
nse to introduce yet another special case to KCSAN's runtime, only to cater to the case here. Signed-off-by: Marco Elver Cc: Dmitry Vyukov Cc: Paul E. McKenney Cc: Will Deacon --- As discussed, partially reverting behaviour for non-atomic bitops when KCSAN_ASSUME_PLAIN_WRITES_ATOMIC is selected. I'

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 07:52AM -0700, Dave Hansen wrote: > On 9/7/20 6:40 AM, Marco Elver wrote: > > KFENCE is designed to be enabled in production kernels, and has near > > zero performance overhead. Compared to KASAN, KFENCE trades performance > > for precision. > &

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 04:40PM +0200, Vlastimil Babka wrote: > On 9/8/20 2:16 PM, Alexander Potapenko wrote: > >> Toggling a static branch is AFAIK quite disruptive (PeterZ will probably > >> tell > >> you better), and with the default 100ms sample interval, I'd think it's > >> not good > >> to

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

2020-09-09 Thread Marco Elver
t; +The easiest way of achieving this is to name the file containing the test > suite > +``_test.c`` (or, as above, ``_kunit.c``). This file should be > +placed next to the code under test. > + > +If the suite name contains some or all of the name of the test's parent > +directory, it may make sense to modify the source filename to reduce > redundancy. > +For example, a ``foo_firmware`` suite could be in the ``foo/firmware_test.c`` > +file. Reviewed-by: Marco Elver Thank you!

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

2020-09-09 Thread Marco Elver
Hello arm64 maintainers, On Mon, 7 Sep 2020 at 15:41, Marco Elver wrote: > Add architecture specific implementation details for KFENCE and enable > KFENCE for the arm64 architecture. In particular, this implements the > required interface in . Currently, the arm64 version does >

Re: [RFC v8 01/10] mm/damon/debugfs: Allow users to set initial monitoring target regions

2020-08-31 Thread Marco Elver
On Mon, Aug 31, 2020 at 12:47PM +0200, SeongJae Park wrote: [...] > diff --git a/mm/damon.c b/mm/damon.c > index 7e3c8c82a010..9815d22fc4de 100644 > --- a/mm/damon.c > +++ b/mm/damon.c > @@ -2001,6 +2001,147 @@ static ssize_t debugfs_record_write(struct file *file, > return ret; > } > >

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

2020-09-01 Thread Marco Elver
On Tue, 1 Sep 2020 at 07:31, David Gow wrote: > On Tue, Sep 1, 2020 at 7:47 AM Kees Cook wrote: > > On Fri, Aug 28, 2020 at 12:17:05AM +0800, David Gow wrote: > > > On Thu, Aug 27, 2020 at 9:14 PM Marco Elver wrote: [...] > > I guess there are two audiences to cater for

Re: [PATCH] doc: kcsan: add support info of gcc for kcsan

2020-08-03 Thread Marco Elver
On Mon, 3 Aug 2020 at 08:45, Wang Wenhu wrote: > > KCSAN is also supported in GCC version 7.3.0 or later. > For Clang, the supported versions are 7.0.0 and later. > > Signed-off-by: Wang Wenhu > --- Nack. Did you mean K-A-SAN? In which case this is the wrong file (kasan.rst also has the right

Re: [PATCH v2 6/6] kasan: update documentation for generic kasan

2020-08-24 Thread Marco Elver
On Mon, 24 Aug 2020 at 10:14, Walter Wu wrote: > > Generic KASAN support to record the last two timer and workqueue > stacks and print them in KASAN report. So that need to update > documentation. > > Signed-off-by: Walter Wu > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko

Re: [PATCH v2 5/6] kasan: add tests for workqueue stack recording

2020-08-24 Thread Marco Elver
On Mon, 24 Aug 2020 at 10:14, Walter Wu wrote: > > Adds a test to verify workqueue stack recording and print it in > KASAN report. > > The KASAN report was as follows(cleaned up slightly): > > BUG: KASAN: use-after-free in kasan_workqueue_uaf > > Freed by task 54: > kasan_save_stack+0x24/0x50

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

2020-08-24 Thread Marco Elver
kqueue stack. > - change the aux stack title for common name. Much cleaner. In general, Acked-by: Marco Elver but I left some more comments. I'm a bit worried about the tests, because of KASAN-test KUnit rework, but probably not much we can do until these are added to -mm tree. Thanks, -- Marco

Re: [PATCH] ubsan: introducing CONFIG_UBSAN_LOCAL_BOUNDS for Clang

2020-09-21 Thread Marco Elver
ption by default when UBSAN_TRAP is enabled. > > [1] http://lists.llvm.org/pipermail/llvm-dev/2012-May/049972.html > [2] > http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131021/091536.html > > Suggested-by: Marco Elver > Reviewed-by: David Brazdil > Signed-off-by: Geo

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

2020-09-21 Thread Marco Elver
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: enable KFENCE for ARM64 kfence, lockdep: make KFENCE compatible with lockdep kfence, Documentation: add

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

2020-09-21 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. Reviewed-by: Dmitry Vyukov Co-developed-by: Marco Elver Signed-off-by: Marco Elver

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

2020-09-21 Thread Marco Elver
is_kfence_address(). Reviewed-by: Dmitry Vyukov 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

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

2020-09-21 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 --- arch/x86/Kconfig | 2 ++ arch/x86/include/asm/kfence.h

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

2020-09-21 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 v3 10/10] kfence: add test suite

2020-09-21 Thread Marco Elver
-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v3: * Lower line buffer size to avoid warnings of using more than 1024 bytes stack usage [reported by kernel test robot ]. v2: * Update for shortened memory corruption report. --- lib/Kconfig.kfence | 13

  1   2   3   4   5   6   7   8   9   10   >