public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kyle McMartin <kyle@infradead.org>
Cc: mingo@redhat.com, dwmw2@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [rfc] headers_check cleanups break the whole world
Date: Tue, 24 Feb 2009 22:24:37 -0800	[thread overview]
Message-ID: <49A4E425.5030204@zytor.com> (raw)
In-Reply-To: <20090225032553.GD6690@bombadil.infradead.org>

Kyle McMartin wrote:
> 
> The reason for this is you cannot intermix glibc header <sys/*.h>
> includes with <linux/*.h> includes for most things without defining the
> __KERNEL_STRICT_NAMES guard. If you fail to define this, you end up
> with multiple definitions of things like dev_t.
> 
> Software was able to get by, because things that used the headers, dvb for
> example were not getting <linux/types.h> into the include chain, because
> they were using <asm/types.h> directly.
> 
> I propose we invert that logic, so the presumable libc that makes use of
> the <linux/types.h> header can just define that it wants these types.
> (test __KERNEL__ as well so the kernel doesn't need a pointless
> #define.)
> 

The Right Thing[TM] here is to change the exported headers so that
*only* the __kernel* names are exported, and then remove the
non-__KERNEL_STRICT_NAMES version of <linux/types.h>.  The *only* libc
for which non-__KERNEL_STRICT_NAMES ever made sense was for the
long-since-obsolete libc5.

This, by the way, is not frivolous work.  The work that has been done in
this area already has smoked out a number of bugs where exported headers
were using user space types, which meant they were using the *WRONG
TYPES* on glibc.  Completely.

> If this isn't tenable, how about moving the {,__}[su]{8,16,32,64}
> integer types into their own header, so we can avoid this mess ever
> occuring in the future. I'm sure the janitors can have a field day with
> that... :)
> 
> That said, who exactly is the userspace consumer for those
> 	typedef __kernel_dev_t	dev_t;
> defines? Can we just include them all in #ifdef __KERNEL__? 

That is exactly what we should do.

For what it's worth, not even klibc uses these types.

	-hpa	

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  reply	other threads:[~2009-02-25  6:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25  3:25 [rfc] headers_check cleanups break the whole world Kyle McMartin
2009-02-25  6:24 ` H. Peter Anvin [this message]
2009-02-25  6:56 ` Ingo Molnar
2009-02-25  7:00   ` H. Peter Anvin
2009-02-25  7:05   ` Kyle McMartin
2009-02-25  7:08     ` H. Peter Anvin
2009-02-25  7:13       ` Kyle McMartin
2009-02-25  7:16         ` H. Peter Anvin
2009-02-25  7:22           ` Kyle McMartin
2009-02-25 18:17             ` [PATCH] Make exported headers use strict posix types Arnd Bergmann
2009-02-25 20:11               ` Sam Ravnborg
2009-02-25 21:42                 ` Arnd Bergmann
2009-02-25 21:58                 ` Arnd Bergmann
2009-02-25 22:07                   ` H. Peter Anvin
2009-02-25 22:39                     ` David Woodhouse
2009-02-25 23:58                       ` H. Peter Anvin
2009-02-25 23:07                 ` H. Peter Anvin
2009-02-26  0:01                   ` Arnd Bergmann
2009-02-26  0:04                     ` H. Peter Anvin
2009-02-25 11:34   ` [rfc] headers_check cleanups break the whole world Sam Ravnborg

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=49A4E425.5030204@zytor.com \
    --to=hpa@zytor.com \
    --cc=dwmw2@infradead.org \
    --cc=kyle@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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