public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrea Arcangeli <andrea@novell.com>
Cc: Rik van Riel <riel@redhat.com>,
	"Martin J. Bligh" <mbligh@aracnet.com>,
	Andrew Morton <akpm@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm
Date: Sun, 26 Sep 2004 10:59:43 +1000	[thread overview]
Message-ID: <1096160383.18233.67.camel@gaston> (raw)
In-Reply-To: <20040926004608.GS3309@dualathlon.random>

On Sun, 2004-09-26 at 10:46, Andrea Arcangeli wrote:

> As far as the C language is concerned that *ptep = something can be
> implemented with 8 writes of 1 byte each (or alternatively with an
> assembler instruction that may make the written data visible not
> atomically to other cpus, despite it was written with a single opcode,
> similarly to what happens if you use incl without the lock prefix). I'm
> not saying such instruction exists in ppc64, but the compiler is
> definitely allowed to break the above. You can blame on the compiler to
> be inefficient, but you can't blame on the compiler for the security
> hazard it would generate. Only the kernel would be to blame if for
> whatever reason a gcc version would be underoptimized.

BTW, for your reading pleasure :)

#define atomic_set(v,i)		(((v)->counter) = (i))

(asm-i386/atomic.h)

And that's really far from beeing the 2 only cases where the kernel _relies_
on a write of a simple type like int or long to an aligned location to be
atomic. Almost all drivers manipulating DMA descriptors do that, jiffies
is a good example too afaik, and more and more and more ... so if the
compiler is breaking that up, I think the set_pte race is the least of
our problems :)

Ben.



  reply	other threads:[~2004-09-26  1:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-25 15:54 ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm Andrea Arcangeli
2004-09-25 23:33 ` Benjamin Herrenschmidt
2004-09-26  0:20   ` Andrea Arcangeli
2004-09-26  0:31     ` Rik van Riel
2004-09-26  0:46       ` Andrea Arcangeli
2004-09-26  0:59         ` Benjamin Herrenschmidt [this message]
2004-09-26  1:36           ` Andrea Arcangeli
2004-09-26  5:31             ` Benjamin Herrenschmidt
2004-09-26 20:30           ` Paul Mackerras
     [not found]             ` <20040926203640.GR2499@dualathlon.random>
2004-09-27 16:41               ` Andrea Arcangeli
2004-09-28  9:12         ` Pavel Machek
2004-09-26  0:44     ` Benjamin Herrenschmidt
2004-09-26  1:32       ` Andrea Arcangeli
2004-09-26  5:29         ` Benjamin Herrenschmidt
2004-09-26 15:39           ` Andrea Arcangeli
2004-09-26 14:41       ` Martin J. Bligh
2004-09-26 15:41         ` Andrea Arcangeli
2004-09-25 23:44 ` Rik van Riel
2004-09-26  0:31   ` Andrea Arcangeli
2004-09-26  0:37     ` Rik van Riel

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=1096160383.18233.67.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=andrea@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=riel@redhat.com \
    /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