linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Ingo Molnar <mingo@redhat.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86, kasan: add KASAN checks to atomic operations
Date: Wed, 8 Mar 2017 17:43:00 +0000	[thread overview]
Message-ID: <20170308174300.GL20400@arm.com> (raw)
In-Reply-To: <20170308152027.GA13133@leverpostej>

On Wed, Mar 08, 2017 at 03:20:41PM +0000, Mark Rutland wrote:
> On Wed, Mar 08, 2017 at 02:42:10PM +0100, Dmitry Vyukov wrote:
> > I think if we scope compiler atomic builtins to KASAN/KTSAN/KMSAN (and
> > consequently x86/arm64) initially, it becomes more realistic. For the
> > tools we don't care about absolute efficiency and this gets rid of
> > Will's points (2), (4) and (6) here https://lwn.net/Articles/691295/.
> > Re (3) I think rmb/wmb can be reasonably replaced with
> > atomic_thread_fence(acquire/release). Re (5) situation with
> > correctness becomes better very quickly as more people use them in
> > user-space. Since KASAN is not intended to be used in production (or
> > at least such build is expected to crash), we can afford to shake out
> > any remaining correctness issues in such build. (1) I don't fully
> > understand, what exactly is the problem with seq_cst?
> 
> I'll have to leave it to Will to have the final word on these; I'm
> certainly not familiar enough with the C11 memory model to comment on
> (1).

rmb()/wmb() are not remotely similar to
atomic_thread_fenc_{acquire,release}, even if you restrict ordering to
coherent CPUs (i.e. the smp_* variants). Please don't do that :)

I'm also terrified of the optimisations that the compiler is theoretically
allowed to make to C11 atomics given the assumptions of the language
virtual machine, which are not necessarily valid in the kernel environment.
We would at least need well-supported compiler options to disable these
options, and also to allow data races with things like READ_ONCE.

Will

  parent reply	other threads:[~2017-03-08 18:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 12:42 [PATCH] x86, kasan: add KASAN checks to atomic operations Dmitry Vyukov
2017-03-06 12:50 ` Dmitry Vyukov
2017-03-06 12:58   ` Peter Zijlstra
2017-03-06 13:01     ` Peter Zijlstra
2017-03-06 14:24       ` Dmitry Vyukov
2017-03-06 15:20         ` Peter Zijlstra
2017-03-06 16:04           ` Mark Rutland
2017-03-06 15:33         ` Peter Zijlstra
2017-03-06 16:20         ` Mark Rutland
2017-03-06 16:27           ` Dmitry Vyukov
2017-03-06 17:25             ` Mark Rutland
2017-03-06 20:35           ` Peter Zijlstra
2017-03-08 13:42             ` Dmitry Vyukov
2017-03-08 15:20               ` Mark Rutland
2017-03-08 15:27                 ` Dmitry Vyukov
2017-03-08 15:43                   ` Mark Rutland
2017-03-08 15:45                     ` Dmitry Vyukov
2017-03-08 15:48                       ` Mark Rutland
2017-03-08 17:43                 ` Will Deacon [this message]
2017-03-14 15:22                   ` Dmitry Vyukov
2017-03-14 15:31                     ` Peter Zijlstra
2017-03-14 15:32                     ` Peter Zijlstra
2017-03-14 15:44                       ` Mark Rutland
2017-03-14 19:25                         ` Dmitry Vyukov
2017-03-06 16:48         ` 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=20170308174300.GL20400@arm.com \
    --to=will.deacon@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).