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

2019-10-23 Thread Oleg Nesterov
On 10/22, Marco Elver wrote: > > On Tue, 22 Oct 2019 at 17:49, Oleg Nesterov wrote: > > > > Just for example. Suppose that task->state = TASK_UNINTERRUPTIBLE, this task > > does __set_current_state(TASK_RUNNING), another CPU does > > wake_up_process(task) > > which does the same UNINTERRUPTIBLE -

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

2019-10-23 Thread Dmitry Vyukov
On Thu, Oct 17, 2019 at 4:13 PM 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. I think there is some sig

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

2019-10-23 Thread Dmitry Vyukov
On Thu, Oct 17, 2019 at 4:13 PM 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 v2 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-23 Thread Dmitry Vyukov
)On Thu, Oct 17, 2019 at 4:13 PM 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 v2 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-23 Thread Dmitry Vyukov
w? On Thu, Oct 17, 2019 at 4:13 PM 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

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

2019-10-23 Thread Dmitry Vyukov
"))On Thu, Oct 17, 2019 at 4:13 PM 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 bas

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

2019-10-23 Thread Dmitry Vyukov
/On Thu, Oct 17, 2019 at 4:13 PM 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 v2 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure

2019-10-23 Thread Dmitry Vyukov
On Thu, Oct 17, 2019 at 4:13 PM Marco Elver wrote: > --- a/init/main.c > +++ b/init/main.c > @@ -93,6 +93,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -779,6 +780,7 @@ asmlinkage __visible void __init start_kernel(void) > acpi_subsystem_init();

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

2019-10-23 Thread Dmitry Vyukov
.On Thu, Oct 17, 2019 at 4:13 PM Marco Elver wrote: > --- a/include/linux/compiler-clang.h > +++ b/include/linux/compiler-clang.h > @@ -24,6 +24,15 @@ > #define __no_sanitize_address > #endif > > +#if __has_feature(thread_sanitizer) > +/* emulate gcc's __SANITIZE_THREAD__ flag */ > +#define __SA

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

2019-10-23 Thread Dmitry Vyukov
" "On Thu, Oct 17, 2019 at 4:13 PM 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 bas

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

2019-10-22 Thread Marco Elver
On Tue, 22 Oct 2019 at 17:49, Oleg Nesterov wrote: > > On 10/17, Marco Elver wrote: > > > > + /* > > + * Delay this thread, to increase probability of observing a racy > > + * conflicting access. > > + */ > > + udelay(get_delay()); > > + > > + /* > > + * Re-read val

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

2019-10-22 Thread Marco Elver
Hi Mark, Thanks for you comments; see inline comments below. On Tue, 22 Oct 2019 at 16:11, Mark Rutland wrote: > > Hi Marco, > > On Thu, Oct 17, 2019 at 04:12:58PM +0200, Marco Elver wrote: > > Kernel Concurrency Sanitizer (KCSAN) is a dynamic data-race detector for > > kernel space. KCSAN is a

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

2019-10-22 Thread Oleg Nesterov
On 10/17, Marco Elver wrote: > > + /* > + * Delay this thread, to increase probability of observing a racy > + * conflicting access. > + */ > + udelay(get_delay()); > + > + /* > + * Re-read value, and check if it is as expected; if not, we infer a > + * racy acc

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

2019-10-22 Thread Mark Rutland
Hi Marco, On Thu, Oct 17, 2019 at 04:12:58PM +0200, 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. > > Thi

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

2019-10-21 Thread Marco Elver
On Mon, 21 Oct 2019 at 15:37, Alexander Potapenko wrote: > > On Thu, Oct 17, 2019 at 4:13 PM 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 Document

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

2019-10-21 Thread Alexander Potapenko
On Thu, Oct 17, 2019 at 4:13 PM 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

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

2019-10-17 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