linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] mtd: provide proper 32/64-bit compat_ioctl() support for BLKPG
Date: Tue, 29 Sep 2015 13:37:38 -0700	[thread overview]
Message-ID: <20150929203738.GN31505@google.com> (raw)
In-Reply-To: <1442867219-147408-1-git-send-email-computersforpeace@gmail.com>

On Mon, Sep 21, 2015 at 01:26:59PM -0700, Brian Norris wrote:
> After a bit of poking around wondering why my 32-bit user-space can't
> seem to send a proper ioctl(BLKPG) to an MTD on my 64-bit kernel
> (ARM64), I noticed that struct blkpg_ioctl_arg is actually pretty
> unsuitable for use in the ioctl() ABI, due to its use of raw pointers,
> and its lack of alignment/packing restrictions (32-bit arch'es tend to
> pack the 4 fields into 4 32-bit words, whereas 64-bit arch'es would add
> padding after the third int, and make this 6 32-bit words).
> 
> Anyway, this means BLKPG deserves some special compat_ioctl handling. Do
> the conversion in a small shim for MTD.
> 
> block/compat_ioctl.c already has compat support for the block subsystem,
> but it does so by a re-marshalling data to/from user-space (see
> compat_blkpg_ioctl()). Personally, I think this approach is cleaner.
> 
> Tested only on MTD, with an ARM32 user space on an ARM64 kernel.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> You can find the initial bug report / patch here:
> 
>   http://article.gmane.org/gmane.linux.kernel/2028927
>   https://lkml.org/lkml/2015/8/28/594
> 
> Changes since RFC:
>  * create new non-UAPI header, instead of cluttering the UAPI header with
>    compat stuff
>  * remove mention of "same bug in block/", since block/ solves this problem
>    already, just in a slightly different way

Pushed to l2-mtd.git

      reply	other threads:[~2015-09-29 20:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29  2:12 [RFC / BUG] mtd: provide proper 32/64-bit compat_ioctl() support for BLKPG Brian Norris
2015-08-31 18:01 ` Brian Norris
2015-09-21 20:26 ` [PATCH] " Brian Norris
2015-09-29 20:37   ` Brian Norris [this message]

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=20150929203738.GN31505@google.com \
    --to=computersforpeace@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).