[PATCH] tracing: Add new_exec tracepoint

2024-04-08 Thread Marco Elver
lename=/usr/bin/tty pid=385 old_pid=385 <...>-389 [006] . 192.020147: new_exec: filename=/usr/bin/dmesg pid=389 comm=bash bash-389 [006] . 192.021377: sched_process_exec: filename=/usr/bin/dmesg pid=389 old_pid=389 Signed-off-by: Marco Elver --- fs/exe

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-09 Thread Marco Elver
On Tue, 9 Apr 2024 at 16:31, Steven Rostedt wrote: > > On Mon, 8 Apr 2024 11:01:54 +0200 > Marco Elver wrote: > > > Add "new_exec" tracepoint, which is run right after the point of no > > return but before the current task assumes its new exec ident

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-09 Thread Marco Elver
On Tue, Apr 09, 2024 at 08:46AM -0700, Kees Cook wrote: [...] > > + trace_new_exec(current, bprm); > > + > > All other steps in this function have explicit comments about > what/why/etc. Please add some kind of comment describing why the > tracepoint is where it is, etc. I beefed up the tracepo

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-10 Thread Marco Elver
On Wed, 10 Apr 2024 at 01:54, Masami Hiramatsu wrote: > > On Tue, 9 Apr 2024 16:45:47 +0200 > Marco Elver wrote: > > > On Tue, 9 Apr 2024 at 16:31, Steven Rostedt wrote: > > > > > > On Mon, 8 Apr 2024 11:01:54 +0200 > > > Marco Elver wrote: >

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-10 Thread Marco Elver
On Wed, 10 Apr 2024 at 15:56, Masami Hiramatsu wrote: > > On Mon, 8 Apr 2024 11:01:54 +0200 > Marco Elver wrote: > > > Add "new_exec" tracepoint, which is run right after the point of no > > return but before the current task assumes its new exec ident

[PATCH v2] tracing: Add sched_prepare_exec tracepoint

2024-04-11 Thread Marco Elver
sr/bin/tty filename=/usr/bin/tty pid=385 comm=bash <...>-389 [006] . 192.020147: sched_prepare_exec: interp=/usr/bin/dmesg filename=/usr/bin/dmesg pid=389 comm=bash Signed-off-by: Marco Elver --- v2: * Add more documentation. * Also show bprm->interp in trace. * Rename to sched_prepare_exe

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-11 Thread Marco Elver
On Mon, 11 Dec 2023 at 23:48, Paul Heidekrüger wrote: > > On 11.12.2023 21:51, Andrey Konovalov wrote: > > On Mon, Dec 11, 2023 at 7:59 PM Paul Heidekrüger > > wrote: > > > > > > > Hi Paul, > > > > > > > > I've been successfully running KASAN tests with CONFIG_TRACEPOINTS > > > > enabled on arm64

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-12 Thread Marco Elver
On Tue, 12 Dec 2023 at 10:19, Paul Heidekrüger wrote: > > On 12.12.2023 00:37, Andrey Konovalov wrote: > > On Tue, Dec 12, 2023 at 12:35 AM Paul Heidekrüger > > wrote: > > > > > > Using CONFIG_FTRACE=y instead of CONFIG_TRACEPOINTS=y produces the same > > > error > > > for me. > > > > > > So > >

Re: [RFC] Printk deadlock in bpf trace called from scheduler context

2024-07-29 Thread Marco Elver
On Mon, 29 Jul 2024 at 14:27, Peter Zijlstra wrote: > > On Mon, Jul 29, 2024 at 01:46:09PM +0200, Radoslaw Zielonek wrote: > > I am currently working on a syzbot-reported bug where bpf > > is called from trace_sched_switch. In this scenario, we are still within > > the scheduler context, and calli

Re: [syzbot] [trace?] linux-next test error: WARNING in rcu_core

2024-08-02 Thread Marco Elver
On Fri, 2 Aug 2024 at 09:58, syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit:f524a5e4dfb7 Add linux-next specific files for 20240802 > git tree: linux-next > console output: https://syzkaller.appspot.com/x/log.txt?x=174c896d98 > kernel config: https

Re: [syzbot] [virt?] KCSAN: data-race in virtqueue_disable_cb / vring_interrupt (4)

