Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3480586pxu; Tue, 15 Dec 2020 08:01:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBiTUDxAnIdcdc4TmThwvnjOF+MX4uXHk9zDm4RtV0ahwep9J9U1enGrrIqV1ItQKbS5KK X-Received: by 2002:a50:8e0e:: with SMTP id 14mr14496112edw.171.1608048065874; Tue, 15 Dec 2020 08:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608048065; cv=none; d=google.com; s=arc-20160816; b=sYVKbeuyIsf1A9H/ensSROfBVbSYUjJ7HUrc6VmSvtk5E4mFhUdoE5nBET6e4qIuPI iFKkrauTJs/9dLGUD12X6JQGBS0kwbgjK44zj3oepZ2dE0io3r5WK9UIftGKPTznMy/S DX/ebh5lmjvyZbIsdZTJXEv6I7OCD9xUxTLIskN5kCuImVsE0nadvlcqtGw6T0UdpOzA FlUQ0LHpehKYm5WKlkW3Vl9wJF8i5N050KiUBQtUdxvAZczytmfwsNN4h6PPvbVbGD8x egytY94msj3IBWwYakRBDAt4S5Acnbh+7JIgVJwIylNg8VsaIOXUDqsa3P4hVmWXDM19 WRBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xGX6r6A8Hjl7MCNVKGqT3FZ7eubP6L89FA+xBv0u2dU=; b=KIyNX8EM3yi/UubMVhrA0q+kVuhPCVCAAVXrW6AgZuOIUnPYjPTmL4aZKoMbiHjYrZ kpFRIWlfY1Q+8ot/RN16zcfw51iSHW1nnwJ/iSOLWPLdNstU6TDMaPrWO5CfMXeA1AhS dXKWTtE1e3Zu5160iZiIjJtkoU33/WDougVfKKyTxjpfRkRR9q2zyEO034dFYjrX62sA Qy44dVsKJfG4fciSCbFkFshr0y3uNqlXd25SM7nvfWopu5ol0fEcTnSRToKDdMYHKHs3 wKFtA1TTzladSVcMwP4NY6Zxe7gOJRR1jCDKpvSPpST+Q5pxI5nIT2ldezf903PHGTuf uI9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@veeam.com header.s=mx4 header.b=Kmgx22+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si1054388edb.389.2020.12.15.08.00.40; Tue, 15 Dec 2020 08:01:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@veeam.com header.s=mx4 header.b=Kmgx22+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730762AbgLOP6Z (ORCPT + 99 others); Tue, 15 Dec 2020 10:58:25 -0500 Received: from mx4.veeam.com ([104.41.138.86]:51820 "EHLO mx4.veeam.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730697AbgLOP5x (ORCPT ); Tue, 15 Dec 2020 10:57:53 -0500 Received: from mail.veeam.com (prgmbx01.amust.local [172.24.0.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx4.veeam.com (Postfix) with ESMTPS id E19C7B21B0; Tue, 15 Dec 2020 18:57:00 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veeam.com; s=mx4; t=1608047821; bh=xGX6r6A8Hjl7MCNVKGqT3FZ7eubP6L89FA+xBv0u2dU=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=Kmgx22+3snq91e1HH7f8cZ8yFER5ispuPCYFsol/fkmNAycaJmMtni9q3Lp35OBw8 rbQIoC0V6QmSvIxdkBMzyiWkCfyAgvoAQzRbxCCaXZzSxmuG27m0wHj+u03TpH/O+H LuTESvkS3LSH3WET7pOpkhwb++9NSnWJZ0HwrwqE= Received: from veeam.com (172.24.14.5) by prgmbx01.amust.local (172.24.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.721.2; Tue, 15 Dec 2020 16:56:59 +0100 Date: Tue, 15 Dec 2020 18:57:15 +0300 From: Sergei Shtepa To: Bob Liu CC: Hannes Reinecke , Jens Axboe , Mike Snitzer , "hch@lst.de" , "johannes.thumshirn@wdc.com" , "koct9i@gmail.com" , "ming.lei@redhat.com" , "josef@toxicpanda.com" , "steve@sk2.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Pavel Tide , "dm-devel@redhat.com" Subject: Re: [PATCH 0/3] block: blk_interposer - Block Layer Interposer Message-ID: <20201215155715.GA2541@veeam.com> References: <1607518911-30692-1-git-send-email-sergei.shtepa@veeam.com> <20201209135148.GA32720@redhat.com> <20201210145814.GA31521@veeam.com> <20201210163222.GB10239@redhat.com> <20201211163049.GC16168@redhat.com> <1ee7652e-b77f-6fa4-634c-ff6639037321@kernel.dk> <208edf35-ecdc-2d73-4c48-0424943a78c0@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: X-Originating-IP: [172.24.14.5] X-ClientProxiedBy: prgmbx01.amust.local (172.24.0.171) To prgmbx01.amust.local (172.24.0.171) X-EsetResult: clean, is OK X-EsetId: 37303A29C604D26A6D756B X-Veeam-MMEX: True Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 12/15/2020 09:51, Bob Liu wrote: > Hi Folks, > > On 12/12/20 12:56 AM, Hannes Reinecke wrote: > > On 12/11/20 5:33 PM, Jens Axboe wrote: > >> On 12/11/20 9:30 AM, Mike Snitzer wrote: > >>> While I still think there needs to be a proper _upstream_ consumer of > >>> blk_interposer as a condition of it going in.. I'll let others make the > >>> call. > >> > >> That's an unequivocal rule. > >> > >>> As such, I'll defer to Jens, Christoph and others on whether your > >>> minimalist blk_interposer hook is acceptable in the near-term. > >> > >> I don't think so, we don't do short term bandaids just to plan on > >> ripping that out when the real functionality is there. IMHO, the dm > >> approach is the way to go - it provides exactly the functionality that > >> is needed in an appropriate way, instead of hacking some "interposer" > >> into the core block layer. > >> > > Which is my plan, too. > > > > I'll be working with the Veeam folks to present a joint patchset (including the DM bits) for the next round. > > > > Besides the dm approach, do you think Veeam's original requirement is a good > use case of "block/bpf: add eBPF based block layer IO filtering"? > https://lwn.net/ml/bpf/20200812163305.545447-1-leah.rumancik@gmail.com/ > > Thanks, > Bob Hi Bob. Thank you for your message. I looked at your patch - it's interesting, but I have a few comments. 1. #ifdef CONFIG_BPF_IO_FILTER struct bpf_prog_array __rcu *progs; struct mutex io_filter_lock; #endif For DM and blk-snap to work, it is necessary that there is always the possibility of interception. 2. We could get rid of the io_filter_lock lock if we do attach/detach while the queue is stopped. And __rcu for *progs, can not use either. 3. int io_filter_bpf_run(struct bio *bio) { struct bpf_io_request io_req = { .sector_start = bio->bi_iter.bi_sector, .sector_cnt = bio_sectors(bio), .opf = bio->bi_opf, }; return BPF_PROG_RUN_ARRAY_CHECK(bio->bi_disk->progs, &io_req, BPF_PROG_RUN); } Allows to get little information. It will not allow to work with the bios`s data. blk_interposer allows to get full access to bio. For use in the DM, we must also be able to add new bio's. Summary: For device-mapper purposes, bpf_io_filter is not suitable. bpf_io_filter in this form is probably convenient to use for monitoring and studying the block layer. For the security task, I would suggest making a separate module and using blk_interposer to intercept bio requests. This will give more flexible functionality and better performance. -- Sergei Shtepa Veeam Software developer.