From patchwork Mon Aug 29 10:12:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12957644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FE93ECAAD2 for ; Mon, 29 Aug 2022 10:18:19 +0000 (UTC) Received: from localhost ([::1]:36374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSbqV-0005DS-1t for qemu-devel@archiver.kernel.org; Mon, 29 Aug 2022 06:18:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSblQ-00014W-NP; Mon, 29 Aug 2022 06:13:04 -0400 Received: from mail-eopbgr80130.outbound.protection.outlook.com ([40.107.8.130]:50395 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSblO-0005zs-PN; Mon, 29 Aug 2022 06:13:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ol3r4StEo3pLFFwYP0cbXvcwhbmZYOEEq/pguE3B3H6tpEs16HBVbDUy8HZSsP//1RjI682heLZlslypEwrmbp8dlX0NyILVpo+aqZOw+0XpdWm7Y+VUMDCTxUZHMCEW1TH49c5/lLFiMsj5eannN/RFPNvkr2cckeboWlAhA4M6+YTAOsTQfYrWbJNH1M3WAen9YkDPSXU512ZvgNWv2Ew2uY+pWXTmQ8UtxG3H9zrQFymiB1OA0LZxnCXYnOxALugSqy2cHDW8jIbLHZhvUL8AMeXw8WMRLXKXxhVI5gWqB/+8SQEYnbK81btcQHiH2FgmtqNgC4XddPjal8a49Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dYRFUpACEhkX+bXhxRNDhGyqPDgF7Ofp2pS31i/7POo=; b=clE34eexSJ1MiefhYomnlek7YZdMB5JhXUayFmp/CRWReRvZaPH8z6pN+RXJmCFmMCah9HzQXdu5bsn6ITWDT/irxd69fJprYq0bUVaIHPb91r4q+nwM/nGTnkjTp5P9j/IRjgnCck06QrQSHt28LotwUjmwIAY/sNB1gGK/xTTcjGljaMOJix0j6xI/589HDtGF/GgEFz44RYdrrZBkTH9KoHHbf5MhzSFIH8BWTL0gZWHSJpIsbpwTeqjPIapYG9YidiRj1b7Htc4EB+U0H5xzzNANb7dy7gCgsNnu8WhLr4eMIHM6Pjofkxqxp3f6DphebvIbkzTFgs9lyTf9wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dYRFUpACEhkX+bXhxRNDhGyqPDgF7Ofp2pS31i/7POo=; b=wTn8vVcrZfwDasaM50Tztk22+XMVA5UsWf5uUY/uiwc8XsZEA028s6Sr1zvLuR8d6tFTR668iWysLpRALNMK8SFvM7ViUazddeZX7EFw0RiU8ztPpvXk8xabnD0K7S5WFP5C1VjkUhzBvsADUK5bFFToOc78kOFzO+GqMa8rNwroalEbyNXPbaoBx56G7KRpkGsw2UEQvh0BgwRujg3tyZwVmhNE/3FT6tIBngBqP510j6vMIy066j9WPijwmzeT3LfQrXugEIYD1MTrcbeCf9pYRvD7uJ+GuJshD7rq0foVuTAXdhvsNNfPHZipyCkgkAC9jfhNQ8iU7DeNjnNUug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by VI1PR08MB3023.eurprd08.prod.outlook.com (2603:10a6:803:4e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Mon, 29 Aug 2022 10:12:56 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::5174:25c7:6df8:741b]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::5174:25c7:6df8:741b%5]) with mapi id 15.20.5566.021; Mon, 29 Aug 2022 10:12:56 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v7 03/10] parallels: Fix data_end after out-of-image check Date: Mon, 29 Aug 2022 12:12:38 +0200 Message-Id: <20220829101246.343507-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829101246.343507-1-alexander.ivanov@virtuozzo.com> References: <20220829101246.343507-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0139.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::14) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d012fb92-1fa0-477f-65e9-08da89a70a49 X-MS-TrafficTypeDiagnostic: VI1PR08MB3023:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H6NdlwZcREKvMgBPaJw12E0ShyYt4Ld8ckE9wQGJbflRQ5a7kVHdqtTM5fJpav5mjL7P0H63W8QSH/BwWIEjzME3UZjk4zrsBX0noLGQ4ta+9XNkNnSATmJXraoCmhxi5nMfPqhtqPK5lTOIIir5rmHjt7NQfh7B2PIS6tLH9iw9GFC1/N5u8llofUBupSaAODAaxn3K2Dj3NfGm8pDJPf8qJnRSjv4iv+1QPU9X6ihSD8UuDZDpxGx+C5wHqG25c51SRhGaYsnimY5yOktLCIYxtH95Egd2PiF2JIv7NuuBVfdhQgEshUZY0XnqZyI97s1pkI3gKJJN4IEyKxIABVusrZi0z41TXjToBfMF+TkkKwirQOdDwWoiA8O7Mm3Ha7e8qxfTxvVWWSzhlCaSccfcrNVG8wfhtmAvfWwL2wuvMkq8EJa6w3JZxKnOF3WAVQf8sgS8KiPjhXlq6qpE9X85tkjh3RTAuRDsjritIvZJoDg9LUi2otSS9O2Pk8Win8gineFxZgT8HaZf45f5Co8PaiKKT1rcOTH6OhDn6j6mo+G92BVOo3ETNkZaQEPMGnmEZfRUZJsRDSrd8LLabCvTMiaUvkPDVCQhh+tR8CGsa6ljkv1H7kZIy2nBgbyIHmEfqXWuNc1x/dGfKMbYmWD2f3qgxEpPSav/uogpqmnGaWCCNy7KWcek2VmApumbclMw5Q/R7I0cwvmKp7vIuhwf4sNzU9GMzmhCDQGkuO5j+FbBUIiSlDJxHzmibo0xxLMlL+dmNfnDzkljPszizw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(366004)(39840400004)(346002)(136003)(376002)(83380400001)(86362001)(1076003)(186003)(2616005)(38350700002)(44832011)(38100700002)(5660300002)(36756003)(4744005)(66946007)(4326008)(8676002)(66476007)(66556008)(8936002)(2906002)(6666004)(478600001)(41300700001)(6486002)(6512007)(6506007)(52116002)(26005)(316002)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OXm02D3uwOTeGati7dk8AzD+f07YW3SN8kdJ4kZ7OXysYqEdbJXgXju+Nrpv4aA8ZloN4iW0l8jNro0Ww6syuUQ2zLe8W8OOuTk7+3ijd3JKckYSySm/y5voU4Chbad1rJ71/6uyci9v4Jd9zRn7uVyreBbtF7NMMG2/Vz4ebhtvGaDYCF1jdAYxnvoRqJTXh31Lf4S0qFr7UhzCfAcgWA4Jjb+j88oW8Xl5CBgmBNPOCnFgshVXvWxKq3TV1Q4Y7r10KUxqi5xuEz4q7nc9fzD3J/hVs5dFfvPL0zsO0QaTcaClNWQMii6+DxBWv2gS0x8NwwxX19yaE/7Z8+vI+jSM1YcyM1ddw23ko14mMu//KfSl92krDkzjfNyH2bfH0uZLq2gLjV+aRFkSdnuNV6edlRuCbjX2rQ/5JE2QF8Uyz76SqK6Makq+LNcifY2zKNAs4uGxtTTZR8nPyrkgIVugJkeupjsX1TtAO/bLvBGQkJm0tJ46S+HgtCBO0BgEfEFDrqmFTvdMnKKZ9vlNZg+e78mkyXcfT7CVizgEUlvz/ZFjJ1WzmmUNKWuE856NpTr1wmdcpc5TPIzi33T0Unc29I3Rl2V6h9TZtAxkgF84l4iaAVKkKBLt+u2cEemyyJztMsmMHNNHE6pMrFGXk570oYRD+KW+2JTEA8b35Oi2zxFu7nTH70cR+b/YdL1qHiIGG1xkgMzIHRIpzEEhKyFbUvQu0bkN9OQiFBOgoI6GoxXio9OYXesqO1LUuXDK9zwKPJsC7GZdnri9wdyGOUIrBNmT8FYab8Di9wMFamGBv9/5bn+6BkKrNmxtNn/6SLl1Rv3Glr3JEIi5/XJ0/Ejk5htEHxu0bqbk5nhFGfsLnleD73oq/gteiFe1h0BVAW8pR2AdSAKPR1PTK4zBIRRfyyp+FkrwRx1yGbegK3wDzVsIy4DCCQz6Zbyegbayf0NJdlsIIK0d5nzNjhmoz3th/XYt6anecl9VfMCjZy9+KCxi2anJL5KO3s4mOpm15goNOm9nqmvtoHV7gWoHa7wDZz8jKlQ1xTFMlBHWM3XLdHln8B6PAS82i3OGUVAtpYI3SYRc8qQTea9UHeiNhxiwyREzsh+zAxG1gHWv2XKOqhRtlky0eUWMR/FxlAcJr4ZvZLalsF7F6XKi6QjbEENvoQg7J9XklIaJniRJ3e8jyEn63j7g1xaCODH08KoCPMjYhtxhRGdi9NpOSzQYb4q0bB7g7Xdwgr9dsjS1oiHe9RDpHlUym32xWHxlydBnq1mfxzFAwzL7T2xekb0gKRWLJrQxmsL5V5Ekr53cenaSKE3f+xc0XJ6o26OMy5jIQqEZcoZjF6PEn76tzM9rrgQrNskyzOhvXCgtTb8DYJGr3KMTTTD+PfQERur3X0FKpdIyct/G2nKpZal7CBEcl2KYWggKPFT650KUPAJGXK5DkEnOaxbPosZDkusPDpBhpeLUmCRGArI+Tw0EodI099xC1R8byx9VeCiCOwhQjGPGr8v8bIaD9UBtoQaggFQw2lMxYamQKVkTDO4ewYPC4nsnxZQ1Ra2DnjVw6p3iXUkb0VY5i6pi+h6e2cy9r3AwApCvabBB9g1PDVxxuaRBUeaGhhl/RuvWMKGfcG96ISE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d012fb92-1fa0-477f-65e9-08da89a70a49 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2022 10:12:55.2722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k0h/gTIZ2k7i3h8iDlCBlgVoEkBI07P+xsi88rC4PTvOfeT/dIppy8w/9J5dctxCd2PxBuDEvYx9zsg68XnpLxrZulhGKauctDZitM0BXdc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3023 Received-SPF: pass client-ip=40.107.8.130; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Set data_end to the end of the last cluster inside the image. In such a way we can be sure that corrupted offsets in the BAT can't affect on the image size. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 7e8cdbbc3a..c1ff8bb5f0 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -514,6 +514,8 @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs, } } + s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; + out: qemu_co_mutex_unlock(&s->lock); return ret;