[PATCH -tip v3 01/11] ubsan, kcsan: don't combine sanitizer with kcov on clang

2020-05-21 Thread Marco Elver
lore.kernel.org/lkml/20200505142341.1096942-1-a...@arndb.de Acked-by: Marco Elver Signed-off-by: Arnd Bergmann Signed-off-by: Marco Elver --- This patch is already in -rcu tree, but since since the series is based on -tip, to avoid conflict it is required for the subsequent patches. --- lib/Kconfig.kcsan |

[PATCH -tip v3 05/11] kcsan: Remove 'noinline' from __no_kcsan_or_inline

2020-05-21 Thread Marco Elver
@mail.gmail.com Acked-by: Will Deacon Signed-off-by: Marco Elver --- include/linux/compiler.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index e24cc3a2bc3e..17c98b215572 100644 --- a/include/linux/compiler.h

[PATCH -tip v3 00/11] Fix KCSAN for new ONCE (require Clang 11)

2020-05-21 Thread Marco Elver
ssions. Arnd Bergmann (1): ubsan, kcsan: don't combine sanitizer with kcov on clang Marco Elver (10): kcsan: Avoid inserting __tsan_func_entry/exit if possible kcsan: Support distinguishing volatile accesses kcsan: Pass option tsan-instrument-read-before-write to Clang kcsan: Rem

[PATCH -tip v3 03/11] kcsan: Support distinguishing volatile accesses

2020-05-21 Thread Marco Elver
: Marco Elver --- v2: * Reword Makefile comment. --- kernel/kcsan/core.c| 43 ++ scripts/Makefile.kcsan | 5 - 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c index a73a66cf79df..15f67949d11e

[PATCH -tip v3 11/11] compiler_types.h, kasan: Use __SANITIZE_ADDRESS__ instead of CONFIG_KASAN to decide inlining

2020-05-21 Thread Marco Elver
Like is done for KCSAN, for KASAN we should also use __always_inline in compilation units that have instrumentation disabled (KASAN_SANITIZE_foo.o := n). Adds common documentation for KASAN and KCSAN explaining the attribute. Acked-by: Will Deacon Signed-off-by: Marco Elver --- include/linux

[PATCH -tip v3 08/11] READ_ONCE, WRITE_ONCE: Remove data_race() and unnecessary checks

2020-05-21 Thread Marco Elver
volatile accesses. Finally, simplify __READ_ONCE_SCALAR and remove __WRITE_ONCE_SCALAR. Acked-by: Will Deacon Signed-off-by: Marco Elver --- v2: * Remove unnecessary kcsan_check_atomic*() in *_ONCE. * Simplify __READ_ONCE_SCALAR and remove __WRITE_ONCE_SCALAR. This effectively restores Will Deacon&#

[PATCH -tip v3 07/11] kcsan: Update Documentation to change supported compilers

2020-05-21 Thread Marco Elver
Document change in required compiler version for KCSAN, and remove the now redundant note about __no_kcsan and inlining problems with older compilers. Acked-by: Will Deacon Signed-off-by: Marco Elver --- v3: * Add missing commit message. --- Documentation/dev-tools/kcsan.rst | 9 + 1

[PATCH -tip v3 09/11] data_race: Avoid nested statement expression

2020-05-21 Thread Marco Elver
...@zn.tnic Acked-by: Will Deacon Signed-off-by: Marco Elver --- v3: * Fix for 'const' non-scalar expressions. v2: * Add patch to series in response to above linked discussion. --- include/linux/compiler.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc

[PATCH -tip v3 10/11] compiler.h: Move function attributes to compiler_types.h

2020-05-21 Thread Marco Elver
Cleanup and move the KASAN and KCSAN related function attributes to compiler_types.h, where the rest of the same kind live. No functional change intended. Acked-by: Will Deacon Signed-off-by: Marco Elver --- include/linux/compiler.h | 29 - include/linux

