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

2020-11-07 Thread Marco Elver
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. >

Re: [PATCH] kcsan: Add option to allow watcher interruptions

2020-07-25 Thread Marco Elver
[+Peter] On Sat, 25 Jul 2020 at 16:56, Paul E. McKenney wrote: > > On Thu, Feb 20, 2020 at 10:33:17PM +0100, Marco Elver wrote: > > On Thu, 20 Feb 2020, Paul E. McKenney wrote: > > I am clearly not keeping up... :-/ Not to worry, I think the local_t idea was discarded based o

[PATCH 0/8] kcsan: Compound read-write instrumentation

2020-07-21 Thread Marco Elver
tion, existing explicit instrumentation via instrumented.h was updated to use explicit read-write instrumentation where appropriate, so we can also benefit from the better report generation. Marco Elver (8): kcsan: Support compounded read-write instrumentation objtool, kcsan: Add __tsan_read_wr

[PATCH 5/8] kcsan: Test support for compound instrumentation

2020-07-21 Thread Marco Elver
Changes kcsan-test module to support checking reports that include compound instrumentation. Since we should not fail the test if this support is unavailable, we have to add a config variable that the test can use to decide what to check for. Signed-off-by: Marco Elver --- kernel/kcsan/kcsan

[PATCH 1/8] kcsan: Support compounded read-write instrumentation

2020-07-21 Thread Marco Elver
rnel_rmw_array+0x45/0xa0 access_thread+0x71/0xb0 kthread+0x21e/0x240 ret_from_fork+0x22/0x30 Signed-off-by: Marco Elver --- include/linux/kcsan-checks.h | 45 kernel/kcsan/core.c | 23 ++ kernel/kcsan/report.c

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

2020-07-21 Thread Marco Elver
Use instrument_atomic_read_write() for atomic RMW ops. Signed-off-by: Marco Elver --- include/asm-generic/atomic-instrumented.h | 330 +++--- scripts/atomic/gen-atomic-instrumented.sh | 20 +- 2 files changed, 179 insertions(+), 171 deletions(-) diff --git a/include/asm

[PATCH 3/8] kcsan: Skew delay to be longer for certain access types

2020-07-21 Thread Marco Elver
For compound instrumentation and assert accesses, skew the watchpoint delay to be longer. We still shouldn't exceed the maximum delays, but it is safe to skew the delay for these accesses. Signed-off-by: Marco Elver --- kernel/kcsan/core.c | 10 +++--- 1 file changed, 7 insertions(

[PATCH 7/8] asm-generic/bitops: Use instrument_read_write() where appropriate

2020-07-21 Thread Marco Elver
Use the new instrument_read_write() where appropriate. Signed-off-by: Marco Elver --- include/asm-generic/bitops/instrumented-atomic.h | 6 +++--- include/asm-generic/bitops/instrumented-lock.h | 2 +- include/asm-generic/bitops/instrumented-non-atomic.h | 6 +++--- 3 files changed, 7

[PATCH 4/8] kcsan: Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks

2020-07-21 Thread Marco Elver
Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks for the builtin atomics instrumentation. Signed-off-by: Marco Elver --- Added to this series, as it would otherwise cause patch conflicts. --- kernel/kcsan/core.c | 25 + 1 file changed, 17 insertions(+), 8 deletions

[PATCH 6/8] instrumented.h: Introduce read-write instrumentation hooks

2020-07-21 Thread Marco Elver
ly be treated as atomic, if they aren't actually atomic. Signed-off-by: Marco Elver --- include/linux/instrumented.h | 30 ++ 1 file changed, 30 insertions(+) diff --git a/include/linux/instrumented.h b/include/linux/instrumented.h index 43e6ea591975..42faebbaa

[PATCH 2/8] objtool, kcsan: Add __tsan_read_write to uaccess whitelist

2020-07-21 Thread Marco Elver
Adds the new __tsan_read_write compound instrumentation to objtool's uaccess whitelist. Signed-off-by: Marco Elver --- tools/objtool/check.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 63d8b630c67a..38d82e705c93 100644 --- a/

Re: [PATCH 5/8] kcsan: Test support for compound instrumentation

