lkml.org 
[lkml]   [2011]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC] fixing the UML failure root cause
On Wed, Oct 12, 2011 at 11:19 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Wed, Oct 12, 2011 at 5:24 AM, Andrew Lutomirski <luto@mit.edu> wrote:
>>
>> So here's a different approach.  It's not perfect: it always blames
>> SEGV_MAPERR instead of SEGV_ACCERR.  I implemented it for vgettimeofday
>> but not the other two vsyscalls.
>>
>> What do you think of this approach?  If it seems good, I'll finish the
>> patch and submit it.
>
> I think the approach is valid, but you should *not* do this as some
> kind of crazy byte-by-byte copy_to_user() emulation.
>
> Do the "copy tz to user mode" as individual "put_user()" calls for
> tv_sec/tv_usec/timezone. IOW, there are three words being written to
> user mode, not "two memcpy's".

How does that work? The tricky case is when one of those three words
spans a page boundary if the access to the first page is valid, but
the access to the second page is not. When that happens, if we report
the fault as coming from the first page, then UML is likely to get
think the fault was spurious and enter an infinite loop.

To handle that case, I'll need 4- and 8- byte versions of put_user_sig
(IIRC vgetcpu uses unsigneds) that check whether their destinations
span page boundaries and complain accordingly, which will end up as
more code than I have now.

--Andy

>
> Other than that, there doesn't seem to be anything wrong.
>
>            Linus
>
--
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/

\
 
 \ /
  Last update: 2011-10-13 10:43    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site