lkml.org 
[lkml]   [2008]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Fix copy_user on x86_64
Date
Linus Torvalds <torvalds@linux-foundation.org> writes:

>> This is the patch patch for copy_user routine, you've discussed recently.
>
> I don't think it works right.
>
> Isn't this same routine also used for copy_in_user()? For that case both
> source _and_ destination can fault, but your fixup routines assume that
> onle one of them does (ie the fixup for a load-fault does a store for the
> previously loaded valies, and assumes that it doesn't trap)

Right. I've missed it... :(

> Also, I'd realy rather do this all by handling the "taul" case in C. We
> already effectively have _half_ that support: the "clear end" flag ends up
> calling our specialized memset() routine, but it would be much nicer if
> we:
>
> - extended the "clear end" flag to be not just "clear end", but also
> which direction things are going.
> - always call a (fixed) fixup-routine that is written in C (because
> performance on a cycle basis no longer matters) that gets the remaining
> length and the source and destination as arguments, along with the
> "clear and direction flag".
> - make that fixup routine do the byte-exact tests and any necessary
> clearing (and return the possibly-fixed-up remaining length).
>
> Notice how this way we still have _optimal_ performance for the case where
> no fault happens, and we don't need any complex fixups in assembly code at
> all - the only thing the asm routines need to do is to get the right
> length (we already have this) and fix up the source/dest pointers (we
> don't generally have this, although the zero-at-end fixes up the
> destination pointer in order to zero it, of course).
>
> Hmm?

Seems reasonable. However, we still need specialized memset() routine,
because, again, destination can fail. Thanks for the review, Linus!
--
wbr, Vitaly


\
 
 \ /
  Last update: 2008-06-26 18:01    [W:0.046 / U:0.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site