[Bug 524919] Re: ecryptfs breaks lstat/readlink size assumption
Tim Gardner
tim.gardner at canonical.com
Mon Nov 28 15:03:44 UTC 2011
Fix released in Lucid since Ubuntu-2.6.32-23.37
** Changed in: linux (Ubuntu)
Status: Confirmed => Fix Released
** Changed in: linux (Ubuntu Lucid)
Status: Confirmed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/524919
Title:
ecryptfs breaks lstat/readlink size assumption
Status in eCryptfs - Enterprise Cryptographic Filesystem:
Fix Released
Status in Ubuntu Customization Kit:
Won't Fix
Status in “dpkg” package in Ubuntu:
Won't Fix
Status in “linux” package in Ubuntu:
Fix Released
Status in “dpkg” source package in Lucid:
Won't Fix
Status in “linux” source package in Lucid:
Fix Released
Bug description:
Hi
When running dpkg on an ecryptfs partition, I'm hitting assertion failures in dpkg; in this example I'm creating an i386 chroot in my home under lucid amd64:
sudo debootstrap --variant=buildd --arch i386 lucid lucid
[...]
I: Extracting tzdata...
I: Extracting udev...
I: Extracting upstart...
I: Extracting util-linux...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot /home/lool/uml/lucid dpkg --force-depends --install /var/cache/apt/archives/base-files_5.0.0ubuntu10_i386.deb /var/cache/apt/archives/base-passwd_3.5.22_i386.deb
Running the above command manually:
sudo chroot /home/lool/uml/lucid dpkg --force-depends --install /var/cache/apt/archives/base-files_5.0.0ubuntu10_i386.deb /var/cache/apt/archives/base-passwd_3.5.22_i386.deb
dpkg: regarding .../base-files_5.0.0ubuntu10_i386.deb containing base-files, pre-dependency problem:
base-files pre-depends on awk
awk is not installed.
dpkg: warning: ignoring pre-dependency problem!
(Reading database ... 50%
dpkg: warning: files list file for package `base-files' missing, assuming package has no files currently installed.
(Reading database ... 0 files and directories currently installed.)
Preparing to replace base-files 5.0.0ubuntu10 (using .../base-files_5.0.0ubuntu10_i386.deb) ...
Unpacking replacement base-files ...
dpkg: ../../src/archives.c:754: tarobject: Assertion `r == stab.st_size' failed.
zsh: abort (core dumped) sudo chroot /home/lool/uml/lucid dpkg --force-depends --install
I checked the dpkg source code, and in src/archives.c:tarobject() it does:
statr= lstat(fnamevb.buf,&stab);
[...]
r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size);
[...]
assert(r == stab.st_size);
The lstat() manpage states that:
The st_size field gives the size of the file (if it is a regular file
or a symbolic link) in bytes. The size of a symlink is the length of
the pathname it contains, without a trailing null byte.
and the readlink manpage:
RETURN VALUE
On success, readlink() returns the number of bytes placed in buf. On
error, -1 is returned and errno is set to indicate the error.
I believe that ecryptfs is returning the sizes of the backing
filesystem objects instead of the sizes of the unencrypted data; this
can only break applications IMO since read()/write() is going to
return less bytes than the reported (stat()) length.
Thanks,
To manage notifications about this bug go to:
https://bugs.launchpad.net/ecryptfs/+bug/524919/+subscriptions
More information about the foundations-bugs
mailing list