On Sat, Jun 24, 2017 at 11:20:00AM +1000, Jonathan Gray wrote:
> On Sat, Jun 24, 2017 at 03:00:19AM +0200, Mark Kettenis wrote:
> > The code doesn't fully initialize the structure, which was extended to
> > include a flags member at some point. Since the pending inteldrm
> > update uses that flags member, the DRM_IOCTL_I915_GEM_MMAP ioctl
> > starts randomly failing because the flags member contains stack
> > garbage. The diff below fixes this.
> >
> > Upstream has fixed this in a different way that is unfortunately
> > incompatible with the way we do ioctls on OpenBSD.
> >
> > ok?
>
> Isn't this already initialised by the VG_CLEAR?
>
> #define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s)))
>
> 6017 retry:
> 6018 VG_CLEAR(mmap_arg);
> 6019 mmap_arg.handle = bo->handle;
> 6020 mmap_arg.offset = 0;
> 6021 mmap_arg.size = bytes(bo);
missed the other macro
ifdef HAVE_VALGRIND
#define VG(x) x
#else
#define VG(x)
#endif
ok jsg@
>
> >
> >
> > Index: driver/xf86-video-intel/src/sna/kgem.c
> > ===================================================================
> > RCS file: /cvs/xenocara/driver/xf86-video-intel/src/sna/kgem.c,v
> > retrieving revision 1.4
> > diff -u -p -r1.4 kgem.c
> > --- driver/xf86-video-intel/src/sna/kgem.c 12 Apr 2015 19:42:06 -0000
> > 1.4
> > +++ driver/xf86-video-intel/src/sna/kgem.c 24 Jun 2017 00:56:02 -0000
> > @@ -6019,6 +6019,7 @@ retry:
> > mmap_arg.handle = bo->handle;
> > mmap_arg.offset = 0;
> > mmap_arg.size = bytes(bo);
> > + mmap_arg.flags = 0;
> > if ((err = do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg))) {
> > assert(err != EINVAL);
> >
> >
>