From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754568AbcAEVNT (ORCPT ); Tue, 5 Jan 2016 16:13:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36394 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753101AbcAEVNM (ORCPT ); Tue, 5 Jan 2016 16:13:12 -0500 Date: Tue, 5 Jan 2016 16:13:10 -0500 From: Mike Snitzer To: Scotty Bauer Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org, agk@redhat.com Subject: Re: dm ioctl: Access user-land memory through safe functions. Message-ID: <20160105211310.GC30512@redhat.com> References: <565DE2B8.7040709@eng.utah.edu> <566720D0.8080509@eng.utah.edu> <20160105201649.GA30512@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160105201649.GA30512@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05 2016 at 3:16pm -0500, Mike Snitzer wrote: > On Tue, Dec 08 2015 at 1:26pm -0500, > Scotty Bauer wrote: > > > Friendly ping, is anyone interested in this? > > The passed @user argument is flagged via __user so it can be > deferenced directly. It does look like directly deferencing > user->version is wrong. > > But even if such indirect access is needed (because __user flag is only > applicable to @user arg, not the contained version member) we could more > easily just do something like this no?: > > uint32_t __user *versionp = (uint32_t __user *)user->version; > ... > if (copy_from_user(version, versionp, sizeof(version))) > return -EFAULT; > > I've staged the following, thanks: > https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.5&id=bffc9e237a0c3176712bcd93fc6a184a61e0df26 Alasdair helped me understand that we do need your original fix. I've staged it for 4.5 (and stable@) here: https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.5&id=ead3db62bf10fe143bec99e7b7ff370d7a6d23ef Thanks again, Mike