[PATCH -tip v3 04/11] kcsan: Pass option tsan-instrument-read-before-write to Clang

2020-05-21 Thread Marco Elver
Acked-by: Will Deacon Signed-off-by: Marco Elver --- scripts/Makefile.kcsan | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.kcsan b/scripts/Makefile.kcsan index 75d2942b9437..bd4da1af5953 100644 --- a/scripts/Makefile.kcsan +++ b/scripts/Makefile.kcsan @@ -13,6 +13,7 @@ endif

[PATCH -tip v3 02/11] kcsan: Avoid inserting __tsan_func_entry/exit if possible

2020-05-21 Thread Marco Elver
entry,exit}() insertion effectively disabled tail-call optimization, there should be no observable change. [This was caught and confirmed with kcsan-test & UNWINDER_ORC.] Acked-by: Will Deacon Signed-off-by: Marco Elver --- scripts/Makefile.kcsan | 11 ++- 1 file changed, 10 inserti

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

2020-08-10 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

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

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

2020-08-02 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 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

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

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
rnel.org/r/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 applie

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 pro

[PATCH] kcsan: Optimize debugfs stats counters

2020-08-10 Thread Marco Elver
t all 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(-)

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

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: https://syzkaller.appspot.com/

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: WARNING in sk_stream_kill_queues (5)

2021-01-11 Thread Marco Elver
On Mon, 14 Dec 2020 at 11:47, Eric Dumazet wrote: > On Mon, Dec 14, 2020 at 11:09 AM Marco Elver wrote: > > On Thu, 10 Dec 2020 at 20:01, Marco Elver wrote: > > > On Thu, 10 Dec 2020 at 18:14, Eric Dumazet wrote: > > > > On Thu, Dec 10, 2020 at 5:51 PM Marco El

[PATCH mm 1/2] kfence: add option to use KFENCE without static keys

2021-01-11 Thread Marco Elver
instead check kfence_allocation_gate if a KFENCE allocation should be set up. Suggested-by: Jörn Engel Signed-off-by: Marco Elver --- include/linux/kfence.h | 11 ++- lib/Kconfig.kfence | 12 +++- mm/kfence/core.c | 32 ++-- 3 files changed

[PATCH mm 2/2] kfence: show access type in report

2021-01-11 Thread Marco Elver
Show the access type in KFENCE reports by plumbing through read/write information from the page fault handler. Update the documentation and test accordingly. Suggested-by: Jörn Engel Signed-off-by: Marco Elver --- Documentation/dev-tools/kfence.rst | 12 arch/arm64/mm/fault.c

Re: [PATCH 01/11] kasan: prefix exported functions with kasan_

2021-01-12 Thread Marco Elver
kasan_unpoison_range(). > > - Rename check_memory_region() to kasan_check_range(), as it seems to be > a more fitting name. > > Suggested-by: Marco Elver > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/I719cc93483d4ba288a634dba80ee6b7f2809c

Re: [PATCH 02/11] kasan: clarify HW_TAGS impact on TBI

2021-01-12 Thread Marco Elver
Konovalov > Link: > https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae Reviewed-by: Marco Elver > --- > Documentation/dev-tools/kasan.rst | 16 +++- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/Documentation/dev

Re: [PATCH] kbuild: avoid static_assert for genksyms

2020-12-10 Thread Marco Elver
On Fri, Dec 04, 2020 at 12:09AM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > genksyms does not know or care about the _Static_assert() built-in, > and sometimes falls back to ignoring the later symbols, which causes > undefined behavior such as > > WARNING: modpost: EXPORT symbol "ethto

Re: [PATCH] genksyms: Ignore module scoped _Static_assert()

2020-12-10 Thread Marco Elver
On Thu, 10 Dec 2020 at 14:29, Miguel Ojeda wrote: > On Thu, Dec 10, 2020 at 11:35 AM Marco Elver wrote: > > > > It looks like there's no clear MAINTAINER for this. :-/ > > It'd still be good to fix this for 5.11. > > Richard seems to be the author, not s