2024-09-12 Thread Marco Elver
On Thu, 12 Sept 2024 at 13:03, Michael S. Tsirkin wrote: > > On Thu, Sep 12, 2024 at 01:11:21AM -0700, syzbot wrote: > > Hello, > > > > syzbot found the following issue on: > > > > HEAD commit:7c6a3a65ace7 minmax: reduce min/max macro expansion in ato.. > > git tree: upstream > > console

Re: [syzbot] [virt?] KCSAN: data-race in virtqueue_disable_cb / vring_interrupt (4)

2024-09-12 Thread Marco Elver
On Thu, 12 Sept 2024 at 16:34, Michael S. Tsirkin wrote: > > On Thu, Sep 12, 2024 at 03:48:32PM +0200, Marco Elver wrote: > > On Thu, 12 Sept 2024 at 13:03, Michael S. Tsirkin wrote: > > > > > > On Thu, Sep 12, 2024 at 01:11:21AM -0700, syzbot wrote: > > >

Re: [PATCH] virtio_ring: tag event_triggered as racy for KCSAN

2024-09-12 Thread Marco Elver
> Tag the field __data_racy for now. > We should probably look at ways to make this more straight-forwardly > correct. > > Cc: Marco Elver > Reported-by: syzbot+8a02104389c2e0ef5...@syzkaller.appspotmail.com > Signed-off-by: Michael S. Tsirkin > --- > drivers/virti

Re: [PATCH v2] virtio_ring: tag event_triggered as racy for KCSAN

2024-09-12 Thread Marco Elver
can not figure all this out, and warns about > the race between the write and the read. Tag the access data_racy for > now. We should probably look at ways to make this more > straight-forwardly correct. > > Cc: Marco Elver > Reported-by: syzbot+8a02104389c2e0ef5...@syzkaller.appsp

Re: [PATCH v4 05/10] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-04-20 Thread Marco Elver
On Tue, 20 Apr 2021 at 23:26, Marek Szyprowski wrote: > > Hi Marco, > > On 08.04.2021 12:36, Marco Elver wrote: > > 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 r

Re: [PATCH] slub: Introduce CONFIG_SLUB_RCU_DEBUG

2023-09-11 Thread Marco Elver
On Fri, 25 Aug 2023 at 23:15, 'Jann Horn' via kasan-dev wrote: > > Currently, KASAN is unable to catch use-after-free in SLAB_TYPESAFE_BY_RCU > slabs because use-after-free is allowed within the RCU grace period by > design. > > Add a SLUB debugging feature which RCU-delays every individual > kmem

Re: [PATCH v3 1/2] kunit: add a KUnit test for SLUB debugging functionality

2021-04-08 Thread Marco Elver
On Tue, 6 Apr 2021 at 12:57, Vlastimil Babka wrote: > > > On 4/1/21 11:24 PM, Marco Elver wrote: > > On Thu, 1 Apr 2021 at 21:04, Daniel Latypov wrote: > >> > } > >> > #else > >> > static inline bool slab_add_kunit_e

[PATCH v4 00/10] Add support for synchronous signals on perf events

2021-04-08 Thread Marco Elver
signal was suggested by Peter Zijlstra in [3]. [2] https://lore.kernel.org/lkml/CACT4Y+YPrXGw+AtESxAgPyZ84TYkNZdP0xpocX2jwVAbZD=-x...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Marco Elver (9): perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES

[PATCH v4 01/10] perf: Rework perf_event_exit_event()

2021-04-08 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) [ el...@google.com: fix racing parent/child exit in sync_child_event(). ] Signed-off-by: Marco Elver --- v4: * Fix for pa

[PATCH v4 02/10] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-04-08 Thread Marco Elver
As with other ioctls (such as PERF_EVENT_IOC_{ENABLE,DISABLE}), fix up handling of PERF_EVENT_IOC_MODIFY_ATTRIBUTES to also apply to children. Suggested-by: Dmitry Vyukov Reviewed-by: Dmitry Vyukov Signed-off-by: Marco Elver --- kernel/events/core.c | 22 +- 1 file changed

[PATCH v4 03/10] perf: Support only inheriting events if cloned with CLONE_THREAD

2021-04-08 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 v4 04/10] perf: Add support for event removal on exec

2021-04-08 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 v4 05/10] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-04-08 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 v4 06/10] perf: Add support for SIGTRAP on perf events

2021-04-08 Thread Marco Elver
/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Acked-by: Dmitry Vyukov Signed-off-by: Marco Elver --- v4: * Generalize setting si_perf and si_addr independent of event type; introduces perf_event_attr::sig_data, which can be set by user space to be propagated to si_perf