2020-07-21 Thread Marco Elver
On Tue, Jul 21, 2020 at 12:30PM +0200, Marco Elver wrote: [...] > diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan > index 3d282d51849b..cde5b62b0a01 100644 > --- a/lib/Kconfig.kcsan > +++ b/lib/Kconfig.kcsan > @@ -40,6 +40,11 @@ menuconfig KCSAN > > if KCSAN > &g

Re: [PATCH] MAINTAINERS: add KCOV section

2020-07-21 Thread Marco Elver
On Tue, 21 Jul 2020 at 13:34, Andrey Konovalov wrote: > > To link KCOV to the kasan-dev@ mailing list. > > Signed-off-by: Andrey Konovalov > --- > MAINTAINERS | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index d53db30d1365..eec0b687eb08 100644 > -

Re: [PATCH 4/8] kcsan: Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks

2020-07-21 Thread Marco Elver
On Tue, 21 Jul 2020 at 16:09, Peter Zijlstra wrote: > > On Tue, Jul 21, 2020 at 12:30:12PM +0200, Marco Elver wrote: > > Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks for the builtin atomics > > instrumentation. > > > > Signed-off-by: Marco Elver > > --- &

Re: [PATCH 3/8] kcsan: Skew delay to be longer for certain access types

2020-07-21 Thread Marco Elver
On Tue, Jul 21, 2020 at 04:05PM +0200, Peter Zijlstra wrote: > On Tue, Jul 21, 2020 at 12:30:11PM +0200, Marco Elver wrote: > > For compound instrumentation and assert accesses, skew the watchpoint > > delay to be longer. We still shouldn't exceed the maximum delays, but it >

Re: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read

2020-07-15 Thread Marco Elver
On Wed, Jul 15, 2020 at 08:16AM -0700, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit:e9919e11 Merge branch 'for-linus' of git://git.kernel.org/.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1217a83b10 > kernel co

Re: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read

2020-07-15 Thread Marco Elver
On Wed, 15 Jul 2020 at 18:33, Eric Biggers wrote: > > [+Cc linux-fsdevel] > > On Wed, Jul 15, 2020 at 05:29:12PM +0200, 'Marco Elver' via syzkaller-bugs > wrote: > > On Wed, Jul 15, 2020 at 08:16AM -0700, syzbot wrote: > > > Hello, > &g

Re: [PATCH v5 4/4] printk: use the lockless ringbuffer

2020-07-18 Thread Marco Elver
On Thu, Jul 09, 2020 at 03:29PM +0206, John Ogness wrote: > Replace the existing ringbuffer usage and implementation with > lockless ringbuffer usage. Even though the new ringbuffer does not > require locking, all existing locking is left in place. Therefore, > this change is purely replacing the u

Re: [PATCH v5 4/4] printk: use the lockless ringbuffer

2020-07-19 Thread Marco Elver
On Sun, Jul 19, 2020 at 12:43PM +0900, Sergey Senozhatsky wrote: > Hi Marco, > > On (20/07/18 14:10), Marco Elver wrote: > > > > It seems this causes a regression observed at least with newline-only > > printks. I noticed this during -next testing because various

Re: [PATCH v5 4/4] printk: use the lockless ringbuffer

2020-07-20 Thread Marco Elver
On Mon, 20 Jul 2020 at 10:41, Sergey Senozhatsky wrote: > > On (20/07/20 08:43), Marco Elver wrote: > > On Sun, Jul 19, 2020 at 12:43PM +0900, Sergey Senozhatsky wrote: > > > > As I said, a number of debugging tools use them to format reports to be > > more readabl

Re: [PATCH v5 4/4] printk: use the lockless ringbuffer

2020-07-20 Thread Marco Elver
On Mon, 20 Jul 2020 at 12:20, John Ogness wrote: > > On 2020-07-18, Marco Elver wrote: > > It seems this causes a regression observed at least with newline-only > > printks. > > [...] > > -- >8 -- > > > > --- a/init/main.c > > +++

[PATCH tip/locking/core] kcsan: Improve IRQ state trace reporting

2020-07-20 Thread Marco Elver
report). Before "lockdep: Prepare for NMI IRQ state tracking", KCSAN avoided touching the IRQ state trace via raw_local_irq_save/restore() and lockdep_off/on(). Fixes: 248591f5d257 ("kcsan: Make KCSAN compatible with new IRQ state tracking") Signed-off-by: Marco Elver --- Hi

