linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck
@ 2013-04-07 18:42 Eric Sandeen
  2013-04-12 17:02 ` Eric Sandeen
  2013-04-25  4:20 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2013-04-07 18:42 UTC (permalink / raw)
  To: ext4 development; +Cc: David Shaw, Harald Reindl

e2fsck thinks that this:

# touch mnt/testfile1
# setfattr -n "user.test" mnt/testfile1

results in a filesystem with corruption:

Pass 1: Checking inodes, blocks, and sizes
Extended attribute in inode 12 has a value size (0) which is invalid
Clear? yes

but as far as I can tell, there is absolutely nothing wrong with
a 0-length value on an extended attribute.  Just remove the check.

Reported-by: David Shaw <dshaw@jabberwocky.com>
Reported-by: Harald Reindl <h.reindl@thelounge.net>
Addresses-Red-Hat-Bugzilla: #557959
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Strange that this has been in e2fsck since 2005; apologies to 
David in particular for not addressing the bug he filed much sooner,
I had assumed that this was some strange corruption, not a simple
logic error / change.

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index a20b57b..94df36d 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -307,7 +307,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
 		remain -= EXT2_EXT_ATTR_SIZE(entry->e_name_len);
 
 		/* check value size */
-		if (entry->e_value_size == 0 || entry->e_value_size > remain) {
+		if (entry->e_value_size > remain) {
 			pctx->num = entry->e_value_size;
 			problem = PR_1_ATTR_VALUE_SIZE;
 			goto fix;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck
  2013-04-07 18:42 [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck Eric Sandeen
@ 2013-04-12 17:02 ` Eric Sandeen
  2013-04-25  4:20 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2013-04-12 17:02 UTC (permalink / raw)
  To: ext4 development; +Cc: David Shaw, Harald Reindl

On 4/7/13 1:42 PM, Eric Sandeen wrote:
> e2fsck thinks that this:
> 
> # touch mnt/testfile1
> # setfattr -n "user.test" mnt/testfile1
> 
> results in a filesystem with corruption:
> 
> Pass 1: Checking inodes, blocks, and sizes
> Extended attribute in inode 12 has a value size (0) which is invalid
> Clear? yes
> 
> but as far as I can tell, there is absolutely nothing wrong with
> a 0-length value on an extended attribute.  Just remove the check.
> 
> Reported-by: David Shaw <dshaw@jabberwocky.com>
> Reported-by: Harald Reindl <h.reindl@thelounge.net>
> Addresses-Red-Hat-Bugzilla: #557959
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Ted, just a ping on this.  I know there's been a lot going on,so
wasn't sure if you missed it, or if it's just saved for later.

Thanks,
-Eric

> ---
> 
> Strange that this has been in e2fsck since 2005; apologies to 
> David in particular for not addressing the bug he filed much sooner,
> I had assumed that this was some strange corruption, not a simple
> logic error / change.
> 
> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
> index a20b57b..94df36d 100644
> --- a/e2fsck/pass1.c
> +++ b/e2fsck/pass1.c
> @@ -307,7 +307,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
>  		remain -= EXT2_EXT_ATTR_SIZE(entry->e_name_len);
>  
>  		/* check value size */
> -		if (entry->e_value_size == 0 || entry->e_value_size > remain) {
> +		if (entry->e_value_size > remain) {
>  			pctx->num = entry->e_value_size;
>  			problem = PR_1_ATTR_VALUE_SIZE;
>  			goto fix;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck
  2013-04-07 18:42 [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck Eric Sandeen
  2013-04-12 17:02 ` Eric Sandeen
@ 2013-04-25  4:20 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-04-25  4:20 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development, David Shaw, Harald Reindl

On Sun, Apr 07, 2013 at 01:42:18PM -0500, Eric Sandeen wrote:
> e2fsck thinks that this:
> 
> # touch mnt/testfile1
> # setfattr -n "user.test" mnt/testfile1
> 
> results in a filesystem with corruption:
> 
> Pass 1: Checking inodes, blocks, and sizes
> Extended attribute in inode 12 has a value size (0) which is invalid
> Clear? yes
> 
> but as far as I can tell, there is absolutely nothing wrong with
> a 0-length value on an extended attribute.  Just remove the check.
> 
> Reported-by: David Shaw <dshaw@jabberwocky.com>
> Reported-by: Harald Reindl <h.reindl@thelounge.net>
> Addresses-Red-Hat-Bugzilla: #557959
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Thanks, applied.

It turns out that 0-length values applied for xattrs stored in
external xattr blocks.  0-length xattrs were only only getting
prohibited for in-inode xattrs.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-25  4:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-07 18:42 [PATCH] e2fsprogs: allow 0-length xattr values in e2fsck Eric Sandeen
2013-04-12 17:02 ` Eric Sandeen
2013-04-25  4:20 ` Theodore Ts'o

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).