[PATCH v4 07/10] selftests/perf_events: Add kselftest for process-wide sigtrap handling

2021-04-08 Thread Marco Elver
ftest framework provides. Signed-off-by: Marco Elver --- v4: * Update for new perf_event_attr::sig_data / si_perf handling. 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 +

[PATCH v4 08/10] selftests/perf_events: Add kselftest for remove_on_exec

2021-04-08 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 v4 09/10] tools headers uapi: Sync tools/include/uapi/linux/perf_event.h

2021-04-08 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 --- v4: * Update for new perf_event_attr::sig_data. v3: * Added to series. --- tools/include/uapi/linux/perf_event.h | 12 +++- 1

[PATCH v4 10/10] perf test: Add basic stress test for sigtrap handling

2021-04-08 Thread Marco Elver
-off-by: Marco Elver --- v4: * Update for new perf_event_attr::sig_data / si_perf handling. 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 | 150

[PATCH mm] kfence: report sensitive information based on no_hash_pointers

2021-02-23 Thread Marco Elver
decide if our reports can include other potentially sensitive information such as registers and corrupted bytes. Cc: Timur Tabi Signed-off-by: Marco Elver --- Depends on "lib/vsprintf: no_hash_pointers prints all addresses as unhashed", which was merged into mainline yesterday: https://

[PATCH RFC 0/4] Add support for synchronous signals on perf events

2021-02-23 Thread Marco Elver
Threads receiving signals on performance events to throttle/unthrottle themselves. Marco Elver (4): perf/core: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children signal: Introduce TRAP_PERF si_code and si_perf to siginfo perf/core: Add support for SIGTRAP on perf events perf/

[PATCH RFC 1/4] perf/core: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-02-23 Thread Marco Elver
As with other ioctls (such as PERF_EVENT_IOC_{ENABLE,DISABLE}), fix up handling of PERF_EVENT_IOC_MODIFY_ATTRIBUTES to also apply to children. Link: https://lkml.kernel.org/r/ybqvay8atmyto...@hirez.programming.kicks-ass.net Suggested-by: Dmitry Vyukov Signed-off-by: Marco Elver --- kernel

[PATCH RFC 2/4] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-02-23 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. Signed-off-by: Marco Elver --- arch/m68k/kernel/signal.c | 3 +++ arch/x86/kernel

[PATCH RFC 3/4] perf/core: Add support for SIGTRAP on perf events

2021-02-23 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 Signed-off-by: Marco Elver --- include/uapi/linux/perf_event.h | 3 ++- kernel/events

[PATCH RFC 4/4] perf/core: Add breakpoint information to siginfo on SIGTRAP

2021-02-23 Thread Marco Elver
to user space. Signed-off-by: Marco Elver --- kernel/events/core.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 8718763045fd..d7908322d796 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6296,6 +6296,17

Re: [PATCH RFC 4/4] perf/core: Add breakpoint information to siginfo on SIGTRAP

2021-02-23 Thread Marco Elver
On Tue, 23 Feb 2021 at 16:01, Dmitry Vyukov wrote: > > On Tue, Feb 23, 2021 at 3:34 PM Marco Elver wrote: > > > > Encode information from breakpoint attributes into siginfo_t, which > > helps disambiguate which breakpoint fired. > > > > Note, providing the e

Re: [PATCH RFC 4/4] perf/core: Add breakpoint information to siginfo on SIGTRAP

2021-02-23 Thread Marco Elver
On Tue, 23 Feb 2021 at 16:16, Dmitry Vyukov wrote: > > On Tue, Feb 23, 2021 at 4:10 PM 'Marco Elver' via kasan-dev > wrote: > > > > Encode information from breakpoint attributes into siginfo_t, which > > > > helps disambiguate which breakpoint fired. &

Re: [PATCH RFC 0/4] Add support for synchronous signals on perf events

2021-02-23 Thread Marco Elver
On Tue, 23 Feb 2021 at 15:34, Marco Elver wrote: > > The perf subsystem today unifies various tracing and monitoring > features, from both software and hardware. One benefit of the perf > subsystem is automatically inheriting events to child tasks, which > enables process-wide ev

Re: [PATCH RFC 0/4] Add support for synchronous signals on perf events

