Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 548950 - =sys-fs/e2fsprogs-1.42.12 with amd64 uclibc-0.9.33.2*: data corruption when fsck ext3/4 filesystem
Summary: =sys-fs/e2fsprogs-1.42.12 with amd64 uclibc-0.9.33.2*: data corruption when f...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Embedded Gentoo Team
URL: http://lists.uclibc.org/pipermail/ucl...
Whiteboard:
Keywords: PATCH, UPSTREAM
Depends on: 539226
Blocks:
  Show dependency tree
 
Reported: 2015-05-08 22:16 UTC by Anthony Basile
Modified: 2015-06-18 12:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Basile gentoo-dev 2015-05-08 22:16:36 UTC
When performing fsck on a clean ext3 or ext4 filesysem using e2fsprogs-1.42.12 (but not 1.42.11 or below), on a uclibc system with version 0.9.33.2-rX or 0.9.33.9999 (but not 9999), fsck will complain about a corrupted linked list for the inodes.  If you proceed to actually fix the filesystem (with fsck -y), it will trash it.  This only happens on amd64 and not x86 --- it probably happens on all 64-bit systems and not on 32-bit for the reasons outlined below:

This behavior was introduced with the following commit in e2fsprogs:

http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=f00948ad1df100c7d616ef6fbf7609329a2e4001

and an earlier companion commit:

http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=baa3544609da3c9bbe7e253b83f32df74e1015de

The later commit (f00948a) introduced pread64/pwrite64 and preferred it over pread/pwrite.  On a 64-bit system pread64 should be just a wrapper to pread but it is broken in uclibc-0.9.33.X.  A series of commits by Mike Frysinger to the uclibc::master branch fix these, but unfortunately backporting them to 0.9.33 branch is not very clean:

http://git.uclibc.org/uClibc/log/libc/sysdeps/linux/common/pread_write.c

I'm working on collecting these into a backportable patch, but in the mean time, I'm asking e2fsprogs/e2fsprogs-libs-1.42.12 on uclibc/amd64 profile and rebuilding the stage3's which are on the tree and carry this serious bug.




Reproducible: Always
Comment 1 Anthony Basile gentoo-dev 2015-05-09 14:05:16 UTC
(In reply to Anthony Basile from comment #0)
> 
> I'm working on collecting these into a backportable patch,

Ouch, the set of patches intermix the fix with the syscall cancel stuff that was consolidated into <include/cancel.h>.  Simply copying over include/cancel.h and libc/sysdeps/linux/common/pread_write.c "works" on amd64 but is messy.

@mike.  any advice here?  should i just rewrite your "convert to SYSCALL_ALIGN_64BIT" to apply to the HEAD of 0.9.33 branch and submit that upstream?  I would replace 


 static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
 		 size_t, count, off_t, offset_hi, off_t, offset_lo)

with


#  if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__)
static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
		 size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
#  else
 static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
 		 size_t, count, off_t, offset_hi, off_t, offset_lo)
#  endif


without any of the MY_PREAD* stuff.  Not sure that would fly.
Comment 2 Anthony Basile gentoo-dev 2015-05-09 15:55:58 UTC
(In reply to Anthony Basile from comment #1)
> (In reply to Anthony Basile from comment #0)

> @mike.  any advice here?  should i just rewrite your "convert to
> SYSCALL_ALIGN_64BIT" to apply to the HEAD of 0.9.33 branch and submit that
> upstream?  I would replace 

Sorry for the spam.  I got it.  It needed a check for __WORDSIZE == 32 and switching to _syscall4 if it isn't.
Comment 3 Anthony Basile gentoo-dev 2015-05-10 12:27:37 UTC
A patch was submitted upstream.  See URL.  Also the stage3's on the mirror have be replace with working versions of e2fsprogs-1.42.10 at http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-uclibc-hardened/  The good tarbals are:

    stage3-amd64-uclibc-hardened-20150509.tar.bz2
    stage3-amd64-uclibc-vanilla-20150509.tar.bz2
Comment 4 Anthony Basile gentoo-dev 2015-05-27 09:48:59 UTC
(In reply to Anthony Basile from comment #3)
> A patch was submitted upstream.  See URL.  Also the stage3's on the mirror
> have be replace with working versions of e2fsprogs-1.42.10 at
> http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-
> uclibc-hardened/  The good tarbals are:
> 
>     stage3-amd64-uclibc-hardened-20150509.tar.bz2
>     stage3-amd64-uclibc-vanilla-20150509.tar.bz2

Patch accepted upstream.  I'll add it to 0.9.33.2-r15 which I'll push out later.

http://git.uclibc.org/uClibc/commit/?h=0.9.33&id=0aaf783f8d0c2748aee458ecd5b846be595c3068
Comment 5 Anthony Basile gentoo-dev 2015-05-29 21:25:18 UTC
(In reply to Anthony Basile from comment #4)
> (In reply to Anthony Basile from comment #3)
> > A patch was submitted upstream.  See URL.  Also the stage3's on the mirror
> > have be replace with working versions of e2fsprogs-1.42.10 at
> > http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-
> > uclibc-hardened/  The good tarbals are:
> > 
> >     stage3-amd64-uclibc-hardened-20150509.tar.bz2
> >     stage3-amd64-uclibc-vanilla-20150509.tar.bz2
> 
> Patch accepted upstream.  I'll add it to 0.9.33.2-r15 which I'll push out
> later.
> 
> http://git.uclibc.org/uClibc/commit/?h=0.9.
> 33&id=0aaf783f8d0c2748aee458ecd5b846be595c3068

I just pushed out 0.9.33.2-r15 with this fix.
Comment 6 Anthony Basile gentoo-dev 2015-06-18 12:39:00 UTC
(In reply to Anthony Basile from comment #5)
> (In reply to Anthony Basile from comment #4)
> > (In reply to Anthony Basile from comment #3)
> > > A patch was submitted upstream.  See URL.  Also the stage3's on the mirror
> > > have be replace with working versions of e2fsprogs-1.42.10 at
> > > http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-
> > > uclibc-hardened/  The good tarbals are:
> > > 
> > >     stage3-amd64-uclibc-hardened-20150509.tar.bz2
> > >     stage3-amd64-uclibc-vanilla-20150509.tar.bz2
> > 
> > Patch accepted upstream.  I'll add it to 0.9.33.2-r15 which I'll push out
> > later.
> > 
> > http://git.uclibc.org/uClibc/commit/?h=0.9.
> > 33&id=0aaf783f8d0c2748aee458ecd5b846be595c3068
> 
> I just pushed out 0.9.33.2-r15 with this fix.

0.9.33.2-r15 is now marked stable for all arches and all older ebuilds have been punted.  The mask on e2fsprogs{,-libs} has been lifed.  This bug is done.