Re: WARNING in sk_stream_kill_queues (5)

2020-12-10 Thread Marco Elver
On Wed, Dec 09, 2020 at 01:47PM +0100, Marco Elver wrote: > On Tue, Dec 08, 2020 at 08:06PM +0100, Marco Elver wrote: > > On Thu, 3 Dec 2020 at 19:01, Eric Dumazet wrote: > > > On 12/3/20 6:41 PM, Marco Elver wrote: > > > > > > > One more experiment -- simpl

Re: WARNING in sk_stream_kill_queues (5)

2020-12-10 Thread Marco Elver
On Thu, 10 Dec 2020 at 18:14, Eric Dumazet wrote: > On Thu, Dec 10, 2020 at 5:51 PM Marco Elver wrote: [...] > > So I started putting gdb to work, and whenever I see an allocation > > exactly like the above that goes through tso_fragment() a warning > > immediately follow

Re: [patch 0/3] tick: Annotate and document the intentionaly racy tick_do_timer_cpu

2020-12-07 Thread Marco Elver
On Sun, 6 Dec 2020 at 22:21, Thomas Gleixner wrote: > There have been several reports about KCSAN complaints vs. the racy access > to tick_do_timer_cpu. The syzbot moderation queue has three different > patterns all related to this. There are a few more... > > As I know that this is intentional an

Re: BUG: KCSAN: data-race in tick_nohz_next_event / tick_nohz_stop_tick

2020-12-07 Thread Marco Elver
On Sun, 6 Dec 2020 at 00:47, Thomas Gleixner wrote: > On Sat, Dec 05 2020 at 19:18, Thomas Gleixner wrote: > > On Fri, Dec 04 2020 at 20:53, Marco Elver wrote: > > It might be useful to find the actual variable, data member or whatever > > which is involved in the various re

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

2020-12-07 Thread Marco Elver
On Mon, 7 Dec 2020 at 13:38, 'Dmitry Vyukov' via kasan-dev wrote: > On Mon, Dec 7, 2020 at 1:08 PM Dmitry Vyukov wrote: > > > > Hi all, > > > > > > > > After merging the akpm tree, today's linux-next build (powerpc > > > > allyesconfig) produced warnings like this: > > > > > > > > kernel/kcov.c:2

Re: [PATCH][next] arm64: fix the mm build error in mm/kfence/core.c

2020-12-07 Thread Marco Elver
On Sun, 6 Dec 2020 at 23:08, Marco Elver wrote: > On Sun, 6 Dec 2020 at 22:23, Stephen Rothwell wrote: [...] > > > ../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of > > > function ‘set_memory_valid’ [-Werror=implicit-function-declaration] > >

Re: WARNING in sk_stream_kill_queues (5)

