From patchwork Tue Nov 14 10:16:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10057265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7B7D601D3 for ; Tue, 14 Nov 2017 10:18:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABBA5292E5 for ; Tue, 14 Nov 2017 10:18:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A075E292F7; Tue, 14 Nov 2017 10:18:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F5F2292E5 for ; Tue, 14 Nov 2017 10:18:54 +0000 (UTC) Received: from localhost ([::1]:58628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYIv-000397-FO for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Nov 2017 05:18:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYHO-00037T-P4 for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEYHI-00075h-Sr for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:18 -0500 Received: from mail-db5eur01on0109.outbound.protection.outlook.com ([104.47.2.109]:61264 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEYHI-00071Y-Ld; Tue, 14 Nov 2017 05:17:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lsE0r0DiZ4ENtrXLmKuWT0Z4+DG1Oeh+PpBpC7wkeYg=; b=DWjZjczoKozRrrnoLPOVeaJqoB6pnije5bUJY/0YmcsF1to7oGWRDXmA3BHAX6ftV1LqS5LYLJAH+uAv2SzVuV6RwtZR7KeF72liuMSVZUPhTBHEphUD3q6G5h9TOXmNgwU4r+1uNpbasSfx2br1hbhyYwj2eB5OIyeXsibCIko= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 14 Nov 2017 10:17:11 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 14 Nov 2017 13:16:49 +0300 Message-Id: <1510654613-47868-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0202CA0012.eurprd02.prod.outlook.com (2603:10a6:3:8c::22) To HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f63fd12f-7fab-42f6-c79b-08d52b48deac X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 3:cCYvucWxxuxQIBlkTIbV94q6aGniJ7f3Z3rAqEUBhXUag23fKfd63QpU8R69zHbmO1q+zGkwUFTIG47fO93oIhOFEXFHaFNAB3yMdzbMkJdShdKnTcbslTaUiQURwp0ZDGlEjqacuRUnyaAaeQwmuOLsqL4TPZLH+R2pismfwK4gbDGjD2dXSNABIh0imszIpkQfEfMM0n+05q/Rd4U9dbZ2B5qeQhLyzeufxeo3vKN/zkDFIcw6yjYOG4ORZMQ9; 25:LmqOqjye42rd1zvDpSm3B3AY9zTEUROTUA0jSc7SsBAFtswubCCtPA66uiCrn3ZCUyNitaDHloYPWDbKmSq+mX7Zy5AEqZimsIinPwQos9MqfQc61xNsHleek+4tc2Urz1tXHouCbgzP4g5sVA1yYCOeohVEt6+jD2HfWaSCO0XPSaYlh7gyQ/x89UUTnae6OMSvFnROcNwcONHBwqeUxwS/jNSUPz7cQsfV6f98fhm3c4BduA9wXsK0V16mu9tnpDcBBjnBVxRL86LeliVOGD7Dulr7d5IpyB2hqoQ/VXj1mQOchCp2LwMD29I5ISECeszi9pEkmo1KOa/rthKYhA==; 31:aZfmz23yI6WSfz3fnQSSKm+4th53J9/tTlTlnynEXuib+u4+yxiMYJb9Q2VfgCnM/vxVbPxNh8p/Ua0KworiZ8aVXwFn+MkvYbNVZHSAKxy3ofOOrrvJdk6+OTjDc+qOlxB56PShPk2XxxKXdMJ13KjDJThv7NjKk1EQUiOumn6SgfPUhHaZ0j9Z+xFsrL1+wh9/qjIR4oFga0zA5NBFStRVJKpU5lm14mwjtc5tMGo= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1993: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 20:3oIsiuJN3c3ru6uxNM8LB/y1u2DLQohnL9dGnD5lCqb3znKd07G8NrTeMr26+LaontLUJERsqUE1V9NIRGkb3t+EwDcR/WCZgslnx0hFVBsl/+VR374ldQauOCg/46MAY6Bk9ryVhEGfT0J5fYCsxKq1X3wb+SaRBxdGXClrbgBUIQ6/O7v33fxRpItcszT08KCVLiN4tSGT3/l5ZKKpUBgBOG9bpggIIchZN+3PJloVuONO1TVQbmCxy4jBTs0xZhXrwPgaiiCWzElYgzsXeF7UcMTGVWLQhBTWSmJNQb8AONZSwLJn2c4c1b3HOyL/X/on1PY83WSdwt+o0a05fws71wM4/410DcDZFLpmZXUF2lOzUF9Qj2b4AoEQDde9w5k+2ApOfIt3XoZs43CiNxjKwZSqITOmolbRf7tgMgc=; 4:GeniwSWOpS8rOTdsGoOzGqhQFHNuYcAIxy9erVPVkvb6dayJNuQHqAN6zPgkErITMYPgskwstXULMn2wiNyakUNXdZO5JT2pTMJwFq/Lfy/md40tS2IW4RfXG3aJBYAZl+ACzx1kZqIO4fA8zdgEMm5OL5J+HLdG49usjpTFM6bYvcyl5RFa2/ctVR6ldZ/U1Vy025TKKx6LqflTRkzAo+UIxqiF2Xf8Qmhan1vq7R46zqQn9usS+tSCUKGg9z/ZAwYHitzgwqRzZHzeDQv/3A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0801MB1993; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0801MB1993; X-Forefront-PRVS: 04916EA04C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(39830400002)(189002)(199003)(97736004)(5003940100001)(6916009)(3846002)(2361001)(5660300001)(69596002)(6116002)(8936002)(8676002)(81156014)(2950100002)(48376002)(33646002)(81166006)(2351001)(25786009)(6666003)(189998001)(50226002)(47776003)(6506006)(16526018)(106356001)(107886003)(105586002)(68736007)(478600001)(305945005)(36756003)(76176999)(50986999)(101416001)(316002)(16586007)(50466002)(4326008)(6512007)(2906002)(6486002)(53416004)(66066001)(53936002)(7736002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1993; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1993; 23:ZgTjI1pg520ciFp6J0V9uKHfLwy2utDyyPGqRgL?= =?us-ascii?Q?jY5Ndjzwoo+aLodBrzcZr6Lhj7m5NgPyOpJ+yINCgZBcWNFDp1EduJZi6QJI?= =?us-ascii?Q?ighiBA16pG1vIs4VYWfCX+oZZDhp3KDYYsZ/l95CA8twnkwnjeXoKsSFeDMe?= =?us-ascii?Q?pRJj0yFCqgJIv4qOQXD3GeW5mnIV7j+BuvJ6WJuodSGUOykrPvym68CodLva?= =?us-ascii?Q?mzFrqqj/2Zlx7qQKcL2zrnEx9MjTgZfscJIG3+QA6LrgnGxPmM/aToNrhfAy?= =?us-ascii?Q?hi0HhzFTKYgojQMIoilpZZr3Ct6UVwGfPakN5D1K+ilcqhyBriEpu14Tu3CQ?= =?us-ascii?Q?dZtZOWpGwegdWC5XS731sUI+/rOHv37bC88+tGLxMgME4DZMcHeJttk0iUJ+?= =?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XgRNQiwxFE+7e1eqBIrACXHWKY763A8uM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2017 10:17:11.0829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f63fd12f-7fab-42f6-c79b-08d52b48deac X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1993 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.109 Subject: [Qemu-devel] [PATCH 1/5] qcow2: reject unaligned offsets in write compressed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Misaligned compressed write is not supported. Signed-off-by: Anton Nefedov Reviewed-by: Eric Blake --- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 92cb9f9..45c5651 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3349,6 +3349,10 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, return bdrv_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, NULL); } + if (offset_into_cluster(s, offset)) { + return -EINVAL; + } + buf = qemu_blockalign(bs, s->cluster_size); if (bytes != s->cluster_size) { if (bytes > s->cluster_size ||