Re: [V2 PATCH] sparc64/gup: check address scope legitimacy

From: Sam Ravnborg
Date: Sat Dec 05 2015 - 05:00:23 EST


> >access_ok() always returns 1.
>
> Thanks for pointing it out. And, I didn't notice that gup is just built for
> SPARC64. I though it is built by both 64 bit and 32 bit.
>
> A follow-up question, is there any reason to just have sparc specific fast
> gup for 64 bit not for 32 bit?
I do not know - sorry.

> >>@@ -203,6 +206,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
> >> addr = start;
> >> len = (unsigned long) nr_pages << PAGE_SHIFT;
> >> end = start + len;
> >>+ if (end < start)
> >>+ goto slow_irqon;
> >
> >end can only be smaller than start if there is some overflow.
> >See how end is calculated just the line above.
> >
> >This looks like a highly suspicious change.
>
> I'm supposed this is used to protect the overflow. I copied the code from
> other arch. Actually, every arch has this except sparc.
The the other archs are likely confused as well - there is most
likely some history behind that can be found if digging a little.

The code is not present in the generic version.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/