The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Robert Hancock <hancockr@shaw.ca>
Cc: "remi.chateauneu@gmail.com" <remi.chateauneu@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: asm/atomic.h and user code
Date: Sun, 4 Mar 2007 03:03:39 +0000	[thread overview]
Message-ID: <20070304030339.GA5921@linux-mips.org> (raw)
In-Reply-To: <45EA2A6B.9090404@shaw.ca>

On Sat, Mar 03, 2007 at 08:09:47PM -0600, Robert Hancock wrote:
> Date:	Sat, 03 Mar 2007 20:09:47 -0600
> From:	Robert Hancock <hancockr@shaw.ca>
> Subject: Re: asm/atomic.h and user code
> To:	"remi.chateauneu@gmail.com" <remi.chateauneu@gmail.com>,
> 	linux-kernel <linux-kernel@vger.kernel.org>
> Content-type: text/plain; charset=ISO-8859-1; format=flowed
> 
> remi.chateauneu@gmail.com wrote:
> >Is it me or it seems it is not possible anymore to use asm/atomic.h in
> >non-kernel code ? Thanks.
> 
> The atomic functions, as with any internal kernel data structures, were 
> never intended to be used in userspace. In particular, the atomic 
> functions depend on config settings like CONFIG_SMP in order to actually 
> be atomic, and that's not guaranteed in userspace.

Some of the atomic headers use constructs such as disabling interrupts
which are not permitted in user space and if they were, would _silently_
fail.  Other atomic operations such as <asm/bitops.h>, <asm/spinlock.h>
and xchg() <asm/system.h> have the same restriction.

Another trap is that in userspace PIC code may be used while in the kernel
it generally is not used and therefore much of the inline assembler code in
the kernel might fail.

In short, the kernel is a different universe :-)

  Ralf

      reply	other threads:[~2007-03-04  4:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1172958807.453840.180700@30g2000cwc.googlegroups.com>
2007-03-04  2:09 ` asm/atomic.h and user code Robert Hancock
2007-03-04  3:03   ` Ralf Baechle [this message]

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=20070304030339.GA5921@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=remi.chateauneu@gmail.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