Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1141206 - mksquashfs corrupts last block with more than 2047 blocks
Summary: mksquashfs corrupts last block with more than 2047 blocks
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: squashfs-tools
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Bruno Wolff III
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F21AlphaFreezeException
TreeView+ depends on / blocked
 
Reported: 2014-09-12 12:54 UTC by János Tamási
Modified: 2014-10-15 21:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-12 17:20:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description János Tamási 2014-09-12 12:54:58 UTC
Description of problem:
Creating squashfs filesystem bigger than 2047 blocks the last block will be corrupt (all zero)

Version-Release number of selected component (if applicable):
4.3

Steps to Reproduce:
1. create a 2GB test file: yes 3 | dd of=testdata bs=1k count=2M
2. create the squashfs with 1MB block size: mksquashfs testdata testdata.img -b 1048576
3. get the file from squashfs: unsquashfs testdata.img
4. compare files: cmp testdata squashfs-root/testdata
> testdata squashfs-root/testdata differ: byte 2146435073, line 1073217537

Actual results:
from the start position of the last block the file from squashfs contains only nulls

Using the -no-fragments option the problem doesn't occur.

Comment 1 Bruno Wolff III 2014-09-12 15:21:12 UTC
Do you know if this has been reported upstream?
I don't remember seeing any upstream commits that would address this, but I don't watch the upstream bugtracker normally.

Comment 2 Bruno Wolff III 2014-09-12 16:48:24 UTC
I am able to reproduce this in rawhide. I'll want to check it against upstream's master branch to see if there is already a fix.

Comment 3 Bruno Wolff III 2014-09-12 17:16:15 UTC
I have confirmed this happens in the master branch as well as what we have packaged. It could still be something Fedora specific (e.g. a gcc bug), but most likely it is a current squashfs-tools bug.

Comment 4 Bruno Wolff III 2014-09-12 18:06:22 UTC
I have reported this issue upstream.

Comment 5 Bruno Wolff III 2014-09-13 16:23:52 UTC
Guan Xin provided a fix for this on the squashfs-devel list and I am working on  package updates for Fedora. (I tested the fix locally and it does seem to work.)

Comment 6 Bruno Wolff III 2014-09-13 17:46:53 UTC
I tested squashfs-tools-4.3-8.fc22 and the fix appears to be working. I'll be getting test builds out for f21, f20 and f19 shortly.

Comment 7 Fedora Update System 2014-09-13 18:01:38 UTC
squashfs-tools-4.3-8.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/squashfs-tools-4.3-8.fc21

Comment 8 Fedora Update System 2014-09-13 18:02:49 UTC
squashfs-tools-4.3-8.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/squashfs-tools-4.3-8.fc19

Comment 9 Fedora Update System 2014-09-13 18:05:14 UTC
squashfs-tools-4.3-8.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/squashfs-tools-4.3-8.fc20

Comment 10 Bruno Wolff III 2014-09-13 20:33:06 UTC
It looks like this is probably affecting the Games spin and perhaps other spins, though I haven't specifically seen a problem caused by this yet (for the Games spin).

In testing the fix help the problem with large files, but now an LZ4 regression is showing up. While LZ4 isn't likely to be used by anything (the kernel doesn't support it yet for squashfs), I think I'll want to wait for Phillip to chime in before requesting a freeze exception.

Comment 11 Bruno Wolff III 2014-09-13 21:12:03 UTC
A repeat of the regression test on the same data didn't show an error. It's possible I might have over stressed the cpus and got a transient error. I need to do some more testing.

Comment 12 Bruno Wolff III 2014-09-14 03:22:02 UTC
I have seen the error again on a different i686 machine. So there is likely something there, but it may not be a recent regression.

Comment 13 Bruno Wolff III 2014-09-14 14:23:03 UTC
The corruption reported in this bug seems to only affect a small fraction at the end of a file eben for files significantly (e.g. 3GiB) larger than 2 GiB. It isn't the case that everything past 2 GiB is corrupted.

Since the lz4 issue I saw after applying the patch is intermittent, I suspect that is really a separate issue and potentially predates applying the fix for the 2 GiB issue.

I need to collect more info for the lz4 issue, but given that it isn't really being used at this point I don't know that it should block getting this update out.

I'd like to see if I can get the lz4 issue to occur in an earlier version of squashfs-tools so I can prove this fix isn't the problem and capture a copy of an image which fails so that I can see if compression or uncompression had a problem.

Comment 14 Bruno Wolff III 2014-09-14 14:42:40 UTC
I am proposing this as a freeze exception because any spin that has an ext4 file system over 2 GiB (after being resized) is going to have a small amount of corruption at the end of the file system after being squashed.

Note that while in theory this affects the games spin (which is well of 2 GiB before being squashed), in practice the corruption hasn't visibly manifested itself. This should also be affecting the workstation image because its ext file system is over 6 GiB. (And in fact the TC7 ext3fs.img file does end with a big chunk of zeros.)

Comment 15 Bruno Wolff III 2014-09-15 04:39:25 UTC
Phillip had this to say about the bug on the squashfs-devel list:
"It is a serious bug, but, for what it's worth, it will not manifest
on >= 2GB files, but only on exactly 2GB files (in actual fact
on any filesize an exact multiple of the blocksize, and bit 31 set).

There is an interesting subtlety here, even in the exactly 2GB case
Mksquashfs will generate a filesystem with all the content
included, it is the Unsquashfs/kernel-code which fails to decode this
unexpected filesystem"

Comment 16 Bruno Wolff III 2014-09-15 04:45:36 UTC
Phillip also had a comment about the lz4 issue and while nothing is definite, it seems likely to related to using slow cpus and incompressible data and not to this bug.

Comment 17 Fedora Update System 2014-09-23 02:41:44 UTC
squashfs-tools-4.3-8.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2014-10-12 05:01:13 UTC
squashfs-tools-4.3-8.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2014-10-12 05:04:30 UTC
squashfs-tools-4.3-8.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.