From: Peter Zijlstra <peterz@infradead.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
tip-bot for Andrey Ryabinin <tipbot@zytor.com>,
linux-tip-commits@vger.kernel.org,
kasan-dev <kasan-dev@googlegroups.com>,
Ingo Molnar <mingo@kernel.org>,
Kostya Serebryany <kcc@google.com>,
Borislav Petkov <bp@alien8.de>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sasha Levin <sasha.levin@oracle.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>,
Andrey Konovalov <andreyknvl@google.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Alexander Potapenko <glider@google.com>
Subject: Re: [tip:locking/urgent] compiler, atomics: Provide READ_ONCE_NOCHECK ()
Date: Wed, 14 Oct 2015 18:16:15 +0200 [thread overview]
Message-ID: <20151014161615.GG3816@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CACT4Y+YKnBQQ434c9wn5C9_aUhLA9shR1iNE34CX7XHcduK2Bg@mail.gmail.com>
On Wed, Oct 14, 2015 at 06:08:16PM +0200, Dmitry Vyukov wrote:
> >> > So I add READ_ONCE_NOCHECK() for accesses for which the compiler cannot
> >> > prove safe address for KASAN's benefit, but READ_ONCE() suffices for
> >> > the data-race-detection logic in KTSAN, correct?
> >>
> >> KTSAN also needs READ_ONCE_NOCHECK() here. KTSAN will flag races
> >> between get_wchan() and the thread accesses to own stack even more
> >> aggressively than KASAN, because KTSAN won't like get_wchan() accesses
> >> even to non-poisoned areas of other thread stack.
> >
> > So to keep KTSAN happy, any read from some other thread's stack requires
> > READ_ONCE_NOCHECK()? What if the access is via a locking primitive or
> > read-modify-write atomic operation?
> >
> > This is of some interest in RCU, which implements synchronous grace
> > periods using completions that are allocated on the calling task's stack
> > and manipulated by RCU callbacks that are likely executing elsewhere.
>
>
> KTSAN does not have any special logic for stacks. It just generally
> flags pairs of accesses when (1) at least one access is not atomic,
> (2) at least one access is a write and (3) these accesses are not
> synchronized by means of other synchronization.
But but but.. WRITE_ONCE/READ_ONCE _are_ atomic when on naturally
aligned machine word sized thingies. We very much rely on that.
And the wchan thing is very much that, its not some weird large object,
its a single word, read with an explicit 'volatile' cast.
This is good, and should not require more magic annotations.
next prev parent reply other threads:[~2015-10-14 16:16 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 12:35 [PATCH v2 0/2] Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-13 12:35 ` [PATCH v2 1/2] Provide READ_ONCE_NOCHECK() Andrey Ryabinin
2015-10-13 14:16 ` Ingo Molnar
2015-10-13 16:02 ` kbuild test robot
2015-10-13 16:31 ` Andrey Ryabinin
2015-10-14 13:40 ` Ingo Molnar
2015-10-14 14:11 ` Andrey Ryabinin
2015-10-13 12:35 ` [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-13 13:48 ` Ingo Molnar
2015-10-13 13:57 ` Andrey Ryabinin
2015-10-13 13:57 ` Dmitry Vyukov
2015-10-13 14:15 ` Andrey Ryabinin
2015-10-13 14:19 ` Ingo Molnar
2015-10-13 15:28 ` [PATCH v3 0/2] " Andrey Ryabinin
2015-10-13 15:28 ` [PATCH v3 1/2] Provide READ_ONCE_NOCHECK() Andrey Ryabinin
2015-10-14 15:28 ` [tip:locking/urgent] compiler, atomics: Provide READ_ONCE_NOCHECK () tip-bot for Andrey Ryabinin
2015-10-14 15:45 ` Paul E. McKenney
2015-10-14 15:50 ` Dmitry Vyukov
2015-10-14 16:01 ` Paul E. McKenney
2015-10-14 16:08 ` Dmitry Vyukov
2015-10-14 16:16 ` Peter Zijlstra [this message]
2015-10-14 16:18 ` Dmitry Vyukov
2015-10-14 16:20 ` Peter Zijlstra
2015-10-14 16:23 ` Andy Lutomirski
2015-10-14 16:34 ` Peter Zijlstra
2015-10-14 17:48 ` Ingo Molnar
2015-10-14 17:57 ` Andy Lutomirski
2015-10-14 16:34 ` Dmitry Vyukov
2015-10-14 16:54 ` Peter Zijlstra
2015-10-14 16:20 ` Paul E. McKenney
2015-10-14 16:32 ` Dmitry Vyukov
2015-10-14 17:04 ` Paul E. McKenney
2015-10-14 17:23 ` Dmitry Vyukov
2015-10-14 17:34 ` Paul E. McKenney
2015-10-14 16:19 ` Andrey Ryabinin
2015-10-14 16:29 ` Dmitry Vyukov
2015-10-14 17:06 ` Paul E. McKenney
2015-10-15 9:18 ` linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK()) Stephen Rothwell
2015-10-15 9:18 ` Stephen Rothwell
2015-10-15 10:03 ` Andrey Ryabinin
2015-10-15 10:03 ` Andrey Ryabinin
2015-10-15 10:19 ` [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Andrey Ryabinin
2015-10-15 10:19 ` Andrey Ryabinin
2015-10-15 11:30 ` Ingo Molnar
2015-10-13 15:28 ` [PATCH v3 2/2] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-14 15:29 ` [tip:locking/urgent] x86/mm: Silence KASAN warnings in get_wchan( ) tip-bot for Andrey Ryabinin
2015-10-16 9:44 ` [PATCH v4 0/2] Andrey Ryabinin
2015-10-16 9:44 ` [PATCH v4 1/2] compiler, atomics: Provide READ_ONCE_NOKSAN() Andrey Ryabinin
2015-10-16 10:00 ` Peter Zijlstra
2015-10-16 10:54 ` Andrey Ryabinin
2015-10-16 11:08 ` Peter Zijlstra
2015-10-16 10:33 ` Borislav Petkov
2015-10-16 11:58 ` Andrey Ryabinin
2015-10-18 7:24 ` Ingo Molnar
2015-10-16 16:05 ` Paul E. McKenney
2015-10-16 9:44 ` [PATCH v4 2/2] x86/mm: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-16 9:47 ` [PATCH v4 0/2] " Andrey Ryabinin
2015-10-19 8:37 ` [PATCH v5 " Andrey Ryabinin
2015-10-19 8:37 ` [PATCH v5 1/2] compiler, atomics: Provide READ_ONCE_NOCHECK() Andrey Ryabinin
2015-10-20 9:37 ` [tip:x86/urgent] compiler, atomics, kasan: " tip-bot for Andrey Ryabinin
2015-10-19 8:37 ` [PATCH v5 2/2] x86/mm: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-20 9:37 ` [tip:x86/urgent] x86/mm, kasan: " tip-bot for Andrey Ryabinin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151014161615.GG3816@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=aryabinin@virtuozzo.com \
--cc=bp@alien8.de \
--cc=dvlasenk@redhat.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=tipbot@zytor.com \
--cc=torvalds@linux-foundation.org \
--cc=wmglo@dent.med.uni-muenchen.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.