Messages in this thread | | | Date | Tue, 27 Jan 2009 15:43:29 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: [: [git pull] headers_check fixes] |
| |
On Wed, 28 Jan 2009, Ingo Molnar wrote: > > It would be much better if we exported _much_ less and reduced our > cross-section to user-space. Also, the include/linux/Kbuild rules are all > but transparent: it would also be nice if whatever we exported was be > visible straight in the header itself, to make it obvious to people who > modify/extend those files that those definitions are going to be exported > to user-space. > > Some __user_export tag on structures perhaps? I have no good ideas here - > #ifdefs are ugly and tags obscure the purity of the code.
I agree, and we probably could do so with some sparse extension (just make the rule be that in order to make a __user pointer, the base type needs to have been tagged with __user_visible). So we _could_ do something like that, and have a sane checking model where sparse would warn if it sees a user pointer of something that wasn't marked as being a user-visible type.
But I doubt it's really worth it. A lot of the usage cases for users end up being about constants etc that we really can't check sanely and automatically. And some historical user-space usage is literally just about user space finding the kernel headers really helpful (ie using the list.h headers for user-space lists, or the inline asms for atomic stuff for threaded apps that don't rely on ptrace locking).
Linus
| |