From patchwork Fri Feb 1 13:07:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 157200 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp404622jaa; Fri, 1 Feb 2019 05:08:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN5F7qWVk71BdvTAiOn6d/ZDphA5WrFx8l9KUAmcR7GKa1OGCu3Mc8uAOOJwD1RDdFS7CUrw X-Received: by 2002:a62:b15:: with SMTP id t21mr40727672pfi.136.1549026481254; Fri, 01 Feb 2019 05:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549026481; cv=none; d=google.com; s=arc-20160816; b=xbSUk60TtrBhhYkQ92IVWtrVr0KsTsj2uKk3Ug4az4cEhiv3A2rPi5XjV65z/DKUYd kAfhLgxL3UFyE/I145XvUxcCTzH9yeLov1wUgeYTvQ+DqVQiT+H1FXK+YO8yF6Gdv7mr kVAWmNyP1RwSwERQiKh0Fw+BCEVNaUOZH64qKoQfMjlWgJk+8hxG3ulRMMf1o80GsVAa UdOYVnM3kuSb+Ib+VFkuIsqFhEB9Irh2IIMHXuCER/hzv/Wt6pZocKUKC9Sa7JKKzPiY kCOsYX80YuE2sfnMmdY9Y9R5BN7Ru567MABS7jt4b1BWAkXBZx4vRvaY3z0pZEP4+DOK q3eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=3QxikBnS87rx3BhCQUge2gLlZDdm2HlqdhAJzW0GciQ=; b=vT5MPNY2GfdRuUI3Y9VUSavnNWqrvuxy5FsNUGh1/t+wjlg3dJ1c7zWrhOlopQ8tEO b0RcS5bBMI/7F6ns/0m0WPSjVPtGEdzYcH3swky1SuSzd2oRKgy9kBaU8OEEpULCJYwU r2gmMQ1n0lt36h5FGSBLbJltQlpq/W0MO+L3Z5piX+94jwlvV2vpwOXJxVkdmN7fpER3 LEpuOqFU2UMhvXAYd/hMQ1+i17nFX5eQS7ZwIF4leayDvMlgzw7rUUZG7JTn+NwZjLKv 7zue4JuXy2nx3/85gg5VIO+FGjPxSTjQnzHqegJOE3qazW0ivNCWTzzbsJpXq7r41n0S JUwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=CHj4wBna; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id f63si6736470pgc.473.2019.02.01.05.08.00; Fri, 01 Feb 2019 05:08:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=CHj4wBna; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id A77F67C4BB; Fri, 1 Feb 2019 13:07:58 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mail.openembedded.org (Postfix) with ESMTP id CFDA07C21E for ; Fri, 1 Feb 2019 13:07:56 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id g67so6139411wmd.2 for ; Fri, 01 Feb 2019 05:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=nZ/AOO97+Eu8W3xuZyLe+CFnxebmA1aqyepy5K+Y/W4=; b=CHj4wBnaXIFg7OWuOnzA0DGTGKJHjXUo+LDGmR+WKDXPibqMvoQTB21VzEBOBEsmzE nSSC32LWxaXxU/S7uHub3G/Aphk6cgWoxp4T9Ki0/t5kJl8ZBo868eCwkiGfgd9JKadp MI5snKY5DqXia9kIV+LZ7eH6Sc8k6SXxZSiU7L43u2PR3y0eQrApl2yuRa5ont9942dS dtiakNLTgIHSaqrNulO7TKZtrai3bRHbXbZIXtOSZnkLxAF4sWVQ1GcxEW0gA39QQzTY T4K1xyPh1/2JmFqs6mpy7UT9ZgAjICGp4FnIREp5VGZ4XUcEl9yc3mkox+hWtLdArca/ n3wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=nZ/AOO97+Eu8W3xuZyLe+CFnxebmA1aqyepy5K+Y/W4=; b=pLIX7P1Chc3Y1tsT5VoDkkrFPbN38Yc+ufbxE06HpVJg+K0rB4w00JJOUGleSkBHLl xb4KN/ZiITlyyF2KXD9hRC8viccwtbyrascNFz41AVNYdqdb1Q1c1KKAiJnKGzbMApIA Ua0YtGQndKcpK9uYeri+ByEH7Gq+fxEW8+MjPG9Dz7LsXGK6A/rHN3378CvZXClNxhRm wb/Yfgx7WABITAgESPMowNO3mSyt3uqSDs9UaogPN7BO3RBKX28YJV0w2PLmF7ZA6RjD b3nWbcL0seWsne+y8NLOXbTzNIAOV++agIa8g9tPpOFY3MxBJ9Uyv1+R8nFo9SSTcA3i GMdQ== X-Gm-Message-State: AHQUAuZJK/gplQ3Jse+nIbIhUH2yluIO66kA9p5ybYNYz38o7V6uylJv Icly58EVQgZ1uS5dizsQSfUGzOMDIw8= X-Received: by 2002:a1c:c1c9:: with SMTP id r192mr2359591wmf.146.1549026477177; Fri, 01 Feb 2019 05:07:57 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id 141sm4802368wmb.5.2019.02.01.05.07.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 05:07:56 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Fri, 1 Feb 2019 13:07:55 +0000 Message-Id: <20190201130755.32173-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] e2fsprogs: fix file system generation with large files X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org 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. Signed-off-by: Ross Burton --- ...0001-create_inode-fix-copying-large-files.patch | 47 ++++++++++++++++++++++ .../recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core 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 00000000000..93fd998fe4d --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-create_inode-fix-copying-large-files.patch @@ -0,0 +1,47 @@ +From 674ab87b8338372338d20e21a350f88b4ff6c7c8 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Fri, 1 Feb 2019 10:59:59 +0000 +Subject: [PATCH] create_inode: fix copying large files + +When copying large files into a ext filesystem at mkfs time the copy fails at +2^31 bytes in. There are two problems: + +copy_file_chunk() passes an offset (off_t, 64-bit typically) to +ext2fs_file_lseek() which expects a ext2_off_t (typedef to __u32) so the value +is truncated. Solve by calling ext2fs_file_llseek() which takes a u64 offset +instead. + +try_lseek_copy() rounds the data and hole offsets as found by lseek() to block +boundaries, but the calculation gets truncated to 32-bits. Solve by casting the +32-bit blocksize to off_t to ensure this doesn't happen. + +Signed-off-by: Ross Burton +--- + misc/create_inode.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/misc/create_inode.c b/misc/create_inode.c +index 05aa6363..f106dcda 100644 +--- a/misc/create_inode.c ++++ b/misc/create_inode.c +@@ -438,7 +438,7 @@ static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file, + ptr += blen; + continue; + } +- err = ext2fs_file_lseek(e2_file, off + bpos, ++ err = ext2fs_file_llseek(e2_file, off + bpos, + EXT2_SEEK_SET, NULL); + if (err) + goto fail; +@@ -481,7 +481,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf, + return EXT2_ET_UNIMPLEMENTED; + + data_blk = data & ~(fs->blocksize - 1); +- hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); ++ hole_blk = (hole + (off_t)(fs->blocksize - 1)) & ~(off_t)(fs->blocksize - 1); + err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf, + zerobuf); + if (err) +-- +2.11.0 + diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb index ce95dec5fec..720eaff06a3 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.44.3.bb @@ -9,6 +9,7 @@ SRC_URI += "file://remove.ldconfig.call.patch \ " SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \ + file://0001-create_inode-fix-copying-large-files.patch \ file://quiet-debugfs.patch \ "