Bug 1284906 - cp will corrupt sparse files with trailing extents
cp will corrupt sparse files with trailing extents
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: coreutils (Show other bugs)
7.2
All Unspecified
urgent Severity high
: rc
: ---
Assigned To: Kamil Dudka
Jakub Prokes
Petr Bokoc
: Patch, Reproducer, ZStream
Depends On:
Blocks: 1285365
  Show dependency treegraph
 
Reported: 2015-11-24 07:48 EST by Pádraig Brady
Modified: 2016-11-04 03:40 EDT (History)
5 users (show)

See Also:
Fixed In Version: coreutils-8.22-16.el7
Doc Type: Bug Fix
Doc Text:
Copying sparse files with trailing extents using "cp" no longer causes data corruption When creating sparse files, the *fallocate* utility could allocate extents beyond EOF using `FALLOC_FL_KEEP_SIZE`. As a consequence, when there was a gap (hole) between the extents, and EOF was within that gap, the final hole was not reproduced, which caused silent data corruption in the copied file due to its size being too small. With this update, the "cp" command ensures that extents beyond the apparent file size are not processed, as such processing and allocating is not currently supported. As a result, silent data corruption in certain type of sparse files no longer occurs.
Story Points: ---
Clone Of:
: 1285365 (view as bug list)
Environment:
Last Closed: 2016-11-04 03:40:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pádraig Brady 2015-11-24 07:48:38 EST
cp will corrupt copies of a file that has:

1. a hole up to the apparent size of the file.
2. an extent after the apparent EOF.

To reproduce:

echo blabla > sparse_falloc.in
truncate -s 2M sparse_falloc.in
fallocate -n -o 4M -l 1M sparse_falloc.in
cp sparse_falloc.in sparse_falloc.out
cmp sparse_falloc.in sparse_falloc.out || echo corrupt

Upstream backportable fix is at:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=patch;h=eea6b49
Comment 1 Ondrej Vasik 2015-11-25 05:34:33 EST
Thanks Pádraig for heads-up.
Comment 10 errata-xmlrpc 2016-11-04 03:40:06 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2497.html

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