Re: [PATCH][next] printk: ringbuffer: support dataless records

2020-07-20 Thread Marco Elver
58 ++- > kernel/printk/printk_ringbuffer.h | 15 > 2 files changed, 35 insertions(+), 38 deletions(-) Thanks! Ran a couple tests and sanitizer report blank lines are back where they're expected. Tested-by: Marco Elver

Re: [PATCH tip/locking/core] kcsan: Improve IRQ state trace reporting

2020-07-28 Thread Marco Elver
On Mon, 20 Jul 2020 at 14:03, Marco Elver wrote: > > To improve the general usefulness of the IRQ state trace information > with KCSAN enabled, save and restore the trace information when entering > and exiting the KCSAN runtime as well as when generating a KCSAN report. >

Re: [PATCH tip/locking/core] kcsan: Improve IRQ state trace reporting

2020-07-28 Thread Marco Elver
On Tue, 28 Jul 2020 at 13:30, Ingo Molnar wrote: > > > * Marco Elver wrote: > > > To improve the general usefulness of the IRQ state trace information > > with KCSAN enabled, save and restore the trace information when entering > > and exiting the KCSAN runtime as w

Re: [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y

2020-07-06 Thread Marco Elver
On Mon, 6 Jul 2020 at 20:35, Will Deacon wrote: > On Mon, Jul 06, 2020 at 05:00:23PM +0100, Dave Martin wrote: > > On Thu, Jul 02, 2020 at 08:23:02AM +0100, Will Deacon wrote: > > > On Wed, Jul 01, 2020 at 06:07:25PM +0100, Dave P Martin wrote: > > > > Also, can you illustrate code that can only b

[PATCH v2 3/8] kcsan: Skew delay to be longer for certain access types

2020-07-24 Thread Marco Elver
ed between [delay/2, delay]. Signed-off-by: Marco Elver --- v2: * Commit message rewording. --- kernel/kcsan/core.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c index fb52de2facf3..4633baebf84e 100644 --- a/kernel/kcsan/co

[PATCH v2 4/8] kcsan: Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks

2020-07-24 Thread Marco Elver
Add missing CONFIG_KCSAN_IGNORE_ATOMICS checks for the builtin atomics instrumentation. Signed-off-by: Marco Elver --- v2: * Add {} for readability. Added to this series, as it would otherwise cause patch conflicts. --- kernel/kcsan/core.c | 30 ++ 1 file changed

[PATCH v2 1/8] kcsan: Support compounded read-write instrumentation

2020-07-24 Thread Marco Elver
rnel_rmw_array+0x45/0xa0 access_thread+0x71/0xb0 kthread+0x21e/0x240 ret_from_fork+0x22/0x30 Signed-off-by: Marco Elver --- include/linux/kcsan-checks.h | 45 kernel/kcsan/core.c | 23 ++ kernel/kcsan/report.c

[PATCH v2 0/8] kcsan: Compound read-write instrumentation

2020-07-24 Thread Marco Elver
ity. * Rewrite commit message of 'kcsan: Skew delay to be longer for certain access types'. * Update comment for gen-atomic-instrumented.sh. Marco Elver (8): kcsan: Support compounded read-write instrumentation objtool, kcsan: Add __tsan_read_write to uaccess whitelist kcsan: Ske

[PATCH v2 6/8] instrumented.h: Introduce read-write instrumentation hooks

2020-07-24 Thread Marco Elver
ly be treated as atomic, if they aren't actually atomic. Signed-off-by: Marco Elver --- include/linux/instrumented.h | 30 ++ 1 file changed, 30 insertions(+) diff --git a/include/linux/instrumented.h b/include/linux/instrumented.h index 43e6ea591975..42faebbaa

[PATCH v2 7/8] asm-generic/bitops: Use instrument_read_write() where appropriate

2020-07-24 Thread Marco Elver
Use the new instrument_read_write() where appropriate. Signed-off-by: Marco Elver --- include/asm-generic/bitops/instrumented-atomic.h | 6 +++--- include/asm-generic/bitops/instrumented-lock.h | 2 +- include/asm-generic/bitops/instrumented-non-atomic.h | 6 +++--- 3 files changed, 7

[PATCH v2 2/8] objtool, kcsan: Add __tsan_read_write to uaccess whitelist

2020-07-24 Thread Marco Elver
Adds the new __tsan_read_write compound instrumentation to objtool's uaccess whitelist. Signed-off-by: Marco Elver Acked-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c

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

2020-07-24 Thread Marco Elver
Use instrument_atomic_read_write() for atomic RMW ops. Signed-off-by: Marco Elver --- v2: * Update inline comment. --- include/asm-generic/atomic-instrumented.h | 330 +++--- scripts/atomic/gen-atomic-instrumented.sh | 21 +- 2 files changed, 180 insertions(+), 171 deletions

[PATCH v2 5/8] kcsan: Test support for compound instrumentation

2020-07-24 Thread Marco Elver
Changes kcsan-test module to support checking reports that include compound instrumentation. Since we should not fail the test if this support is unavailable, we have to add a config variable that the test can use to decide what to check for. Signed-off-by: Marco Elver --- v2: * Fix

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

2020-07-22 Thread Marco Elver
On Tue, 21 Jul 2020 at 16:19, Peter Zijlstra wrote: > > On Tue, Jul 21, 2020 at 12:30:16PM +0200, Marco Elver wrote: > > > diff --git a/scripts/atomic/gen-atomic-instrumented.sh > > b/scripts/atomic/gen-atomic-instrumented.sh > > index 6afadf73da17..5cdcce703660 1007

Re: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read

2020-07-16 Thread Marco Elver
On Thu, 16 Jul 2020 at 09:52, Nicholas Piggin wrote: > > Excerpts from Eric Biggers's message of July 16, 2020 4:54 pm: > > On Thu, Jul 16, 2020 at 04:24:01PM +1000, Nicholas Piggin wrote: > >> Excerpts from Eric Biggers's message of July 16, 2020 1:03 pm: > >> > On Thu, Jul 16, 2020 at 09:42:03AM

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

2020-09-09 Thread Marco Elver
fic/suffix/ > +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 > n

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

2020-09-10 Thread Marco Elver
On Thu, 10 Sep 2020 at 17:48, Dmitry Vyukov wrote: > > On Thu, Sep 10, 2020 at 5:06 PM Marco Elver wrote: > > > On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote: > > > > +config KFENCE_NUM_OBJECTS > > > > + int "Number of guarded ob

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

2020-09-10 Thread Marco Elver
On Thu, 10 Sep 2020 at 16:58, Dmitry Vyukov wrote: > > On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote: > > +config KFENCE_NUM_OBJECTS > > + int "Number of guarded objects available" > > + default 255 > > + range 1 65535 > > +

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

2020-09-10 Thread Marco Elver
On Thu, 10 Sep 2020 at 19:11, Dmitry Vyukov wrote: > > On Thu, Sep 10, 2020 at 6:19 PM Alexander Potapenko wrote: > > > > On Thu, Sep 10, 2020 at 5:43 PM Dmitry Vyukov wrote: > > > > > > > > + /* Calculate address for this allocation. */ > > > > + if (right) > > > > + m

Re: [PATCH] ubsan: introducing CONFIG_UBSAN_LOCAL_BOUNDS for Clang

2020-09-21 Thread Marco Elver
to enable the > 'local-bounds' option 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-

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

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

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

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

2020-09-21 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 v3 04/10] mm, kfence: insert KFENCE hooks for SLAB

