lkml.org 
[lkml]   [2016]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 02/11] mm: Hardened usercopy
From
Date
On Fri, 2016-07-15 at 09:20 +1000, Balbir Singh wrote:

> > ==
> > +    ((unsigned long)end & (unsigned
> > long)PAGE_MASK)))
> > + return NULL;
> > +
> > + /* Allow if start and end are inside the same compound
> > page. */
> > + endpage = virt_to_head_page(end);
> > + if (likely(endpage == page))
> > + return NULL;
> > +
> > + /* Allow special areas, device memory, and sometimes
> > kernel data. */
> > + if (PageReserved(page) && PageReserved(endpage))
> > + return NULL;
>
> If we came here, it's likely that endpage > page, do we need to check
> that only the first and last pages are reserved? What about the ones
> in
> the middle?

I think this will be so rare, we can get away with just
checking the beginning and the end.

--

All Rights Reversed.[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-07-15 03:21    [W:0.094 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site