Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-17 Thread Marco Elver
On Thu, 17 Oct 2019 at 09:47, Peter Zijlstra wrote: > > On Wed, Oct 16, 2019 at 09:34:05PM +0200, Marco Elver wrote: > > On Wed, 16 Oct 2019 at 20:44, Peter Zijlstra wrote: > > > > + /* > > > > + * Disable interrupts & preemptions, to ignore races due to > > > > accesses in > > > > +

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-17 Thread Peter Zijlstra
On Wed, Oct 16, 2019 at 09:34:05PM +0200, Marco Elver wrote: > On Wed, 16 Oct 2019 at 20:44, Peter Zijlstra wrote: > > > + /* > > > + * Disable interrupts & preemptions, to ignore races due to > > > accesses in > > > + * threads running on the same CPU. > > > + */ > > > + l

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Boqun Feng
On Wed, Oct 16, 2019 at 12:06:51PM +0200, Marco Elver wrote: > On Wed, 16 Oct 2019 at 11:42, Boqun Feng wrote: > > > > Hi Marco, > > > > On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > > [...] > > > --- /dev/null > > > +++ b/kernel/kcsan/kcsan.c > > > @@ -0,0 +1,81 @@ > > > +// SPDX

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Marco Elver
On Wed, 16 Oct 2019 at 20:44, Peter Zijlstra wrote: > > On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > > > +bool __kcsan_check_watchpoint(const volatile void *ptr, size_t size, > > + bool is_write) > > +{ > > + atomic_long_t *watchpoint; > > + long

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Peter Zijlstra
On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > +bool __kcsan_check_watchpoint(const volatile void *ptr, size_t size, > + bool is_write) > +{ > + atomic_long_t *watchpoint; > + long encoded_watchpoint; > + unsigned long flags; > + enum kcsan

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Marco Elver
On Wed, 16 Oct 2019 at 17:16, Mark Rutland wrote: > > On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > index 2c2e56bd8913..34a1d9310304 100644 > > --- a/include/linux/sched.h > > +++ b/include/linux/sched.h > > @@ -1171

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Mark Rutland
On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 2c2e56bd8913..34a1d9310304 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1171,6 +1171,13 @@ struct task_struct { > #ifdef CONFIG_KASAN >

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Marco Elver
> > diff --git a/Documentation/dev-tools/kcsan.rst > > b/Documentation/dev-tools/kcsan.rst > > new file mode 100644 > > index ..5b46cc5593c3 > > --- /dev/null > > +++ b/Documentation/dev-tools/kcsan.rst > > @@ -0,0 +1,202 @@ > > +The Kernel Concurrency Sanitizer (KCSAN) > > +==

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Andrey Konovalov
On Wed, Oct 16, 2019 at 10:41 AM Marco Elver wrote: > > Kernel Concurrency Sanitizer (KCSAN) is a dynamic data-race detector for > kernel space. KCSAN is a sampling watchpoint-based data-race detector. > See the included Documentation/dev-tools/kcsan.rst for more details. > > This patch adds basic

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Marco Elver
On Wed, 16 Oct 2019 at 11:42, Boqun Feng wrote: > > Hi Marco, > > On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: > [...] > > --- /dev/null > > +++ b/kernel/kcsan/kcsan.c > > @@ -0,0 +1,81 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > +/* > > + * The Kernel Concurrency Sanitiz

Re: [PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Boqun Feng
Hi Marco, On Wed, Oct 16, 2019 at 10:39:52AM +0200, Marco Elver wrote: [...] > --- /dev/null > +++ b/kernel/kcsan/kcsan.c > @@ -0,0 +1,81 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +/* > + * The Kernel Concurrency Sanitizer (KCSAN) infrastructure. For more info > please > + * see Documentati

[PATCH 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-16 Thread Marco Elver
Kernel Concurrency Sanitizer (KCSAN) is a dynamic data-race detector for kernel space. KCSAN is a sampling watchpoint-based data-race detector. See the included Documentation/dev-tools/kcsan.rst for more details. This patch adds basic infrastructure, but does not yet enable KCSAN for any architect