2020-09-21 Thread Marco Elver
ways_inline. Reviewed-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 +++

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

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

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

2020-09-21 Thread Marco Elver
ways_inline. Reviewed-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

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

2020-09-21 Thread Marco Elver
have verified by running synthetic benchmarks (sysbench I/O workloads) that a kernel compiled with KFENCE is performance-neutral compared to the non-KFENCE baseline. For more details, see Documentation/dev-tools/kfence.rst (added later in the series). Reviewed-by: Dmitry Vyukov Co-developed-by: Marco El

Re: [PATCH v3 10/10] kfence: add test suite

2020-09-21 Thread Marco Elver
On Mon, 21 Sep 2020 at 19:13, Paul E. McKenney wrote: > > On Mon, Sep 21, 2020 at 03:26:11PM +0200, Marco Elver wrote: > > Add KFENCE test suite, testing various error detection scenarios. Makes > > use of KUnit for test organization. Since KFENCE's interface to obtain &

Re: [PATCH 2/2] kbuild: move CFLAGS_{KASAN,UBSAN,KCSAN} exports to relevant Makefiles

2020-09-10 Thread Marco Elver
t; -fno-optimize-sibling-calls) \ > $(call cc-option,$(call > cc-param,tsan-instrument-read-before-write=1)) \ > $(call cc-param,tsan-distinguish-volatile=1) This doesn't apply to -next, which has some KCSAN changes for the next merge window. Although it seems git-merge f

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 09:14, Dmitry Vyukov 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

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 09:36, Dmitry Vyukov wrote: > On Tue, Sep 8, 2020 at 5:56 PM Marco Elver wrote: > > On Tue, Sep 08, 2020 at 05:36PM +0200, Vlastimil Babka wrote: [...] > > > Hmm did you observe that with this limit, a long-running system would > > > eventual

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 09:17, Dmitry Vyukov wrote: > > On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote: > > > > From: Alexander Potapenko > > > > Inserts KFENCE hooks into the SLAB allocator. > > > > We note the addition of the 'orig_size' ar

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 15:10, Dmitry Vyukov wrote: > On Fri, Sep 11, 2020 at 2:03 PM Marco Elver wrote: > > On Fri, 11 Sep 2020 at 09:36, Dmitry Vyukov wrote: [...] > > > By "reasonable" I mean if the pool will last long enough to still > > > sample somet

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 15:33, Marco Elver wrote: > On Fri, 11 Sep 2020 at 15:10, Dmitry Vyukov wrote: > > On Fri, Sep 11, 2020 at 2:03 PM Marco Elver wrote: > > > On Fri, 11 Sep 2020 at 09:36, Dmitry Vyukov wrote: > [...] > > > > By "reasonable"

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

