diff options
author | Ross Burton <ross.burton@intel.com> | 2019-02-01 13:09:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-02 11:06:00 +0000 |
commit | e63e5b2e189df3a3aeddcb42696793a29539c8a8 (patch) | |
tree | 53c1af148f74e2592a7edcd2d14943379abe147b | |
parent | 84e91598278158455314177d4a43a22e344a5dab (diff) | |
download | poky-e63e5b2e189df3a3aeddcb42696793a29539c8a8.tar.gz |
e2fsprogs: fix file system generation with large files
When copying files into the file system the file offset was being truncated to a
signed 32-bit value, so any files that are larger than 2^31 bytes were the right
size, but no content after that point.
(From OE-Core rev: b2ffd2228f0d68d096f8003975f0f7ec28bd4313)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch | 50 | ||||
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch new file mode 100644 index 0000000000..c89581dce8 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | Upstream-Status: Submitted | ||
2 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
3 | |||
4 | From 674ab87b8338372338d20e21a350f88b4ff6c7c8 Mon Sep 17 00:00:00 2001 | ||
5 | From: Ross Burton <ross.burton@intel.com> | ||
6 | Date: Fri, 1 Feb 2019 10:59:59 +0000 | ||
7 | Subject: [PATCH] create_inode: fix copying large files | ||
8 | |||
9 | When copying large files into a ext filesystem at mkfs time the copy fails at | ||
10 | 2^31 bytes in. There are two problems: | ||
11 | |||
12 | copy_file_chunk() passes an offset (off_t, 64-bit typically) to | ||
13 | ext2fs_file_lseek() which expects a ext2_off_t (typedef to __u32) so the value | ||
14 | is truncated. Solve by calling ext2fs_file_llseek() which takes a u64 offset | ||
15 | instead. | ||
16 | |||
17 | try_lseek_copy() rounds the data and hole offsets as found by lseek() to block | ||
18 | boundaries, but the calculation gets truncated to 32-bits. Solve by casting the | ||
19 | 32-bit blocksize to off_t to ensure this doesn't happen. | ||
20 | |||
21 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
22 | --- | ||
23 | misc/create_inode.c | 4 ++-- | ||
24 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/misc/create_inode.c b/misc/create_inode.c | ||
27 | index 05aa6363..f106dcda 100644 | ||
28 | --- a/misc/create_inode.c | ||
29 | +++ b/misc/create_inode.c | ||
30 | @@ -438,7 +438,7 @@ static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file, | ||
31 | ptr += blen; | ||
32 | continue; | ||
33 | } | ||
34 | - err = ext2fs_file_lseek(e2_file, off + bpos, | ||
35 | + err = ext2fs_file_llseek(e2_file, off + bpos, | ||
36 | EXT2_SEEK_SET, NULL); | ||
37 | if (err) | ||
38 | goto fail; | ||
39 | @@ -481,7 +481,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf, | ||
40 | return EXT2_ET_UNIMPLEMENTED; | ||
41 | |||
42 | data_blk = data & ~(fs->blocksize - 1); | ||
43 | - hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); | ||
44 | + hole_blk = (hole + (off_t)(fs->blocksize - 1)) & ~(off_t)(fs->blocksize - 1); | ||
45 | err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf, | ||
46 | zerobuf); | ||
47 | if (err) | ||
48 | -- | ||
49 | 2.11.0 | ||
50 | |||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb index ce95dec5fe..cffb5362d6 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb | |||
@@ -6,6 +6,7 @@ SRC_URI += "file://remove.ldconfig.call.patch \ | |||
6 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ | 6 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ |
7 | file://mkdir_p.patch \ | 7 | file://mkdir_p.patch \ |
8 | file://0001-misc-create_inode.c-set-dir-s-mode-correctly.patch \ | 8 | file://0001-misc-create_inode.c-set-dir-s-mode-correctly.patch \ |
9 | file://0001-create_inode-fix-copying-large-files.patch \ | ||
9 | " | 10 | " |
10 | 11 | ||
11 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \ | 12 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \ |