Re: [RFC] Splitting kernel headers and deprecating __KERNEL__

From: Arjan van de Ven
Date: Wed Dec 01 2004 - 03:12:17 EST


On Tue, 2004-11-30 at 16:18 -0800, Linus Torvalds wrote:
> On Tue, 30 Nov 2004, Linus Torvalds wrote:
> >
> > Even atomic.h. I could well imagine that somebody includes atomic.h just
> > to get the thread-safe updates for some architectures. For example,
> > asm-alpha/atomic.h does it right, and I would not be at all surprised if
> > somebody had noticed.
>
> In fact, this is not entirely theoretical.

indeed it's not. THere were projects that used the x86 atomic.h
header.... but failed to notice that its not actually using the lock
prefix if you don't define CONFIG_SMP. Now it's purely up to luck if the
userspace headers in /usr/include have CONFIG_SMP defined or not, so
there have been cases where people compiled on an UP box and got racy
code. Was a production level project; normally they built on SMP but
once they built on UP .. poof ;)

so atomic.h is *dangerous* for userspace to use, at least on x86. It
gives a false feeling of atomicity.

So dangerous that for the RH/Fedora distros, we don't ship the
questionable parts of it.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/