lkml.org 
[lkml]   [2018]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mm/usercopy: Use memory range to be accessed for wraparound check
From
Date


> On Nov 14, 2018, at 10:32 AM, isaacm@codeaurora.org wrote:
>
> Thank you and David for your feedback. The check_bogus_address() routine is only invoked from one place in the kernel, which is __check_object_size(). Before invoking check_bogus_address, __check_object_size ensures that n is non-zero, so it is not possible to call this routine with n being 0. Therefore, we shouldn't run into the scenario you described. Also, in the case where we are copying a page's contents into a kernel space buffer and will not have that buffer interacting with userspace at all, this change to that check should still be valid, correct?

Having fixed more than one bug resulting from a "only called in one place" routine later being called elsewhere,
I am wary, but ultimately it's likely not worth the performance hit of a check or BUG_ON().

It's a generic math check for overflow, so it should work with any address.

Reviewed-by: William Kucharski <william.kucharski@oracle.com>
\
 
 \ /
  Last update: 2018-11-14 23:51    [W:0.065 / U:3.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site