From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748AbbJFNmt (ORCPT ); Tue, 6 Oct 2015 09:42:49 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34513 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752205AbbJFNmr (ORCPT ); Tue, 6 Oct 2015 09:42:47 -0400 Date: Tue, 6 Oct 2015 15:42:42 +0200 From: Ingo Molnar To: Linus Torvalds Cc: "H. Peter Anvin" , Dave Hansen , "Theodore Ts'o" , Andrew Morton , "linux-ext4@vger.kernel.org" , Linux Kernel Mailing List Subject: Re: [REGRESSION] 998ef75ddb and aio-dio-invalidate-failure w/ data=journal Message-ID: <20151006134242.GA13181@gmail.com> References: <20151005152236.GA8140@thunk.org> <5612A3F3.2040609@linux.intel.com> <20151006075652.GA11757@gmail.com> <20151006092757.GA27419@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Linus Torvalds wrote: > On Tue, Oct 6, 2015 at 10:27 AM, Ingo Molnar wrote: > > > >> > >> We really should try get rid of _all_ uses of the "__" versions unless they are > >> very locally and obviously checked with access_ok(). We've had way too many > >> cases where people thought they were clever, and weren't really. > > > > That's a good idea. > > > > The logistics worries me a bit: it looks like a major undertaking, considering the > > widespread use of these APIs in 1400+ call sites: > > Well, quite frankly, I think I'd be ok with just a mass conversion of the "__" > functions to non-underscore ones. > > From past experience, I don't think we have anything that really cares. The one > exception is probably the signal stack handling, because it really uses multiple > individual accesses, and so it is much more noticeable. > > And there should be *no* meaningful difference between the underscore version > and the non-underscore one, unless somebody does something really odd and > questionable (ie depends on a kernel pointer - which doesn't even work on all > architectures!). > > So I really think we could do a mass conversion of everything that isn't under > "arch/" (and obviously asm-generic/uaccess.h) in just one single go. > > I obviously wouldn't take that into 4.3, but I really don't think this would > merit splitting up into multiple patches either. > > Then, one by one, we might convert back to __get/put_user() when we've (a) added > the SMAP/PAN infrastructure (b) verified that there's an access_ok() > _right_there_ and (c) actually verified that it's performance-critical. > > I see drivers doing __get/put_user(), and it just makes me go "no". Not only are > drivers likely to get it wrong, I don't believe the extra couple of cycles is > going to matter compared to the cost of the hardware access itself. And if the > access_ok() isn't local and obviously in the *only* place that can possibly lead > to that code, then the code shouldn't use the underscore versions. Great, fully agreed and will implement it this way! Thanks, Ingo