linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	David Woodhouse <dwmw2@ZenIV.linux.org.uk>
Subject: Re: [PATCH] vfs: move ACL cache lookup into generic code
Date: Sat, 23 Jul 2011 23:38:09 +0100	[thread overview]
Message-ID: <20110723223809.GL24703@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20110723215337.GK24703@ZenIV.linux.org.uk>

On Sat, Jul 23, 2011 at 10:53:37PM +0100, Al Viro wrote:
> 	That's about it - shouldn't be a problem to switch mode_t in ABI to
> __kernel_mode_t (equivalent, since mode_t is typedefed to __kernel_mode_t)
> and we are free to do whatever we want with internal mode_t.  I suspect
> that starting with centralized typedef for umode_t (always u16) it wouldn't
> take much to drive all internal uses to umode_t (or size_t, in at least one
> case ;-), then replace all remaining (part of ABI) instances with
> __kernel_mode_t and rename umode_t to mode_t.  I'll try to put such a series
> together tonight; will push to #mode_t once done...

And that has immediately caught a lovely bug on jffs2 with ACLs - any
big-endian platform with 16bit mode_t is fucked, since we have
jffs2_new_inode(..., int mode, ...) do
        ret = jffs2_init_acl_pre(dir_i, inode, &mode);
The latter expects int *, which is what it gets.  The it explicitly casts
that to mode_t * and passes to posix_acl_create_masq() (directly in current
mainline, through posix_acl_create() in #untested).  Back in jffs2_new_inode()
we use the damn thing afterwards.  Moreover, posix_acl_create_masq() uses
the value pointed to by mode_t * it gets.  And expects normal S_IF... in
it.

IOW, on sparc32 (at least) it's screwed - it'll see 0 what's actually upper
16 bits of jffs2_new_inode() mode argument instead of what should've seen
(the lower 16 bits).  It will leave them 0, so the caller won't notice anything
weird going on, but ACL will be buggered and mode won't be adjusted.

Also screwed: avr32, frv, h8300, m68k, parisc, s390 and, in their big-endian
variants, arm, m32r, microblaze and sh.

Fucked-up-by: commit cfc8dc6f6f69ede939e09c2af06a01adee577285

      reply	other threads:[~2011-07-23 22:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 17:37 VFS pathname walking cleanups (i_op and ACL access) Linus Torvalds
2011-07-22 17:37 ` [PATCH 1/2] VFS: Cut down inode->i_op->xyz accesses in path walking Linus Torvalds
2011-07-22 17:47   ` Christoph Hellwig
2011-07-22 23:40   ` Al Viro
2011-07-22 23:54     ` Linus Torvalds
2011-07-23  3:55   ` [PATCH] " Linus Torvalds
2011-07-23 13:35     ` Christoph Hellwig
2011-07-23 14:46       ` Al Viro
2011-07-23 14:51         ` Christoph Hellwig
2011-07-23 15:45         ` Linus Torvalds
     [not found]     ` <alpine.LFD.2.02.1107251852220.13796@i5.linux-foundation.org>
2011-07-26  3:05       ` Al Viro
2011-07-26  3:23         ` Linus Torvalds
2011-07-26 18:41           ` Al Viro
2011-07-26 18:45             ` Linus Torvalds
2011-08-07  6:06           ` Linus Torvalds
2011-08-07  6:51             ` Al Viro
2011-08-07 23:43               ` Linus Torvalds
2011-07-22 17:40 ` VFS pathname walking cleanups (i_op and ACL access) Christoph Hellwig
2011-07-22 17:45 ` [PATCH 2/2] vfs: move ACL cache lookup into generic code Linus Torvalds
2011-07-22 17:50   ` Christoph Hellwig
2011-07-22 17:54     ` Linus Torvalds
2011-07-23  2:34   ` [PATCH] " Linus Torvalds
2011-07-23  3:29     ` Al Viro
2011-07-23  3:42       ` Linus Torvalds
2011-07-23  4:31         ` Al Viro
2011-07-23  6:06           ` Al Viro
2011-07-25  8:15             ` Aneesh Kumar K.V
2011-07-25  8:16           ` Aneesh Kumar K.V
2011-07-23  7:47       ` Al Viro
2011-07-23 14:50         ` Christoph Hellwig
2011-07-23 15:32           ` Al Viro
2011-07-23 17:02             ` Al Viro
2011-07-23 17:31               ` Linus Torvalds
2011-07-23 18:20                 ` Al Viro
2011-07-23 18:29                   ` Linus Torvalds
2011-07-23 21:53                     ` Al Viro
2011-07-23 22:38                       ` Al Viro [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=20110723223809.GL24703@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dwmw2@ZenIV.linux.org.uk \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).