linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Ankit Jain <me@ankitjain.org>,
	viro@zeniv.linux.org.uk, hch@infradead.org,
	linux-fsdevel@vger.kernel.org, mfasheh@suse.com,
	joel.becker@oracle.com, ocfs2-devel@oss.oracle.com,
	linux-kernel@vger.kernel.org, xfs-masters@oss.sgi.com,
	xfs@oss.sgi.com
Subject: Re: [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
Date: Fri, 30 Jan 2009 17:14:23 -0800	[thread overview]
Message-ID: <20090130171423.f99c88d0.akpm@linux-foundation.org> (raw)
In-Reply-To: <200901310138.34164.arnd@arndb.de>

On Sat, 31 Jan 2009 01:38:32 +0100 Arnd Bergmann <arnd@arndb.de> wrote:

> On Saturday 31 January 2009, Andrew Morton wrote:
> > On Thu, 29 Jan 2009 02:29:11 +0530 Ankit Jain <me@ankitjain.org> wrote:
> > > +struct space_resv {
> > > +	__s16		l_type;
> > > +	__s16		l_whence;
> > > +	__s64		l_start;
> > > +	__s64		l_len;		/* len == 0 means until end of file */
> > > +	__s32		l_sysid;
> > > +	__u32		l_pid;
> > > +	__s32		l_pad[4];	/* reserve area			    */
> > > +};
> > > +
> > > +#define F_IOC_RESVSP		_IOW('X', 40, struct space_resv)
> > > +#define F_IOC_RESVSP64		_IOW('X', 42, struct space_resv)
> > 
> > Are we sure that the aligment of l_start will be reliably the same
> > across all compilers and versions thereof for all time?
> 
> On x86, the alignment differs between 32 and 64 bit, otherwise it's ok.

Is this written in a standard somewhere?  Is it guaranteed?

If some (perhaps non-gcc) compiler were to lay this out differently
(perhaps with suitable command-line options) then that's liveable
with - as long as the kernel never changes the layout.  Of course
it would be better to avoid this if poss.

The other potential issue with a structure like this is that there's a
risk that it will lead us to copy four bytes of uninitialised kernel
memory out to userspace.

IOW, it seems a generally bad idea to rely upon compiler-added padding
for this sort of thing.

> XFS handles the conversion for compat_ioctl in
> fs/xfs/linux-2.6/xfs_ioctl32.c. If this becomes a generic file ioctl,
> the conversion code should be moved to fs/compat_ioctl.c.


  reply	other threads:[~2009-01-31  1:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 20:59 [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls Ankit Jain
2009-01-31  0:22 ` Andrew Morton
2009-01-31  0:38   ` Arnd Bergmann
2009-01-31  1:14     ` Andrew Morton [this message]
2009-01-31  1:48       ` Arnd Bergmann
2009-02-01  9:48         ` Boaz Harrosh
2009-02-01 10:05           ` Geert Uytterhoeven
2009-02-01 10:39             ` Boaz Harrosh
2009-02-01 10:59               ` Geert Uytterhoeven
2009-02-01 12:32                 ` Boaz Harrosh
2009-02-01 15:37                   ` [xfs-masters] " Eric Sandeen
2009-02-01 16:25                     ` Boaz Harrosh
2009-02-01 16:35                       ` Eric Sandeen
2009-02-01 16:41                         ` Christoph Hellwig
2009-02-01 16:57                           ` Boaz Harrosh
2009-02-02  0:31                             ` Arnd Bergmann
2009-02-02  8:29                               ` Boaz Harrosh
2009-02-02  8:45                                 ` Geert Uytterhoeven
2009-02-02  9:33                                   ` Boaz Harrosh
2009-02-02 20:51                                     ` Jamie Lokier
2009-02-03  7:31                                       ` Boaz Harrosh
2009-02-03 11:21                                         ` Jamie Lokier
2009-06-19 18:28 ` Christoph Hellwig
2009-06-20  8:13   ` Arnd Bergmann
2009-06-21 18:41     ` [xfs-masters] " Christoph Hellwig

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=20090130171423.f99c88d0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hch@infradead.org \
    --cc=joel.becker@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@ankitjain.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /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).