[Intel-gfx] [PATCH] drm/i915: Add to_user_ptr()
Ville Syrjälä
ville.syrjala at linux.intel.com
Mon Feb 25 11:58:01 CET 2013
On Fri, Feb 22, 2013 at 12:16:58PM -0800, Andi Kleen wrote:
> ville.syrjala at linux.intel.com writes:
>
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > 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älä
Intel OTC
More information about the Intel-gfx
mailing list