2021-02-23 Thread Marco Elver
On Tue, 23 Feb 2021 at 21:27, Andy Lutomirski wrote: > > On Feb 23, 2021, at 6:34 AM, Marco Elver wrote: > > > > The perf subsystem today unifies various tracing and monitoring > > features, from both software and hardware. One benefit of the perf > > subsyst

Re: [PATCH mm] kfence: make reporting sensitive information configurable

2021-02-09 Thread Marco Elver
On Tue, 9 Feb 2021 at 19:06, Vlastimil Babka wrote: > On 2/9/21 4:13 PM, Marco Elver wrote: > > We cannot rely on CONFIG_DEBUG_KERNEL to decide if we're running a > > "debug kernel" where we can safely show potentially sensitive > > information in the kernel lo

Re: [PATCH 0/3][RESEND] add support for never printing hashed addresses

2021-02-10 Thread Marco Elver
sting/selftests/kselftest_module.h| 18 ++--- > 4 files changed, 75 insertions(+), 10 deletions(-) I wanted to test this for deciding if we can show sensitive info in KFENCE reports, which works just fine now that debug_never_hash_pointers is non-static. FWIW, Acked-by: Marco E

Re: [PATCH 01/12] kasan, mm: don't save alloc stacks twice

2021-02-02 Thread Marco Elver
alloc caches > via a new kasan_cache_create_kmalloc() annotation. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > include/linux/kasan.h | 9 + > mm/kasan/common.c | 18 ++ > mm/slab_common.c | 1 + > 3 files changed, 24 insertions(+)

Re: [PATCH 02/12] kasan, mm: optimize kmalloc poisoning

2021-02-02 Thread Marco Elver
On Mon, Feb 01, 2021 at 08:43PM +0100, Andrey Konovalov wrote: > For allocations from kmalloc caches, kasan_kmalloc() always follows > kasan_slab_alloc(). Currenly, both of them unpoison the whole object, > which is unnecessary. > > This patch provides separate implementations for both annotations

Re: [PATCH 03/12] kasan: optimize large kmalloc poisoning

2021-02-02 Thread Marco Elver
) to only poison the redzone. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > mm/kasan/common.c | 20 +++- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c > index 128cb3

Re: [PATCH 04/12] kasan: clean up setting free info in kasan_slab_free

2021-02-02 Thread Marco Elver
lection_enabled() is always > true for generic KASAN. The confusion that this brings outweights saving > a few instructions. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > mm/kasan/common.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-)

Re: [PATCH 02/12] kasan, mm: optimize kmalloc poisoning

2021-02-02 Thread Marco Elver
On Tue, 2 Feb 2021 at 18:16, Andrey Konovalov wrote: > > On Tue, Feb 2, 2021 at 5:25 PM Marco Elver wrote: > > > > > +#ifdef CONFIG_KASAN_GENERIC > > > + > > > +/** > > > + * kasan_poison_last_granule - mark the last granule of the memory range

Re: [PATCH net-next] net: fix up truesize of cloned skb in skb_prepare_for_shift()

2021-02-02 Thread Marco Elver
On Tue, 2 Feb 2021 at 18:59, Eric Dumazet wrote: > > On Mon, Feb 1, 2021 at 5:04 PM Marco Elver wrote: > > > > Avoid the assumption that ksize(kmalloc(S)) == ksize(kmalloc(S)): when > > cloning an skb, save and restore truesize after pskb_expand_head(). This > &

Re: [PATCH 01/12] kasan, mm: don't save alloc stacks twice

