[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAF6AEGt8ziZ3tHG9A-xg3_yK_ssOmVWM56zHiUs2pvQJvVYmzQ@mail.gmail.com>
Date: Fri, 30 Nov 2018 10:28:30 -0500
From: Rob Clark <robdclark@...il.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: dri-devel <dri-devel@...ts.freedesktop.org>,
Jordan Crouse <jcrouse@...eaurora.org>,
David Airlie <airlied@...ux.ie>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
freedreno <freedreno@...ts.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] drm/msm: rework GEM_INFO ioctl
On Fri, Nov 30, 2018 at 10:14 AM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Fri, Nov 30, 2018 at 4:02 PM Rob Clark <robdclark@...il.com> wrote:
> >
>
> > -
> > -#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
> > +/* Get or set GEM buffer info. The requested value can be passed
> > + * directly in 'value', or for data larger than 64b 'value' is a
> > + * pointer to userspace buffer, with 'len' specifying the number of
> > + * bytes copied into that buffer. For info returned by pointer,
> > + * calling the GEM_INFO ioctl with null 'value' will return the
> > + * required buffer size in 'len'
> > + */
> > +#define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */
> > +#define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */
> >
> > struct drm_msm_gem_info {
> > __u32 handle; /* in */
> > - __u32 flags; /* in - combination of MSM_INFO_* flags */
> > - __u64 offset; /* out, mmap() offset or iova */
> > + __u32 info; /* in - one of MSM_INFO_* */
> > + __u64 value; /* in or out */
> > + __u32 len; /* in or out */
> > };
>
> As structure with implicit padding has the problem of possibly leaking
> kernel stack data. It's better to make the padding explicit here so you
> can zero it from the kernel. Also, as I mentioned in the other patch,
> you probably need a new data structure and ioctl command number
> to keep compatiblity with the old interface.
hmm, right, pad field is a good idea. As far as compat, drm_ioctl()
handles zero-padding so adding new ioctl struct members at the end is
safe (as long as a zero value somehow results in previous behavior)
BR,
-R
>
> Arnd
Powered by blists - more mailing lists