From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH] drm/i915: Add to_user_ptr() Date: Mon, 25 Feb 2013 12:58:01 +0200 Message-ID: <20130225105801.GQ4469@intel.com> References: <1361542371-28432-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 0713EE631E for ; Mon, 25 Feb 2013 02:58:04 -0800 (PST) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Andi Kleen Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Feb 22, 2013 at 12:16:58PM -0800, Andi Kleen wrote: > ville.syrjala@linux.intel.com writes: > = > > From: Ville Syrj=E4l=E4 > > > > to_user_ptr() simply casts a pointer passed as u64 from user space > > to void __user * correctly. Using this lets us get rid of all the > > tiresome casts. > = > The whole point of __user is to track it elsewhere to avoid mistakes, > which may result in security bugs. > = > A __user cast usually means your tracking is not complete, it's > supposed to be ugly so that you fix the tracking. Prettying > it defeats that point. > = > How about just changing the original field to a pointer and add > the __user there? That would introduce 32bit vs. 64bit issues. We pass all user space pointer as __u64 precisely to avoid such issues. -- = Ville Syrj=E4l=E4 Intel OTC