lkml.org 
[lkml]   [2013]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: unify copy_from_user() checking
>>> On 17.10.13 at 17:45, Arjan van de Ven <arjan@linux.intel.com> wrote:
> for me, the value of the feature overall is this range checking, not the
> fixed size part.
> for fixed size... the chance of the programmer getting it wrong is near
> zero.
> the chance of getting one of the checks wrong is much higher
> (we've had cases of wrong sign in the checks, off by ones in the checks etc)
> and that is what it was supposed to find.
> If that's not possible due practical issues (like the inline case above but
> more
> the compiler practicalities).... removing the warning part entirely is
> likely just better.

But it would at least cover the case where, for some pointer,
someone mixes up sizeof(ptr) and sizeof(*ptr). So I think - it
being cheap - the current constant size check could stay, ...

> Having a runtime check for the case where the argument is not constant but
> we know the buffer
> size... is likely still clear value... cheap (perfect branch prediction
> unless disaster hits!)
> and the failure case is obviously the disaster case.

... and the non-constant case be taken care of at run time.
That's precisely what the patch does.

Jan



\
 
 \ /
  Last update: 2013-10-17 18:21    [W:0.038 / U:11.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site