From nobody Wed Dec 17 05:44:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561123557; cv=none; d=zoho.com; s=zohoarc; b=oNg5rldMe8JrDyXSrPoS5+yM6lCfK3zUmCg6woSgx7DWHB28vfqliBvrAiAnQJY3RoeoVUolmaOIA6avdCt74FS9pD+o16NiYea47VZnjJBTG5JV2shRushJaSybjcnaXrXbkP63Ev/+LwbZDTkHoFtAmvAkkrbDy/evaO4OzHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561123557; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jDfjdAw564I9LWxQDI/EOVWLRctu48hygnoykLIHht8=; b=KcN3+eEj4J5l7hY51kVQybCbC1P2i5BUYMWD/Mo3rPnc3CfKB1gIKbm1miop+M4AwzCylQqP3qmbH1++oPmTBXO64/He2hPjFNAdv4PKe7/q/p/b0fj9URXtyjfzdJeXppw6JB2eDWBtZBpI3xJdzyysuEF+Xhyk2tfqNYXr5FE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561123557202515.6208212548672; Fri, 21 Jun 2019 06:25:57 -0700 (PDT) Received: from localhost ([::1]:34820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heJY7-0008WB-1P for importer@patchew.org; Fri, 21 Jun 2019 09:25:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50452) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heJWE-0006KF-QI for qemu-devel@nongnu.org; Fri, 21 Jun 2019 09:23:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1heJW9-0004Wo-7C for qemu-devel@nongnu.org; Fri, 21 Jun 2019 09:23:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1heJW0-0004QZ-Jf; Fri, 21 Jun 2019 09:23:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E838B30F1BC4; Fri, 21 Jun 2019 13:23:39 +0000 (UTC) Received: from localhost (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8153A5B68B; Fri, 21 Jun 2019 13:23:39 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 21 Jun 2019 15:23:21 +0200 Message-Id: <20190621132324.2165-6-mreitz@redhat.com> In-Reply-To: <20190621132324.2165-1-mreitz@redhat.com> References: <20190621132324.2165-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Jun 2019 13:23:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/8] vmdk: Reduce the max bound for L1 table size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sam Eiderman 512M of L1 entries is a very loose bound, only 32M are required to store the maximal supported VMDK file size of 2TB. Fixed qemu-iotest 59# - now failure occures before on impossible L1 table size. Reviewed-by: Karl Heubaum Reviewed-by: Eyal Moscovici Reviewed-by: Liran Alon Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman Message-id: 20190620091057.47441-3-shmuel.eiderman@oracle.com Reviewed-by: Max Reitz Signed-off-by: Max Reitz --- block/vmdk.c | 13 +++++++------ tests/qemu-iotests/059.out | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 0f2e453bf5..931eb2759c 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -425,15 +425,16 @@ static int vmdk_add_extent(BlockDriverState *bs, error_setg(errp, "Invalid granularity, image may be corrupt"); return -EFBIG; } - if (l1_size > 512 * 1024 * 1024) { + if (l1_size > 32 * 1024 * 1024) { /* * Although with big capacity and small l1_entry_sectors, we can g= et a * big l1_size, we don't want unbounded value to allocate the tabl= e. - * Limit it to 512M, which is: - * 16PB - for default "Hosted Sparse Extent" (VMDK4) - * cluster size: 64KB, L2 table size: 512 entries - * 1PB - for default "ESXi Host Sparse Extent" (VMDK3/vmfsSpa= rse) - * cluster size: 512B, L2 table size: 4096 entries + * Limit it to 32M, which is enough to store: + * 8TB - for both VMDK3 & VMDK4 with + * minimal cluster size: 512B + * minimal L2 table size: 512 entries + * 8 TB is still more than the maximal value supported = for + * VMDK3 & VMDK4 which is 2TB. */ error_setg(errp, "L1 size too big"); return -EFBIG; diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index f51394ae8e..4fab42a28c 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -2358,5 +2358,5 @@ Offset Length Mapped to File 0x140000000 0x10000 0x50000 TEST_DIR/t-s003.vmdk =20 =3D=3D=3D Testing afl image with a very large capacity =3D=3D=3D -qemu-img: Can't get image size 'TEST_DIR/afl9.IMGFMT': File too large +qemu-img: Could not open 'TEST_DIR/afl9.IMGFMT': L1 size too big *** done --=20 2.21.0