All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalpak Shah <kalpak@clusterfs.com>
To: Theodore Tso <tytso@mit.edu>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>,
	Andreas Dilger <adilger@clusterfs.com>
Subject: Re: [PATCH] Endianness bugs in e2fsck
Date: Mon, 25 Jun 2007 13:43:59 +0530	[thread overview]
Message-ID: <1182759239.6016.8.camel@garfield> (raw)
In-Reply-To: <20070623003646.GD22889@thunk.org>

On Fri, 2007-06-22 at 20:36 -0400, Theodore Tso wrote:
> On Wed, Jun 20, 2007 at 03:03:08PM +0530, Kalpak Shah wrote:
> > In ext2fs_swap_inode_full() only the first (GOOD_OLD_INODE_SIZE +
> > i_extra_isize)bytes are copied into inode. The rest of the inode is
> > not zeroed. So memset the inode to zero if swapfs is enabled. 
> 
> This was due to the bug where we weren't dealing with the i_extra_size
> correctly, right?  ext2fs_swap_inode_full *should* be swapping the
> extra fields and copying it into the inode.  If not, that's should be
> the real bug, and adding the memset(inode, 0, bufset) doesn't seem to
> be useful.
> 
> Am I missing something?

Hi Ted,

In e2fsck_pass1(), a buffer is allocated for the scratch inode,
inode = (struct ext2_inode *) e2fsck_allocate_memory(ctx, inode_size,   
						"scratch inode");

Now on big-endian systems, while swapping, ext2fs_swap_inode_full()
swaps only 128+extra_isize bytes and the EAs if they are present. Now if
inode N has EAs, (and this is the inode in the "scratch inode") then
inode N+1 also carries seems to have them since the "scratch inode" was
never zeroed. In ext2fs_swap_inode_full(), this occurs:

        if (ext2fs_swab32(*eaf) != EXT2_EXT_ATTR_MAGIC)
                return; /* it seems no magic here */

So as I said only the first 128+extra_isize bytes are actually copied
into the *to* inode.

Thanks,
Kalpak.

> 
> 						- Ted

  reply	other threads:[~2007-06-25  8:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20  9:33 [PATCH] Endianness bugs in e2fsck Kalpak Shah
2007-06-20 15:09 ` Theodore Tso
2007-06-20 19:36   ` Kalpak Shah
2007-06-22 22:20 ` Theodore Tso
2007-06-22 23:54   ` Theodore Tso
2007-06-23  2:34     ` Theodore Tso
2007-06-23  0:36 ` Theodore Tso
2007-06-25  8:13   ` Kalpak Shah [this message]
2007-07-17 21:19 ` Eric Sandeen
2007-07-18  1:40   ` Eric Sandeen
2007-07-18  7:04     ` Kalpak Shah

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=1182759239.6016.8.camel@garfield \
    --to=kalpak@clusterfs.com \
    --cc=adilger@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.