public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Emil Velikov <emil.l.velikov@gmail.com>,
	Cc Ma <cc.ma@mediatek.com>,
	Pascal Brand <pascal.brand@linaro.org>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Dan Caprita <dan.caprita@windriver.com>,
	Zoltan Kuscsik <zoltan.kuscsik@linaro.org>,
	Joakim Bech <joakim.bech@linaro.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [PATCH v7 1/3] create SMAF module
Date: Tue, 17 May 2016 17:40:03 +0200	[thread overview]
Message-ID: <20160517154002.GS27098@phenom.ffwll.local> (raw)
In-Reply-To: <CA+M3ks56F61k9NPs18eYTmvNkUGmeytLQRENHVgv1ZYUGtW9Gw@mail.gmail.com>

On Tue, May 17, 2016 at 03:50:41PM +0200, Benjamin Gaignard wrote:
> 2016-05-17 0:58 GMT+02:00 Emil Velikov <emil.l.velikov@gmail.com>:
> > On 9 May 2016 at 16:07, Benjamin Gaignard <benjamin.gaignard@linaro.org> wrote:
> >> + * @fd:                returned file descriptor
> >> + */
> >> +struct smaf_create_data {
> >> +       size_t length;
> >> +       unsigned int flags;
> >> +       char name[ALLOCATOR_NAME_LENGTH];
> >> +       int fd;
> > The structs here feels quite fragile. Please read up on Daniel
> > Vetter's "Botching up ioctls" [1]. Personally I find pahole quite
> > useful is such process.
> >
> if I describe the structures like this:
> /**
>  * struct smaf_create_data - allocation parameters
>  * @length: size of the allocation
>  * @flags: flags passed to allocator
>  * @name_len: length of name
>  * @name: name of the allocator to be selected, could be NULL
>  * @fd: returned file descriptor
>  */
> struct smaf_create_data {
> size_t length;
> unsigned int flags;
> size_t name_len;
> char __user *name;
> int fd;
> char padding[44];
> };
> 
> does it sound more robust for you ?
> 
> > Hopefully I haven't lost the plot with the above, if I had don't be
> > shy to point out.
> >
> > Thanks,
> > Emil
> >
> > [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/ioctl/botching-up-ioctls.txt

Please read this doc in it's entirety, ask on irc if you don't get certain
parts. Then come back an rework your patch.

Super short summary: _All_ the types you've used are absolute no-go in
ioctl structs.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-05-17 15:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09 15:07 [PATCH v7 0/3] Secure Memory Allocation Framework Benjamin Gaignard
2016-05-09 15:07 ` [PATCH v7 1/3] create SMAF module Benjamin Gaignard
2016-05-16 22:58   ` Emil Velikov
2016-05-17 13:50     ` Benjamin Gaignard
2016-05-17 15:40       ` Daniel Vetter [this message]
2016-05-17 19:04       ` Emil Velikov
2016-05-17 21:29         ` Daniel Vetter
2016-05-17 21:36           ` Emil Velikov
2016-05-09 15:07 ` [PATCH v7 2/3] SMAF: add CMA allocator Benjamin Gaignard
2016-05-16 23:05   ` Emil Velikov
2016-05-17 14:55     ` Benjamin Gaignard
2016-05-09 15:07 ` [PATCH v7 3/3] SMAF: add fake secure module Benjamin Gaignard
2016-05-16 23:10   ` Emil Velikov
2016-05-17 15:17     ` Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160517154002.GS27098@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=benjamin.gaignard@linaro.org \
    --cc=cc.ma@mediatek.com \
    --cc=dan.caprita@windriver.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=joakim.bech@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pascal.brand@linaro.org \
    --cc=zoltan.kuscsik@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox