Re: [mingo@elte.hu: [git pull] headers_check fixes]

From: Linus Torvalds
Date: Tue Jan 27 2009 - 18:43:59 EST




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
--
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/