2020-09-11 Thread Marco Elver
On Fri, 11 Sep 2020 at 09:05, Dmitry Vyukov wrote: > > On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote: > > > > From: Alexander Potapenko > > > > We make KFENCE compatible with KASAN for testing KFENCE itself. In > > particular, KASAN helps to catch

Re: linux-next: build warning after merge of the akpm-current tree

2020-09-15 Thread Marco Elver
On Tue, 15 Sep 2020 at 06:03, 'David Gow' via kasan-dev wrote: > > [+kasan-dev, +kunit-dev] > > On Mon, Sep 14, 2020 at 3:01 PM Stephen Rothwell > wrote: > > > > Hi all, > > > > After merging the akpm-current tree, today's linux-next build (x86_64 > > allmodconfig) produced this warning: > > > >

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

2020-09-15 Thread Marco Elver
On Tue, 15 Sep 2020 at 12:25, George Popescu wrote: > On Mon, Sep 14, 2020 at 03:13:14PM -0700, Kees Cook wrote: > > On Mon, Sep 14, 2020 at 05:27:42PM +, George-Aurelian Popescu wrote: > > > From: George Popescu > > > > > > When the kernel is compiled with Clang, UBSAN_BOUNDS inserts a brk a

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

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

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

2020-09-15 Thread Marco Elver
d-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- v2: * Update for shortened memory corruption report. --- lib/Kconfig.kfence | 13 + mm/kfence/Makefile | 3 + mm/kfence/kfence_test.c | 777 3 files changed, 793 insertions(+) create

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

2020-09-15 Thread Marco Elver
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 kfence, kmemleak: make KFENCE compatible with KMEMLEAK Marco Elver (4): arm64,

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

2020-09-15 Thread Marco Elver
On Tue, Sep 15, 2020 at 03:57PM +0200, SeongJae Park wrote: [...] > > So interesting feature! I left some tirvial comments below. Thank you! > [...] > > diff --git a/lib/Kconfig.kfence b/lib/Kconfig.kfence > > new file mode 100644 > > index ..7ac91162edb0 > > --- /dev/null > > +++ b

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

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

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

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

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 t

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

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 mod

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 fun

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

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

Re: [PATCH] ubsan: introducing CONFIG_UBSAN_BOUNDS_LOCAL for Clang

2020-09-18 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. > --- >

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

2020-09-16 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 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 dedi

Re: [PATCH 00/22] add support for Clang LTO