2020-12-07 Thread Marco Elver
On Thu, Dec 03, 2020 at 07:01PM +0100, Eric Dumazet wrote: > On 12/3/20 6:41 PM, Marco Elver wrote: > > > One more experiment -- simply adding > > > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -207,7 +207,21 @@ struct sk_buff *__alloc_skb(un

Re: WARNING in sk_stream_kill_queues (5)

2020-12-07 Thread Marco Elver
On Thu, Dec 03, 2020 at 07:01PM +0100, Eric Dumazet wrote: > On 12/3/20 6:41 PM, Marco Elver wrote: > > > One more experiment -- simply adding > > > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -207,7 +207,21 @@ struct sk_buff *__alloc_skb(un

Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races

2020-12-07 Thread Marco Elver
On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner wrote: > On Mon, Dec 07 2020 at 13:09, Peter Zijlstra wrote: > > On Sun, Dec 06, 2020 at 10:12:56PM +0100, Thomas Gleixner wrote: > >> +if (data_race(tick_do_timer_cpu) == TICK_DO_TIMER_BOOT) { > > > > I prefer the form: > > > > if (da

Re: WARNING in sk_stream_kill_queues (5)

2020-12-08 Thread Marco Elver
On Thu, 3 Dec 2020 at 19:01, Eric Dumazet wrote: > On 12/3/20 6:41 PM, Marco Elver wrote: > > > One more experiment -- simply adding > > > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -207,7 +207,21 @@ struct sk_buff *__alloc_skb(un

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

2021-01-12 Thread Marco Elver
On Tue, Jan 05, 2021 at 07:27PM +0100, Andrey Konovalov wrote: > Clarify and update comments and info messages in KASAN tests. > > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/I6c816c51fa1e0eb7aa3dead6bda1f339d2af46c8 Reviewed-

Re: [PATCH 04/11] kasan: add match-all tag tests

2021-01-12 Thread Marco Elver
On Tue, Jan 05, 2021 at 07:27PM +0100, Andrey Konovalov wrote: > Add 3 new tests for tag-based KASAN modes: > > 1. Check that match-all pointer tag is not assigned randomly. > 2. Check that 0xff works as a match-all pointer tag. > 3. Check that there are no match-all memory tags. > > Note, that t

Re: [PATCH 06/11] kasan: rename CONFIG_TEST_KASAN_MODULE

2021-01-12 Thread Marco Elver
w.googlesource.com/id/Id347dfa5fe8788b7a1a189863e039f409da0ae5f Reviewed-by: Marco Elver For this patch, as-is. But we could potentially do better in future -- see below. > --- > Documentation/dev-tools/kasan.rst | 6 +++--- > lib/Kconfig.kasan | 2 +- > lib/Makefile

Re: [PATCH 07/11] kasan: add compiler barriers to KUNIT_EXPECT_KASAN_FAIL

2021-01-12 Thread Marco Elver
ts will fail. > > Add compiler barriers around the expression in KUNIT_EXPECT_KASAN_FAIL. > > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/I046079f48641a1d36fe627fc8827a9249102fd50 Reviewed-by: Marco Elver > --- > lib/test_kasan.c |

Re: [PATCH 08/11] kasan: adopt kmalloc_uaf2 test to HW_TAGS mode

2021-01-12 Thread Marco Elver
On Tue, Jan 05, 2021 at 07:27PM +0100, Andrey Konovalov wrote: > In the kmalloc_uaf2() test, the pointers to the two allocated memory > blocks might be the same, and the test will fail. With the software > tag-based mode, the probability of the that happening is 1/254, so it's > hard to observe the

Re: [PATCH 09/11] kasan: fix memory corruption in kasan_bitops_tags test

2021-01-12 Thread Marco Elver
> Change the test so it always accesses the redzone that lies within the > allocated object's boundaries. > > Signed-off-by: Andrey Konovalov > Link: > https://linux-review.googlesource.com/id/I67f51d1ee48f0a8d0fe2658c2a39e4879fe0832a Reviewed-by: Marco Elver > --- >

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

2021-01-12 Thread Marco Elver
On Tue, Jan 05, 2021 at 07:27PM +0100, 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 com

Re: [PATCH 11/11] kasan: add proper page allocator tests

2021-01-12 Thread Marco Elver
: > https://linux-review.googlesource.com/id/Ia173d5a1b215fe6b2548d814ef0f4433cf983570 Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 54 +++- > 1 file changed, 49 insertions(+), 5 deletions(-) > > diff --git a/lib/test_kasan.c b/l

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

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

[PATCH 1/2] kcsan: Make test follow KUnit style recommendations

2021-01-13 Thread Marco Elver
3. Rename CONFIG_KCSAN_TEST to CONFIG_KCSAN_KUNIT_TEST and default to KUNIT_ALL_TESTS. Cc: David Gow Signed-off-by: Marco Elver --- kernel/kcsan/Makefile | 4 ++-- kernel/kcsan/{kcsan-test.c => kcsan_test.c} | 2 +- lib/Kconfig.kcsan | 5

[PATCH 2/2] kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests

2021-01-13 Thread Marco Elver
of threads used, because on systems with too few CPUs, KUnit allows us to now stop at the maximum useful threads and not unnecessarily execute redundant test cases with (the same) limited threads as had been the case before. Cc: David Gow Signed-off-by: Marco Elver --- kernel/kcsan/kcs

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 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 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 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 09/14] kasan: adapt kmalloc_uaf2 test to HW_TAGS mode

2021-01-13 Thread Marco Elver
434a300bf36388d55 > 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_k

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: > https://linux-review.googlesource.com/id/I2a8bf797a

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

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

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 i

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 > > > + * th

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

Re: [PATCH] ubsan: disable unsigned-integer-overflow sanitizer with clang

2020-12-30 Thread Marco Elver
On Wed, 30 Dec 2020 at 16:47, Arnd Bergmann wrote: > > From: Arnd Bergmann > > Building ubsan kernels even for compile-testing introduced these > warnings in my randconfig environment: > > crypto/blake2b_generic.c:98:13: error: stack frame size of 9636 bytes in > function 'blake2b_compress' [-We

[PATCH v3 00/11] Add support for synchronous signals on perf events

2021-03-24 Thread Marco Elver
T4Y+YPrXGw+AtESxAgPyZ84TYkNZdP0xpocX2jwVAbZD=-x...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Marco Elver (10): perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children perf: Support only inheriting events if cloned with CLONE_THREAD perf: Add support for

[PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-24 Thread Marco Elver
d not find a half baked event. To address this, teach perf_remove_from_context() to special case !ctx->is_active and about DETACH_CHILD. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Marco Elver --- v3: * New dependency for series: https://lkml.kernel.org/r/YFn/i

[PATCH v3 02/11] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-03-24 Thread Marco Elver
: Marco Elver --- kernel/events/core.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 57de8d436efd..37d106837962 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3199,16 +3199,36 @@ static

[PATCH v3 03/11] perf: Support only inheriting events if cloned with CLONE_THREAD

2021-03-24 Thread Marco Elver
hared environment. Link: https://lore.kernel.org/lkml/ybvj6ejr%2fdy2t...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Signed-off-by: Marco Elver --- v2: * Add patch to series. --- include/linux/perf_event.h | 5 +++-- include/uapi/linux/perf_event.h | 3 ++- kernel/events/c

[PATCH v3 05/11] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-03-24 Thread Marco Elver
Introduces the TRAP_PERF si_code, and associated siginfo_t field si_perf. These will be used by the perf event subsystem to send signals (if requested) to the task where an event occurred. Acked-by: Geert Uytterhoeven # m68k Acked-by: Arnd Bergmann # asm-generic Signed-off-by: Marco Elver

[PATCH v3 04/11] perf: Add support for event removal on exec

2021-03-24 Thread Marco Elver
Signed-off-by: Marco Elver --- v3: * Rework based on Peter's "perf: Rework perf_event_exit_event()" added to the beginning of the series. Intermediate attempts between v2 and this v3 can be found here: https://lkml.kernel.org/r/yfm6aaksrlf2n...@elver.google.com v2:

[PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
to user space. Signed-off-by: Marco Elver --- v2: * Add comment about si_perf==0. --- kernel/events/core.c | 16 1 file changed, 16 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 1e4c949bf75f..0316d39e8c8f 100644 --- a/kernel/events/core.c +++ b

[PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-24 Thread Marco Elver
synchronous signals on perf events in the task where an event (such as breakpoints) triggered. Link: https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Acked-by: Dmitry Vyukov Signed-off-by: Marco Elver --- v2: * Use atomic_set(&event_c

[PATCH v3 08/11] selftests/perf_events: Add kselftest for process-wide sigtrap handling

2021-03-24 Thread Marco Elver
ftest framework provides. Signed-off-by: Marco Elver --- v3: * Fix for latest libc signal.h. v2: * Patch added to series. --- .../testing/selftests/perf_events/.gitignore | 2 + tools/testing/selftests/perf_events/Makefile | 6 + tools/testing/selftests/perf_events/config| 1 + tools/te

[PATCH v3 10/11] tools headers uapi: Sync tools/include/uapi/linux/perf_event.h

2021-03-24 Thread Marco Elver
Sync tool's uapi to pick up the changes adding inherit_thread, remove_on_exec, and sigtrap fields to perf_event_attr. Signed-off-by: Marco Elver --- v3: * Added to series. --- tools/include/uapi/linux/perf_event.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/

[PATCH v3 09/11] selftests/perf_events: Add kselftest for remove_on_exec

2021-03-24 Thread Marco Elver
Add kselftest to test that remove_on_exec removes inherited events from child tasks. Signed-off-by: Marco Elver --- v3: * Fix for latest libc signal.h. v2: * Add patch to series. --- .../testing/selftests/perf_events/.gitignore | 1 + tools/testing/selftests/perf_events/Makefile | 2

[PATCH v3 11/11] perf test: Add basic stress test for sigtrap handling

2021-03-24 Thread Marco Elver
-off-by: Marco Elver --- v3: * Added to series (per suggestion from Ian Rogers). --- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 5 ++ tools/perf/tests/sigtrap.c | 148 tools/perf/tests/tests.h| 1 + 4 files changed

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
On Wed, 24 Mar 2021 at 14:21, Peter Zijlstra wrote: > > On Wed, Mar 24, 2021 at 02:01:56PM +0100, Peter Zijlstra wrote: > > On Wed, Mar 24, 2021 at 01:53:48PM +0100, Peter Zijlstra wrote: > > > On Wed, Mar 24, 2021 at 12:24:59PM +0100, Marco Elver wrote: > > > > E

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > One last try, I'll leave it alone now, I promise :-) This looks like it does what you suggested, thanks! :-) I'll still need to think about it, because of the potential problem with modify-signal-races and what the user's synchronization st

Re: [PATCH] kernel: kcov: fix a typo in comment

2021-03-24 Thread Marco Elver
On Thu, 25 Mar 2021 at 00:04, Andrew Morton wrote: > On Tue, 23 Mar 2021 23:32:57 +0100 Marco Elver wrote: > > On Tue, 23 Mar 2021 at 07:45, 'Dmitry Vyukov' via kasan-dev > > wrote: > > > On Tue, Mar 23, 2021 at 7:24 AM tl455047 wrote: >

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-25 Thread Marco Elver
On Wed, 24 Mar 2021 at 15:15, Dmitry Vyukov wrote: > On Wed, Mar 24, 2021 at 3:12 PM Dmitry Vyukov wrote: > > > On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > > > > > > > One last try, I'll leave it alone now, I promise :-) > > > > > > This looks like it does what you suggested, thanks!

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-25 Thread Marco Elver
On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: [...] > diff --git a/kernel/events/core.c b/kernel/events/core.c > index b6434697c516..1e4c949bf75f 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -6391,6 +6391,17 @@ void perf_event_wakeup(struct pe

Re: [PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-25 Thread Marco Elver
On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: > From: Peter Zijlstra > > Make perf_event_exit_event() more robust, such that we can use it from > other contexts. Specifically the up and coming remove_on_exec. > > For this to work we need to address a few issues. R

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-25 Thread Marco Elver
On Thu, 25 Mar 2021 at 15:18, Ingo Molnar wrote: > > * Dmitry Vyukov wrote: > > > On Wed, Mar 24, 2021 at 3:05 PM Marco Elver wrote: > > > > > > On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > > > > > > > One last try, I'll

Re: [PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-25 Thread Marco Elver
On Thu, Mar 25, 2021 at 11:17AM +0100, Marco Elver wrote: > On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: > > From: Peter Zijlstra > > > > Make perf_event_exit_event() more robust, such that we can use it from > > other contexts. Specifically the u

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