All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
@ 2019-12-04 16:28 Chris Wilson
  2019-12-04 16:52 ` Matthew Auld
  2019-12-04 23:14 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Wilson @ 2019-12-04 16:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson, Matthew Auld

From: Chris Wilson <ickle@braswell.alporthouse.com>

Call i915_user_extensions() to validate the arg->extensions pointer, and
so return consistent error numbers for the future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index 37aabbfa869a..3a3f30bc8ac7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -17,6 +17,7 @@
 #include "i915_gem_object.h"
 #include "i915_gem_mman.h"
 #include "i915_trace.h"
+#include "i915_user_extensions.h"
 #include "i915_vma.h"
 
 static inline bool
@@ -617,9 +618,12 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_private *i915 = to_i915(dev);
 	struct drm_i915_gem_mmap_offset *args = data;
 	enum i915_mmap_type type;
+	int err;
 
-	if (args->extensions)
-		return -EINVAL;
+	err = i915_user_extensions(u64_to_user_ptr(args->extensions),
+				   NULL, 0, NULL);
+	if (err)
+		return err;
 
 	switch (args->flags) {
 	case I915_MMAP_OFFSET_GTT:
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
  2019-12-04 16:28 [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL Chris Wilson
@ 2019-12-04 16:52 ` Matthew Auld
  2019-12-04 17:24   ` Chris Wilson
  2019-12-04 23:14 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Auld @ 2019-12-04 16:52 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Chris Wilson, Intel Graphics Development, Matthew Auld

On Wed, 4 Dec 2019 at 16:29, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> From: Chris Wilson <ickle@braswell.alporthouse.com>
>
> Call i915_user_extensions() to validate the arg->extensions pointer, and
> so return consistent error numbers for the future.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_mman.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index 37aabbfa869a..3a3f30bc8ac7 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -17,6 +17,7 @@
>  #include "i915_gem_object.h"
>  #include "i915_gem_mman.h"
>  #include "i915_trace.h"
> +#include "i915_user_extensions.h"
>  #include "i915_vma.h"
>
>  static inline bool
> @@ -617,9 +618,12 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
>         struct drm_i915_private *i915 = to_i915(dev);
>         struct drm_i915_gem_mmap_offset *args = data;
>         enum i915_mmap_type type;
> +       int err;
>
> -       if (args->extensions)
> -               return -EINVAL;
> +       err = i915_user_extensions(u64_to_user_ptr(args->extensions),
> +                                  NULL, 0, NULL);
> +       if (err)
> +               return err;

Don't we have to check get_user first on the ptr?

>
>         switch (args->flags) {
>         case I915_MMAP_OFFSET_GTT:
> --
> 2.24.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
  2019-12-04 16:52 ` Matthew Auld
@ 2019-12-04 17:24   ` Chris Wilson
  2019-12-04 17:58     ` Matthew Auld
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2019-12-04 17:24 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Chris Wilson, Intel Graphics Development, Matthew Auld

Quoting Matthew Auld (2019-12-04 16:52:12)
> On Wed, 4 Dec 2019 at 16:29, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > From: Chris Wilson <ickle@braswell.alporthouse.com>
> >
> > Call i915_user_extensions() to validate the arg->extensions pointer, and
> > so return consistent error numbers for the future.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gem_mman.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > index 37aabbfa869a..3a3f30bc8ac7 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > @@ -17,6 +17,7 @@
> >  #include "i915_gem_object.h"
> >  #include "i915_gem_mman.h"
> >  #include "i915_trace.h"
> > +#include "i915_user_extensions.h"
> >  #include "i915_vma.h"
> >
> >  static inline bool
> > @@ -617,9 +618,12 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
> >         struct drm_i915_private *i915 = to_i915(dev);
> >         struct drm_i915_gem_mmap_offset *args = data;
> >         enum i915_mmap_type type;
> > +       int err;
> >
> > -       if (args->extensions)
> > -               return -EINVAL;
> > +       err = i915_user_extensions(u64_to_user_ptr(args->extensions),
> > +                                  NULL, 0, NULL);
> > +       if (err)
> > +               return err;
> 
> Don't we have to check get_user first on the ptr?

No, it's checked by i915_user_extensions(). It's a bit redundant in the
other callers :) Since the first thing we do is while (ext).

I have some memory of starting out with NULL being an error for
i915_user_extensions, but we settled on while(ext) for a compact
non-recursive loop.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
  2019-12-04 17:24   ` Chris Wilson
@ 2019-12-04 17:58     ` Matthew Auld
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Auld @ 2019-12-04 17:58 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Chris Wilson, Intel Graphics Development, Matthew Auld

On Wed, 4 Dec 2019 at 17:24, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Matthew Auld (2019-12-04 16:52:12)
> > On Wed, 4 Dec 2019 at 16:29, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > >
> > > From: Chris Wilson <ickle@braswell.alporthouse.com>
> > >
> > > Call i915_user_extensions() to validate the arg->extensions pointer, and
> > > so return consistent error numbers for the future.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> > > Cc: Matthew Auld <matthew.auld@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/gem/i915_gem_mman.c | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > > index 37aabbfa869a..3a3f30bc8ac7 100644
> > > --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > > +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> > > @@ -17,6 +17,7 @@
> > >  #include "i915_gem_object.h"
> > >  #include "i915_gem_mman.h"
> > >  #include "i915_trace.h"
> > > +#include "i915_user_extensions.h"
> > >  #include "i915_vma.h"
> > >
> > >  static inline bool
> > > @@ -617,9 +618,12 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
> > >         struct drm_i915_private *i915 = to_i915(dev);
> > >         struct drm_i915_gem_mmap_offset *args = data;
> > >         enum i915_mmap_type type;
> > > +       int err;
> > >
> > > -       if (args->extensions)
> > > -               return -EINVAL;
> > > +       err = i915_user_extensions(u64_to_user_ptr(args->extensions),
> > > +                                  NULL, 0, NULL);
> > > +       if (err)
> > > +               return err;
> >
> > Don't we have to check get_user first on the ptr?
>
> No, it's checked by i915_user_extensions(). It's a bit redundant in the
> other callers :) Since the first thing we do is while (ext).
>
> I have some memory of starting out with NULL being an error for
> i915_user_extensions, but we settled on while(ext) for a compact
> non-recursive loop.

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
  2019-12-04 16:28 [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL Chris Wilson
  2019-12-04 16:52 ` Matthew Auld
@ 2019-12-04 23:14 ` Patchwork
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-12-04 23:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
URL   : https://patchwork.freedesktop.org/series/70450/
State : failure

== Summary ==

Applying: drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/i915/gem/i915_gem_mman.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-04 23:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 16:28 [Intel-gfx] [PATCH] drm/i915/gem: Hook user-extensions upto MMAP_OFFSET_IOCTL Chris Wilson
2019-12-04 16:52 ` Matthew Auld
2019-12-04 17:24   ` Chris Wilson
2019-12-04 17:58     ` Matthew Auld
2019-12-04 23:14 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.