Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbbLEKAH (ORCPT ); Sat, 5 Dec 2015 05:00:07 -0500 Received: from asavdk3.altibox.net ([109.247.116.14]:34745 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753110AbbLEKAC (ORCPT ); Sat, 5 Dec 2015 05:00:02 -0500 Date: Sat, 5 Dec 2015 10:59:56 +0100 From: Sam Ravnborg To: "Shi, Yang" Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linaro-kernel@lists.linaro.org Subject: Re: [V2 PATCH] sparc64/gup: check address scope legitimacy Message-ID: <20151205095956.GA21826@ravnborg.org> References: <1448490684-17171-1-git-send-email-yang.shi@linaro.org> <1448491543-17946-1-git-send-email-yang.shi@linaro.org> <20151203203809.GA15235@ravnborg.org> <5660C0D4.8050800@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5660C0D4.8050800@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=bZvLKL7B c=1 sm=1 tr=0 a=Ij76tQDYWdb01v2+RnYW5w==:117 a=Ij76tQDYWdb01v2+RnYW5w==:17 a=7gkXJVJtAAAA:8 a=Git7GJnPAAAA:8 a=kj9zAlcOel0A:10 a=Q9mKvy7U8dv1JtBD720A:9 a=CjuIK1q_8ugA:10 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 34 > >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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/