Re: [PATCH] linux-2.5.43_vsyscall_A0

Andrea Arcangeli (andrea@suse.de)
Tue, 22 Oct 2002 07:08:48 +0200


On Tue, Oct 22, 2002 at 06:15:24AM +0200, Andi Kleen wrote:
> > > My problem is that mapping user code into the vsyscall fixmap is
> > > complex and not very clean at all, breaks various concepts in the mm
> > > and last but not the least it is slow
> >
> > Can you explain, in small words, why mapping user code is so horrible?
>
> Currently Linux has neatly separated kernel and user page tables.
> On architectures which have tree type tables in hardware you just have
> a user level table and you stick a pointer to the kernel level tables
> somewhere at the end of the first page. The normal user level page
> handling doesn't know about the kernel pages. The vsyscall code is in
> the kernel mapping in the fixmaps. Allowing the user to map arbitary
> pages into the vsyscall area would blur this clear separation and
> require much more special case handling.
>
> In addition it would break a lot of assumptions that user mappings are
> only < __PAGE_OFFSET, probably having security implications. For example
> you would need to special case this in uaccess.h's access_ok(), which
> would be quite a lot of overhead (any change to this function causes
> many KB of binary bloat because *_user is so heavily used all over the kernel)

that's not the problem. you would use get_user_pages to pin the page,
after that such a page it's like a normal plain kernel page allocated
with GFP_KERNEL provided that you never write to it (that's fine, it's
mapped readonly like the regular vsyscall page) and that you don't
pretend it to be constant (again that's fine since if uml changes it
under itself that's its own problem ;). It's not *that* messy as
breaking the whole copy-user concept. See my other email for more
details on this issue.

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