From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668AbbI2Uhp (ORCPT ); Tue, 29 Sep 2015 16:37:45 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34683 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbbI2Uhm (ORCPT ); Tue, 29 Sep 2015 16:37:42 -0400 Date: Tue, 29 Sep 2015 13:37:38 -0700 From: Brian Norris To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, David Woodhouse , Jens Axboe , Alexander Viro Subject: Re: [PATCH] mtd: provide proper 32/64-bit compat_ioctl() support for BLKPG Message-ID: <20150929203738.GN31505@google.com> References: <1440814356-52070-1-git-send-email-computersforpeace@gmail.com> <1442867219-147408-1-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1442867219-147408-1-git-send-email-computersforpeace@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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