All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
	akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: Simple header cleanups
Date: Fri, 28 Apr 2006 01:12:00 +0200	[thread overview]
Message-ID: <20060427231200.GW3570@stusta.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0604271439100.3701@g5.osdl.org>

On Thu, Apr 27, 2006 at 03:00:16PM -0700, Linus Torvalds wrote:
> 
> On Thu, 27 Apr 2006, Adrian Bunk wrote:
> > 
> > A definition of the kernel <-> userspace ABI is required.
> 
> Well, we can get certain hints by just looking at every single type that 
> is used as a __user pointer. That should give us a lot of the type 
> information.
> 
> The other big piece ends up being argument values passed in to system 
> calls, most notably ioctl numbers, but there are certainly others too.
> 
> And then there are the system call numbers themselves, and their calling 
> conventions (fairly small part).

Currently, it's sometimes non-trivial to figure out what is part of the 
ABI and what is not.

E.g. if you want to change a struct, how do you know whether it's part 
of the userspace ABI?

> > Create an include/kabi/linux/ with the following properties:
> 
> I do hate your naming.
> 
> Why is that "linux" there? We're not going to have FreeBSD kabi files. And 
> what about the (pretty common) architecture-specific ones?

Agreed.

But let's discuss the naming after this discussion.

> The dependency chain is also quite often nontrivial. The ABI's all end up 
> depending on the basic types, and often on each other (eg the ioctl 
> numbers depend on the sizes of all the structures, which in turn depend on 
> the architecture-specific structure layout and low-level types).
> 
> So it's _not_ usually possible to just do one file that does one thing, 
> because they do actually have linkages.

Sure.

> And the linkages can be nasty, because they can easily be linkages that 
> POSIX - and other standards - forbid them from being visible (you cannot 
> expose certain typenames if they weren't _explicitly_ included, regardless 
> of whether you need the type defines).
> 
> This is one reason why we shouldn't even _plan_ on having header files 
> that can just be _directly_ used by the C libraries etc, even if it's just 
> a "small" kernel ABI header.
> 
> Selling it as that kind of idea will inevitably mean that we then get 
> blamed for not knowing magic rule #579 for SuS v2.1.6 subsection 8(a).
> 
> And if we say "you can use these headers unmodified", that _is_ what we're 
> going to get blamed for. I'm so _not_ interested in having to care or 
> worry.
> 
> So I seriously think we should aim for making it _easier_ for system 
> libraries to get the information, but we should at the same time make it 
> clear that we make it easier for them to get the basic info, BUT WE DO NOT 
> CARE ABOUT THE RANDOM USER STANDARD OF THE DAY.
> 
> Have you looked in /usr/include lately? Have you _looked_ at the "expose 
> BSD names" vs "GNU extended source" vs "strict POSIX" vs 
> "_XOPEN_SOURCE==600" bs "_USE_MISC" vs a million random and strange 
> things?
> 
> The day I see somebody adding crap like that to the kernel headers is the 
> day I pull the plug on any "KABI" interfaces. 
> 
> And don't tell me this has got nothing to do with the kernel constants. Go 
> look in something like /usr/include/bits/fcntl.h, and cry. See how it's 
> using _exactly_ the kernel constants, but it has added all the random 
> standard-of-the-day #ifdef (whether real standards, or the "GNU standards" 
> or just "legacy BSD-like" etc).
> 
> And THAT is why I don't think the simplistic "kabi" directory approach 
> that people have brought up many times over many years is actually 
> realistic. People don't realize that glibcs makes "struct flock" actually 
> look different in user space depending on whether "__USE_FILE_OFFSET64" is 
> defined or not.
> 
> You just haven't seen just how NASTY those user-space headers are. They 
> can't use _any_ kernel headers directly, because even when they want a 
> _raw_ kernel data structure, they actually end up doing things differently 
> in the _middle_ of that data structure. 
> 
> Really.
> 
> So we should try to help those system libc people perhaps _find_ the 
> values and structures they need, but no, I will _never_ allow the kernel 
> headers to be used directly. And it doesn't _matter_ if they've been moved 
> to a "kabi" subdirectory. That's not the issue. The issue is that user 
> space does insane things that aren't acceptable in kernel space.

I do still not get your point.

The ABI headers will be used by C libraries.

And by some programs doing low-level Linux specific things - but these 
are exceptions.

Normal userspace programs will simply not care about the contents of the 
kernel ABI headers - the libc will present them pretty headers adhering 
to all past, current and future standards.

This works today and it will continue to work.

> 			Linus

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


  parent reply	other threads:[~2006-04-27 23:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27  2:13 Simple header cleanups David Woodhouse
2006-04-27  2:18 ` Linus Torvalds
2006-04-27  2:27   ` Gerrit Huizenga
2006-04-27  2:46     ` Linus Torvalds
2006-04-27  3:00     ` David Woodhouse
2006-04-27  4:32       ` Gerrit Huizenga
2006-04-27  2:37   ` David Woodhouse
2006-04-27  2:59     ` Linus Torvalds
2006-04-27  3:17       ` David Woodhouse
2006-04-27  3:31         ` Linus Torvalds
2006-04-27  3:41           ` David Woodhouse
2006-04-27  7:10           ` Denis Vlasenko
2006-04-27  7:23             ` Arjan van de Ven
2006-04-27  8:49             ` Krzysztof Halasa
2006-04-27 11:03               ` Arnd Bergmann
2006-04-27 21:37           ` Adrian Bunk
2006-04-27 22:00             ` Linus Torvalds
2006-04-27 23:11               ` David Woodhouse
2006-04-27 23:12               ` Adrian Bunk [this message]
2006-04-28  0:01                 ` Linus Torvalds
2006-04-28  0:55                   ` David Woodhouse
2006-04-28 15:32                   ` Jan Engelhardt
2006-04-28 15:37                     ` David Woodhouse
2006-04-28 15:59                       ` Arjan van de Ven
2006-04-28 16:01                       ` Kyle Moffett
2006-04-29 10:33                         ` Krzysztof Halasa
2006-05-03  2:53                   ` H. Peter Anvin
2006-04-30  9:38               ` Peter Chubb
2006-04-30  9:59                 ` David Woodhouse
2006-04-30 21:48                   ` Peter Chubb
2006-04-27 15:05   ` David Woodhouse

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=20060427231200.GW3570@stusta.de \
    --to=bunk@stusta.de \
    --cc=akpm@osdl.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.