mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: Jeff Mahoney <jeffm@suse.com>
Cc: Bernd Schubert <bernd-schubert@gmx.de>,
	Chris Wright <chrisw@sous-sol.org>,
	John M Flinchbaugh <john@hjsoft.com>,
	reiserfs-list@namesys.com, Sam Vilain <sam@vilain.net>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.15 Bug? New security model?
Date: Sun, 12 Feb 2006 22:21:15 +0300	[thread overview]
Message-ID: <20060212192115.GB8544@procyon.home> (raw)
In-Reply-To: <20060212175740.GB8805@locomotive.unixthugs.org>

[-- Attachment #1: Type: text/plain, Size: 3592 bytes --]

On Sun, Feb 12, 2006 at 12:57:40PM -0500, Jeff Mahoney wrote:
> diff -ruNpX dontdiff linux-2.6.15/fs/reiserfs/inode.c linux-2.6.15-reiserfs/fs/reiserfs/inode.c
> --- linux-2.6.15/fs/reiserfs/inode.c	2006-02-06 19:54:10.000000000 -0500
> +++ linux-2.6.15-reiserfs/fs/reiserfs/inode.c	2006-02-12 12:43:00.000000000 -0500
> @@ -1195,6 +1195,7 @@ static void init_inode(struct inode *ino
>  		/* nopack is initially zero for v1 objects. For v2 objects,
>  		   nopack is initialised from sd_attrs */
>  		REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
> +		REISERFS_I(inode)->i_attrs = 0;

This part of the patch works fine for my test case - no more bogus
attributes, even when mounting with the "attrs" option.

>  	} else {
>  		// new stat data found, but object may have old items
>  		// (directories and symlinks)
> diff -ruNpX dontdiff linux-2.6.15/fs/reiserfs/super.c linux-2.6.15-reiserfs/fs/reiserfs/super.c
> --- linux-2.6.15/fs/reiserfs/super.c	2006-02-06 19:54:27.000000000 -0500
> +++ linux-2.6.15-reiserfs/fs/reiserfs/super.c	2006-02-12 12:48:41.000000000 -0500
> @@ -1121,7 +1121,9 @@ static void handle_attrs(struct super_bl
>  					 "reiserfs: cannot support attributes until flag is set in super-block");
>  			REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
>  		}
> -	} else if (le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared) {
> +	} else if (le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared &&
> +	           get_inode_item_key_version(s->s_root->d_inode) == KEY_FORMAT_3_6) {
> +		/* Enable attrs by default on v3.6-native file systems */
>  		REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ATTRS);
>  	}
>  }

This part, however, does not work - apparently the condition is never
true, even on a freshly created 3.6-format filesystem:

# mkreiserfs --format 3.6 -f tmp2.img
# mount -t reiserfs -o loop tmp2.img /mnt/disk/
# lsattr -d /mnt/disk/
lsattr: Inappropriate ioctl for device While reading flags on /mnt/disk/


Apparently directories always have old key format, even on new
filesystems:

	if (old_format_only(sb) || S_ISDIR(mode) || S_ISLNK(mode))
		set_inode_item_key_version(inode, KEY_FORMAT_3_5);
	else
		set_inode_item_key_version(inode, KEY_FORMAT_3_6);

However, checking the stat data format works:

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index b33d67b..a2ea7ed 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1195,6 +1195,7 @@ static void init_inode(struct inode *ino
 		/* nopack is initially zero for v1 objects. For v2 objects,
 		   nopack is initialised from sd_attrs */
 		REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
+		REISERFS_I(inode)->i_attrs = 0;
 	} else {
 		// new stat data found, but object may have old items
 		// (directories and symlinks)
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index ef5e541..acafe32 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1124,7 +1124,9 @@ static void handle_attrs(struct super_bl
 					 "reiserfs: cannot support attributes until flag is set in super-block");
 			REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
 		}
-	} else if (le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared) {
+	} else if ((le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared) &&
+		(get_inode_sd_version(s->s_root->d_inode) == STAT_DATA_V2)) {
+		/* Enable attrs by default on v3.6-native file systems */
 		REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ATTRS);
 	}
 }

But this patch has another problem - it forces the "attrs" option on
for such filesystems, leaving no way to turn it off - the "noattrs"
option is ignored.  This does not look good.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-02-12 19:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08  1:12 Bernd Schubert
2006-02-08  1:31 ` Sam Vilain
2006-02-08  5:37   ` John M Flinchbaugh
2006-02-08 12:14     ` Bernd Schubert
2006-02-08 20:50       ` Chris Wright
2006-02-08 21:46         ` Bernd Schubert
2006-02-08 22:11           ` Chris Wright
2006-02-11 21:55             ` Sergey Vlasov
2006-02-11 23:50               ` Bernd Schubert
2006-02-12 18:44                 ` Sergey Vlasov
2006-02-12 17:57               ` Jeff Mahoney
2006-02-12 19:21                 ` Sergey Vlasov [this message]
2006-02-12 23:03                   ` Bernd Schubert
2006-02-13 17:52                     ` Sergey Vlasov
2006-02-12 23:10                 ` Bernd Schubert
2006-02-13  5:47               ` Hans Reiser
2006-02-13 15:24                 ` Jeff Mahoney
2006-02-13 16:39                   ` Hans Reiser

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=20060212192115.GB8544@procyon.home \
    --to=vsu@altlinux.ru \
    --cc=bernd-schubert@gmx.de \
    --cc=chrisw@sous-sol.org \
    --cc=jeffm@suse.com \
    --cc=john@hjsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-list@namesys.com \
    --cc=sam@vilain.net \
    /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

all inboxes | Powered by JetHome®