Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5195751rwe; Tue, 18 Apr 2023 03:35:06 -0700 (PDT) X-Google-Smtp-Source: AKy350bqTSTwUMSSLRWSzn8ufI51sDVwNco5HxGhTlEVesm3AJsmeDi3Clv+L33GjGjLTBzrCzgp X-Received: by 2002:a17:90b:2245:b0:247:4fe5:f09c with SMTP id hk5-20020a17090b224500b002474fe5f09cmr1765877pjb.15.1681814106348; Tue, 18 Apr 2023 03:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681814106; cv=none; d=google.com; s=arc-20160816; b=X/S/u/u/PpGsonGYzTtx7L0czkMbq0K6nHtVgaQmxQuUTTyjCyBa6AYmaj85N6dT0/ 4IMjdtvL1YfqdBsmdKRMLV6FioC/LThInrmSJuxuJpTVrZC785ecGdTAm3lQ0AuDsgKN fo1I/ImQJTHb7tH0yLgg5XHmh1DzTqXxWbrFLLzIom+bpx8oxyr7mb2Wj6gH+OTOWLhZ KuTlY6a2Mlp+r/nPFOkdJry5g10a0L2m/e5HhVrLde1ecjNQeYz2IC79XjrONI7KOFty ILzqZUptJ4dU0lsDSjftSVywH8owycKKH5SJE486NfcnTxiSwwE/FQNeq4bDyAfqZBiw nanQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=Ieh/gUYRt5bSe/KdKXCdJWHx36/0H7fpYMY5BgBqHkw=; b=dYMtgTe4aQWwjsJ52Ek4ugKTdqhQ72FZ+cEDdFrBkmomX3Z5D56GNDk9GcWWNWZ/LA SmR7QxIOWJizQIJoEmTuG8CT0lt08vYS9FQB/vhOXSXeGX2UJQhGwq2rRLBenYgoBWnb GWX06VhqoQgWM2v24ZeG9IsP8SBKTb+GbAz1D3zxOmI3gMerySRfudITpWImCmQdkaPC G18lRyFGpCfhGoBp/9YRxbsQpAvKGWHb5hUWYw/xVJ3TPJLFnvvSdXAkBXy56JqSeXoC xm6SZK+ezCFDSREFbl5Eijvvc+fbitEZepjorBVZr5soRPojLuBxqt7zEuaF1AW/8jOw 1SKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@veeam.com header.s=mx2-2022 header.b=FHdgIvLE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=veeam.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a17090a7e8700b002473e331f90si10721992pjl.46.2023.04.18.03.34.55; Tue, 18 Apr 2023 03:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@veeam.com header.s=mx2-2022 header.b=FHdgIvLE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=veeam.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbjDRKbx (ORCPT + 99 others); Tue, 18 Apr 2023 06:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbjDRKbv (ORCPT ); Tue, 18 Apr 2023 06:31:51 -0400 Received: from mx2.veeam.com (mx2.veeam.com [64.129.123.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B927686; Tue, 18 Apr 2023 03:31:43 -0700 (PDT) Received: from mail.veeam.com (prgmbx01.amust.local [172.24.128.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.veeam.com (Postfix) with ESMTPS id 9BAEE40654; Tue, 18 Apr 2023 06:31:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veeam.com; s=mx2-2022; t=1681813899; bh=Ieh/gUYRt5bSe/KdKXCdJWHx36/0H7fpYMY5BgBqHkw=; h=Date:Subject:From:To:CC:References:In-Reply-To:From; b=FHdgIvLEdzfYWs6a1UEMNuw+e5IR4GaNwsIIVmqX8CQbKdpdBPly+NyoGAxGGXVvg Q0DaBm7guu/cf8w4puslV0lVWpdLgD4AxCtEikS5ypeNs61nT7TTdE4xoeWZzejC05 E0hHXIuw43q7DknAk/1Jr8g5verfN6kSh9QxtJIfUKX4tEXdf0NCF1/W24HbcXsQSL yyZUefH61ZFraVALCirHmAYXQ/z6D8ABRKTj1bYkYuw6bj6GRYORzobmeUmrTYpyza uSKZwHJOMYBMVHCEaQbfjMsWCMloMwLpHYcyFlhqtr0Ak3J63iHJEPW39dacBxWNmI Cc7z50hvQeCXQ== Received: from [172.24.10.107] (172.24.10.107) by prgmbx01.amust.local (172.24.128.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 18 Apr 2023 12:31:32 +0200 Content-Type: multipart/mixed; boundary="------------diCWIp10pf2zmtUlXbMXuLz7" Message-ID: Date: Tue, 18 Apr 2023 12:31:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 03/11] documentation: Block Devices Snapshots Module Content-Language: en-US From: Sergei Shtepa To: Donald Buczek , , , , CC: , , , , , , , , , , , References: <20230404140835.25166-1-sergei.shtepa@veeam.com> <20230404140835.25166-4-sergei.shtepa@veeam.com> <86068780-bab3-2fc2-3f6f-1868be119b38@veeam.com> In-Reply-To: <86068780-bab3-2fc2-3f6f-1868be119b38@veeam.com> X-Originating-IP: [172.24.10.107] X-ClientProxiedBy: colmbx01.amust.local (172.31.112.31) To prgmbx01.amust.local (172.24.128.102) X-EsetResult: clean, is OK X-EsetId: 37303A2924031554677465 X-Veeam-MMEX: True X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --------------diCWIp10pf2zmtUlXbMXuLz7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit On 4/14/23 14:34, Sergei Shtepa wrote: > Subject: > Re: [PATCH v3 03/11] documentation: Block Devices Snapshots Module > From: > Sergei Shtepa > Date: > 4/14/23, 14:34 > > To: > Donald Buczek , axboe@kernel.dk, hch@infradead.org, corbet@lwn.net, snitzer@kernel.org > CC: > viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, kch@nvidia.com, martin.petersen@oracle.com, vkoul@kernel.org, ming.lei@redhat.com, gregkh@linuxfoundation.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org > > > > On 4/12/23 21:38, Donald Buczek wrote: >> Subject: >> Re: [PATCH v3 03/11] documentation: Block Devices Snapshots Module >> From: >> Donald Buczek >> Date: >> 4/12/23, 21:38 >> >> To: >> Sergei Shtepa , axboe@kernel.dk, hch@infradead.org, corbet@lwn.net, snitzer@kernel.org >> CC: >> viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, kch@nvidia.com, martin.petersen@oracle.com, vkoul@kernel.org, ming.lei@redhat.com, gregkh@linuxfoundation.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org >> >> >> I think, you can trigger all kind of user-after-free when userspace deletes a snapshot image or the snapshot image and the tracker while the disk device snapshot image is kept alive (mounted or just opened) and doing I/O. >> >> Here is what I did to provoke that: >> >> root@dose:~# s=$(blksnap snapshot_create -d /dev/vdb) >> root@dose:~# blksnap snapshot_appendstorage -i $s -f /scratch/local/test.dat >> device path: '/dev/block/253:2' >> allocate range: ofs=11264624 cnt=2097152 >> root@dose:~# blksnap snapshot_take -i $s >> root@dose:~# mount /dev/blksnap-image_253\:16 /mnt >> root@dose:~# dd if=/dev/zero of=/mnt/x.x & >> [1] 2514 >> root@dose:~# blksnap snapshot_destroy -i $s >> dd: writing to '/mnt/x.x': No space left on device >> 1996041+0 records in >> 1996040+0 records out >> 1021972480 bytes (1.0 GB, 975 MiB) copied, 8.48923 s, 120 MB/s >> [1]+  Exit 1                  dd if=/dev/zero of=/mnt/x.x >> > Thanks! > I am very glad that the blksnap tool turned out to be useful in the review. > This snapshot deletion scenario is not the most typical, but of course it is > quite possible. > I will need to solve this problem and add such a scenario to the test suite. > Hi! I have redesign the logic of ownership of the diff_area structure. See patch in attach or commit. Link: https://github.com/SergeiShtepa/linux/commit/7e927c381dcd2b2293be8315897a224d111b6f88 A test script for such a scenario has been added. Link: https://github.com/veeam/blksnap/commit/fd0559dfedf094901d08bbf185fed288f0156433 I will be glad of any feedback. --------------diCWIp10pf2zmtUlXbMXuLz7 Content-Type: text/x-patch; charset="UTF-8"; name="fix_diff_area_ownership.patch" Content-Disposition: attachment; filename="fix_diff_area_ownership.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvYmxvY2svYmxrc25hcC9jaHVuay5jIGIvZHJpdmVycy9i bG9jay9ibGtzbmFwL2NodW5rLmMKaW5kZXggODMyMjI4NjNkMzQ4Li43MzExM2M3MTRh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