2021-02-02 Thread Marco Elver
On Tue, 2 Feb 2021 at 19:01, 'Andrey Konovalov' via kasan-dev wrote: [...] > > > @@ -83,6 +83,7 @@ static inline void kasan_disable_current(void) {} > > > struct kasan_cache { > > > int alloc_meta_offset; > > > int free_meta_offset; > > > + bool is_kmalloc; [...] > > > if (k

Re: WARNING in sk_stream_kill_queues (5)

2021-02-03 Thread Marco Elver
On Mon, 14 Dec 2020 at 11:09, 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 Elver wrote: > > [...] > > > > So I started puttin

Re: [PATCH 05/12] kasan: unify large kfree checks

2021-02-03 Thread Marco Elver
t; first byte of the memory that's being freed is accessible. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > include/linux/kasan.h | 16 > mm/kasan/common.c | 36 ++-- > 2 files changed, 34 inser

Re: [PATCH 08/12] kasan, mm: optimize krealloc poisoning

2021-02-03 Thread Marco Elver
On Mon, Feb 01, 2021 at 08:43PM +0100, Andrey Konovalov wrote: > Currently, krealloc() always calls ksize(), which unpoisons the whole > object including the redzone. This is inefficient, as kasan_krealloc() > repoisons the redzone for objects that fit into the same buffer. > > This patch changes

Re: [PATCH 06/12] kasan: rework krealloc tests

2021-02-03 Thread Marco Elver
KASAN mode, and check accesses to that granule accordingly. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 91 ++-- > 1 file changed, 81 insertions(+), 10 deletions(-) > > diff --git a/lib/tes

Re: [PATCH 07/12] kasan, mm: remove krealloc side-effect

2021-02-03 Thread Marco Elver
ambiguous, because either way behaviour of krealloc differs from a kernel with KASAN disabled. Something like "kasan, mm: fail krealloc on already freed object" perhaps? > This patch also adds a KASAN-KUnit test to check krealloc() behaviour > when it's called on a freed objec

Re: [PATCH 09/12] kasan: ensure poisoning size alignment

2021-02-03 Thread Marco Elver
and > kasan_unpoison(). > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > mm/kasan/common.c | 9 ++--- > mm/kasan/kasan.h | 33 - > mm/kasan/shadow.c | 37 ++--- > 3 files change

Re: [PATCH 11/12] kasan: always inline HW_TAGS helper functions

2021-02-03 Thread Marco Elver
On Mon, Feb 01, 2021 at 08:43PM +0100, Andrey Konovalov wrote: > Mark all static functions in common.c and kasan.h that are used for > hardware tag-based KASAN as __always_inline to avoid unnecessary > function calls. > > Signed-off-by: Andrey Konovalov Does objtool complain about any of these?

Re: [PATCH mm] kasan: untag addresses for KFENCE

2021-02-01 Thread Marco Elver
On Fri, 29 Jan 2021 at 19:50, Andrey Konovalov wrote: > > KFENCE annotations operate on untagged addresses. > > Untag addresses in KASAN runtime where they might be tagged. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Thank you! > --- > > This can b

[PATCH net-next] net: fix up truesize of cloned skb in skb_prepare_for_shift()

2021-02-01 Thread Marco Elver
+7b99aafdcc2eedea6...@syzkaller.appspotmail.com Suggested-by: Eric Dumazet Signed-off-by: Marco Elver --- net/core/skbuff.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2af12f7e170c..3787093239f5 100644 --- a/net/core

Re: [PATCH net-next] net: fix up truesize of cloned skb in skb_prepare_for_shift()

2021-02-01 Thread Marco Elver
On Mon, 1 Feb 2021 at 17:50, Christoph Paasch wrote: > On Mon, Feb 1, 2021 at 8:09 AM Marco Elver wrote: > > > > Avoid the assumption that ksize(kmalloc(S)) == ksize(kmalloc(S)): when > > cloning an skb, save and restore truesize after pskb_expand_head(). This > >

Re: KCSAN: data-race in blk_stat_add / blk_stat_timer_fn (5)

2021-02-05 Thread Marco Elver
On Fri, 5 Feb 2021 at 18:00, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit:2ab38c17 mailmap: remove the "repo-abbrev" comment > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=130e19b4d0 > kernel config: https://syzkal

[PATCH] blk-mq-debugfs: mark concurrent stats counters as data races

2021-02-05 Thread Marco Elver
+2c308b859c8c103aa...@syzkaller.appspotmail.com Reported-by: syzbot+44f9b37d2de57637d...@syzkaller.appspotmail.com Reported-by: syzbot+49a9bcf457723ecaf...@syzkaller.appspotmail.com Reported-by: syzbot+b9914ed52d5b1d63f...@syzkaller.appspotmail.com Signed-off-by: Marco Elver --- Note: These 4 data races are

Re: [PATCH] kasan: fix stack traces dependency for HW_TAGS

2021-02-08 Thread Marco Elver
future, this default might makes sense for production > kernels, assuming we implement a fast stack trace collection approach. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver I'm in favor of this simplification. The fact that CONFIG_DEBUG_KERNEL cannot be relied upon to d

[PATCH] bpf_lru_list: Read double-checked variable once without lock

2021-02-09 Thread Marco Elver
y: syzbot+3536db46dfa58c573...@syzkaller.appspotmail.com Reported-by: syzbot+516acdb03d3e27d91...@syzkaller.appspotmail.com Signed-off-by: Marco Elver --- Detailed reports: https://groups.google.com/g/syzkaller-upstream-moderation/c/PwsoQ7bfi8k/m/NH9Ni2WxAQAJ https://groups.google.com/g/

[PATCH mm] kfence: make reporting sensitive information configurable

2021-02-09 Thread Marco Elver
KFENCE reports. The default behaviour remains unchanged. Signed-off-by: Marco Elver --- Documentation/dev-tools/kfence.rst | 6 +++--- lib/Kconfig.kfence | 8 mm/kfence/core.c | 2 +- mm/kfence/kfence.h | 3 +-- mm/kfence/report.c

Re: [PATCH][RESEND] lib/vsprintf: make-printk-non-secret printks all addresses as unhashed

2021-02-09 Thread Marco Elver
On Tue, Feb 02, 2021 at 03:36PM -0600, Timur Tabi wrote: > If the make-printk-non-secret command-line parameter is set, then > printk("%p") will print addresses as unhashed. This is useful for > debugging purposes. > > A large warning message is displayed if this option is enabled, > because unha

Re: PANIC: double fault in fixup_bad_iret

2020-06-01 Thread Marco Elver
On Sun, 31 May 2020 at 11:32, Dmitry Vyukov wrote: > > On Fri, May 29, 2020 at 7:11 PM Peter Zijlstra wrote: > > > Like with KCSAN, we should blanket kill KASAN/UBSAN and friends (at the > > > very least in arch/x86/) until they get that function attribute stuff > > > sorted. > > > > Something li

Re: [rcu] 2f08469563: BUG:kernel_reboot-without-warning_in_boot_stage

2020-05-19 Thread Marco Elver
On Mon, 18 May 2020 at 20:05, Marco Elver wrote: > > On Mon, 18 May 2020, 'Nick Desaulniers' via kasan-dev wrote: > > > On Mon, May 18, 2020 at 7:34 AM Marco Elver wrote: > > > > > > On Mon, 18 May 2020 at 14:44, Marco Elver wrote: > > > >

Re: [rcu] 2f08469563: BUG:kernel_reboot-without-warning_in_boot_stage

2020-05-19 Thread Marco Elver
On Tue, 19 May 2020 at 12:16, Marco Elver wrote: > > On Mon, 18 May 2020 at 20:05, Marco Elver wrote: > > > > On Mon, 18 May 2020, 'Nick Desaulniers' via kasan-dev wrote: > > > > > On Mon, May 18, 2020 at 7:34 AM Marco Elver wrote: > > >

[PATCH] kasan: Disable branch tracing for core runtime

2020-05-19 Thread Marco Elver
may recurse deep enough to cause kernel reboots without warning. To prevent similar issues in future, we should disable branch tracing for the core runtime. Link: https://lore.kernel.org/lkml/20200517011732.GE24705@shao2-debian/ Reported-by: kernel test robot Signed-off-by: Marco Elver --- mm

Re: [rcu] 2f08469563: BUG:kernel_reboot-without-warning_in_boot_stage

2020-05-19 Thread Marco Elver
On Tue, 19 May 2020 at 15:40, Marco Elver wrote: > > On Tue, 19 May 2020 at 12:16, Marco Elver wrote: > > > > On Mon, 18 May 2020 at 20:05, Marco Elver wrote: > > > > > > On Mon, 18 May 2020, 'Nick Desaulniers' via kasan-dev wrote: > > &

Re: [PATCH] READ_ONCE, WRITE_ONCE, kcsan: Perform checks in __*_ONCE variants

2020-05-19 Thread Marco Elver
On Tue, 19 May 2020 at 23:10, Qian Cai wrote: > > On Tue, May 12, 2020 at 3:09 PM Peter Zijlstra wrote: > > > > On Tue, May 12, 2020 at 08:38:39PM +0200, Marco Elver wrote: > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > > ind

Re: [PATCH] READ_ONCE, WRITE_ONCE, kcsan: Perform checks in __*_ONCE variants

2020-05-20 Thread Marco Elver
On Wed, 20 May 2020 at 05:44, Nathan Chancellor wrote: > > On Tue, May 19, 2020 at 11:16:24PM -0400, Qian Cai wrote: > > On Tue, May 19, 2020 at 10:47 PM Nathan Chancellor > > wrote: > > > > > > On Tue, May 19, 2020 at 10:28:41PM -0400, Qian Cai wrote: > > > > > > > > > > > > > On May 19, 2020, a

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

2020-07-29 Thread Marco Elver
"lockdep: Prepare for NMI IRQ state tracking", KCSAN avoided touching the IRQ trace events 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 --- v2: * Use simple s

[PATCH tip/locking/core v2 1/2] lockdep: Refactor IRQ trace events fields into struct

2020-07-29 Thread Marco Elver
snapshots. No functional change intended. Signed-off-by: Marco Elver --- v2: * Introduce patch, as pre-requisite to "kcsan: Improve IRQ state trace reporting". --- include/linux/irqflags.h | 13 + include/linux/sched.h| 11 ++-- kernel/fork.c| 16 ---

[PATCH 0/5] kcsan: Cleanups, readability, and cosmetic improvements

2020-07-31 Thread Marco Elver
Cleanups, readability, and cosmetic improvements for KCSAN. Marco Elver (5): kcsan: Simplify debugfs counter to name mapping kcsan: Simplify constant string handling kcsan: Remove debugfs test command kcsan: Show message if enabled early kcsan: Use pr_fmt for consistency kernel/kcsan

[PATCH 2/5] kcsan: Simplify constant string handling

2020-07-31 Thread Marco Elver
ned-off-by: Marco Elver --- kernel/kcsan/debugfs.c | 8 kernel/kcsan/report.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c index 3a9566addeff..116bdd8f050c 100644 --- a/kernel/kcsan/debugfs.c +++ b/kernel/kcsan

[PATCH 1/5] kcsan: Simplify debugfs counter to name mapping

2020-07-31 Thread Marco Elver
Simplify counter ID to name mapping by using an array with designated inits. This way, we can turn a run-time BUG() into a compile-time static assertion failure if a counter name is missing. No functional change intended. Signed-off-by: Marco Elver --- kernel/kcsan/debugfs.c | 33

[PATCH 3/5] kcsan: Remove debugfs test command

2020-07-31 Thread Marco Elver
Remove the debugfs test command, as it is no longer needed now that we have the KUnit+Torture based kcsan-test module. This is to avoid confusion around how KCSAN should be tested, as only the kcsan-test module is maintained. Signed-off-by: Marco Elver --- kernel/kcsan/debugfs.c | 66

[PATCH 4/5] kcsan: Show message if enabled early

2020-07-31 Thread Marco Elver
Show a message in the kernel log if KCSAN was enabled early. Signed-off-by: Marco Elver --- kernel/kcsan/core.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c index e43a55643e00..23d0c4e4cd3a 100644 --- a/kernel/kcsan/core.c

[PATCH 5/5] kcsan: Use pr_fmt for consistency

2020-07-31 Thread Marco Elver
Use the same pr_fmt throughout for consistency. [ The only exception is report.c, where the format must be kept precisely as-is. ] Signed-off-by: Marco Elver --- kernel/kcsan/debugfs.c | 8 +--- kernel/kcsan/selftest.c | 8 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff

Re: [tip: locking/kcsan] READ_ONCE: Use data_race() to avoid KCSAN instrumentation

2020-05-20 Thread Marco Elver
11:04:17 +02:00 > > > > READ_ONCE: Use data_race() to avoid KCSAN instrumentation > > > > Rather then open-code the disabling/enabling of KCSAN across the guts of > > {READ,WRITE}_ONCE(), defer to the data_race() macro instead. > > > > Signed-off-by: Will Dea

Re: [tip: locking/kcsan] READ_ONCE: Use data_race() to avoid KCSAN instrumentation

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 09:26, Borislav Petkov wrote: > > On Thu, May 21, 2020 at 12:30:39AM +0200, Marco Elver wrote: > > This should be fixed when the series that includes this commit is applied: > > https://lore.kernel.org/lkml/20200515150338.190344-9-el...@google.com/ >

Re: [PATCH -tip 08/10] READ_ONCE, WRITE_ONCE: Remove data_race() wrapping

2020-05-21 Thread Marco Elver
On Fri, 15 May 2020 at 17:04, Marco Elver wrote: > > The volatile access no longer needs to be wrapped in data_race(), > because we require compilers that emit instrumentation distinguishing > volatile accesses. > > Signed-off-by: Marco Elver > --- > include/linux/compi

Re: [PATCH -tip 08/10] READ_ONCE, WRITE_ONCE: Remove data_race() wrapping

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 11:47, Marco Elver wrote: > > On Fri, 15 May 2020 at 17:04, Marco Elver wrote: > > > > The volatile access no longer needs to be wrapped in data_race(), > > because we require compilers that emit instrumentation distinguishing > > volatile a

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

2020-05-21 Thread Marco Elver
tement expression in response to apparent issues that compilers are having with nested statement expressions. 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 disting

[PATCH -tip v2 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 v2 05/11] kcsan: Remove 'noinline' from __no_kcsan_or_inline

2020-05-21 Thread Marco Elver
.@mail.gmail.com 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 +++ b/include/linux/comp

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

2020-05-21 Thread Marco Elver
). [1] https://github.com/llvm/llvm-project/commit/5a2c31116f412c3b6888be361137efd705e05814 [2] https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544452.html This patch allows removing any explicit checks in primitives such as READ_ONCE() and WRITE_ONCE(). Signed-off-by: Marco Elver --- v2

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

2020-05-21 Thread Marco Elver
-off-by: Marco Elver --- v2: * Add patch to series in response to above linked discussion. --- include/linux/compiler.h | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7444f026eead..1f9bd9f35368 100644 --- a

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

2020-05-21 Thread Marco Elver
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 # of some options does

[PATCH -tip v2 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. 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's pre-KCSAN ve

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

2020-05-21 Thread Marco Elver
Signed-off-by: Marco Elver --- Documentation/dev-tools/kcsan.rst | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Documentation/dev-tools/kcsan.rst b/Documentation/dev-tools/kcsan.rst index f4b5766f12cc..ce4bbd918648 100644 --- a/Documentation/dev-tools/kcsan.rst

[PATCH -tip v2 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.] Signed-off-by: Marco Elver --- scripts/Makefile.kcsan | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) dif

[PATCH -tip v2 06/11] kcsan: Restrict supported compilers

2020-05-21 Thread Marco Elver
d #7. Link: https://lkml.kernel.org/r/CANpmjNMTsY_8241bS7=xafqvzhflrvekv_um4aduwe_kh3r...@mail.gmail.com Signed-off-by: Marco Elver --- lib/Kconfig.kcsan | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan index a7276035ca0d..3f3b5bca7a8f 1

[PATCH -tip v2 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. Signed-off-by: Marco Elver --- include/linux/compiler_types.h | 13

[PATCH -tip v2 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. Signed-off-by: Marco Elver --- include/linux/compiler.h | 29 - include/linux/compiler_types.h | 29

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

2020-05-21 Thread Marco Elver
On Fri, 15 May 2020 at 17:03, Marco Elver wrote: > > This patch series is the conclusion to [1], where we determined that due > to various interactions with no_sanitize attributes and the new > {READ,WRITE}_ONCE(), KCSAN will require Clang 11 or later. Other > sanitizers are la

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

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 15:18, Will Deacon wrote: > > On Thu, May 21, 2020 at 01:08:46PM +0200, Marco Elver wrote: > > In the kernel, volatile is used in various concurrent context, whether > > in low-level synchronization primitives or for legacy reasons. If > > supported

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

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 15:33, Will Deacon wrote: > > On Thu, May 21, 2020 at 01:08:50PM +0200, Marco Elver wrote: > > Signed-off-by: Marco Elver > > --- > > Documentation/dev-tools/kcsan.rst | 9 + > > 1 file changed, 1 insertion(+), 8 deletions(-) >

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

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 15:31, Will Deacon wrote: > > On Thu, May 21, 2020 at 01:08:52PM +0200, Marco Elver wrote: > > It appears that compilers have trouble with nested statements > > expressions, as such make the data_race() macro be only a single > > statement expre

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

2020-05-21 Thread Marco Elver
On Thu, 21 May 2020 at 15:36, Will Deacon wrote: > > On Thu, May 21, 2020 at 01:08:43PM +0200, Marco Elver wrote: > > This patch series is the conclusion to [1], where we determined that due > > to various interactions with no_sanitize attributes and the new > > {READ,W

[PATCH -tip v3 06/11] kcsan: Restrict supported compilers

2020-05-21 Thread Marco Elver
d #7. Link: https://lkml.kernel.org/r/CANpmjNMTsY_8241bS7=xafqvzhflrvekv_um4aduwe_kh3r...@mail.gmail.com Acked-by: Will Deacon Signed-off-by: Marco Elver --- lib/Kconfig.kcsan | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan index a727

  1   2   3   4   5   6   7   8   9   10   >