2020-06-30 Thread Marco Elver
I was asked for input on this, and after a few days digging through some history, thought I'd comment. Hope you don't mind. On Thu, Jun 25, 2020 at 10:57AM +0200, Peter Zijlstra wrote: > On Thu, Jun 25, 2020 at 10:24:33AM +0200, Peter Zijlstra wrote: > > On Thu, Jun 25, 2020 at 10:03:13AM +0200, P

Re: [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y

2020-06-30 Thread Marco Elver
On Tue, 30 Jun 2020 at 19:39, Will Deacon wrote: > > When building with LTO, there is an increased risk of the compiler > converting an address dependency headed by a READ_ONCE() invocation > into a control dependency and consequently allowing for harmful > reordering by the CPU. > > Ensure that s

Re: linux-next: manual merge of the rcu tree with the kbuild tree

2020-06-30 Thread Marco Elver
On Wed, 1 Jul 2020 at 03:34, Stephen Rothwell wrote: > > Hi all, > > Today's linux-next merge of the rcu tree got a conflict in: > > kernel/kcsan/Makefile > > between commit: > > f7c28e224da6 ("kbuild: remove cc-option test of -fno-stack-protector") Is it possible that this patch drops the KC

Re: [PATCH 1/2] kbuild: remove cc-option test of -fno-stack-protector

2020-06-30 Thread Marco Elver
On Sat, Jun 27, 2020 at 03:59AM +0900, Masahiro Yamada wrote: > Some Makefiles already pass -fno-stack-protector unconditionally. > For example, arch/arm64/kernel/vdso/Makefile, arch/x86/xen/Makefile. > No problem report so far about hard-coding this option. So, we can > assume all supported compil

Re: [PATCH 00/22] add support for Clang LTO

2020-07-01 Thread Marco Elver
On Tue, 30 Jun 2020 at 22:30, Paul E. McKenney wrote: > On Tue, Jun 30, 2020 at 10:12:43PM +0200, Peter Zijlstra wrote: > > On Tue, Jun 30, 2020 at 09:19:31PM +0200, Marco Elver wrote: > > > First of all, I agree with the concerns, but not because of LTO. > > > > &g

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

2020-09-15 Thread Marco Elver
ctions 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/s

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

2020-09-15 Thread Marco Elver
On Tue, 15 Sep 2020 at 19:40, Nick Desaulniers wrote: > > On Tue, Sep 15, 2020 at 10:21 AM Borislav Petkov wrote: > > > > On Tue, Sep 15, 2020 at 12:02:48PM -0500, Josh Poimboeuf wrote: > > > If somebody can share the .o file, I can take a look. > > > > If only I could reproduce... > > > > So I b

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

2020-09-15 Thread Marco Elver
On Tue, 15 Sep 2020 at 14:01, George Popescu wrote: > > On Tue, Sep 15, 2020 at 01:18:11PM +0200, Marco Elver wrote: > > On Tue, 15 Sep 2020 at 12:25, George Popescu wrote: > > > On Mon, Sep 14, 2020 at 03:13:14PM -0700, Kees Cook wrote: > > > > On Mon, Sep 14,

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

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

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

2020-09-15 Thread Marco Elver
On Tue, 15 Sep 2020 at 23:28, Josh Poimboeuf wrote: > On Tue, Sep 15, 2020 at 02:13:01PM -0700, Nick Desaulniers wrote: > > Triple checking what I wrote above; it looks like the randconfig had > > BOTH CONFIG_KASAN=y and CONFIG_UBSAN=y enabled. Aren't the sanitizers > > supposed to be mutually ex

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

2020-09-15 Thread Marco Elver
ctions 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 d4

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

2020-09-15 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 to

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

2020-09-15 Thread Marco Elver
-neutral 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 --- v2: * Add missing __printf attribute to seq_con_printf, and fix new

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

2020-09-15 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 v2 06/10] kfence, kasan: make KFENCE compatible with KASAN

2020-09-15 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 v2 09/10] kfence, Documentation: add KFENCE documentation

2020-09-15 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 --- v2: * Many clarifications based on comments from Andrey Konovalov. * Document CONFIG_KFENCE_SAMPLE_INTERVAL=0 usage. * Make

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

2020-09-16 Thread Marco Elver
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, 15 Sep 2020 at 14:01, George Popescu wrote: > > > > > > On Tue, Sep 15, 2020 at 01:18:11PM +0200, Marco Elver wrote: > > >

<    4   5   6   7   8   9   10   11   >