Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp142646rwl; Wed, 9 Aug 2023 12:13:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnj/0Vor4y+IaokQ60InnSabu7+ADJAkw8xCXesySyVdiRrl3Vp/npwfEa5X/txB0AelFy X-Received: by 2002:adf:ef10:0:b0:317:5caa:c3a3 with SMTP id e16-20020adfef10000000b003175caac3a3mr237882wro.40.1691608410605; Wed, 09 Aug 2023 12:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691608410; cv=none; d=google.com; s=arc-20160816; b=K2D1NQrGV/RJ5pH8ZE1zzlRtM/WfCvTFcbhMR1+WfEUhfwqZTJnuE2SjFd+CzpMMZX o5+xL1OCbcvHTcZObKHK8OSWkbQU6/U8dlcaaXN61IK9w+Z5o5KqY/Bm2H/bILfyzD2h SiGtUuAiAf7jq8rZne/A1kADzAjcQG0rxOHvIOtYLpmLsFi+BdcdrddG0C8drtBDft5L q4SBzqchAG/SlLek27kMxy3nncKJkBkPbraL7pgNDXKAcjqrD1vE7HkfFf6l9Ckqbn9Y fWGluSXZOIJtUqW7XXu94qN00GeA5EsTGLqxpnpwMALyAJCV2dPV4v7iES6fZRuI1YQe dpfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature:dkim-filter; bh=2BAEPHZjC1csVSUp5YiA21kHWYMQI2muR+jIz+ByF+4=; fh=u2t0AmUbP1C9Rr7nQuIBEiZUQFdXzXGYEo4DDLrNVnQ=; b=ZhqpJCQW57Ap3nUzliNTWlnStrztnBbxie7Cg3zD1ONDRcBNvUL1uzegkrGa8cl6ue CiJhlyZ+H8Lp+L/pBI2WV9is9clLUstN2ZhiTXQhdJ+0Qp4Q6ZySLfFkXeswY9oUTJkk M5p7CTmm01BgNb3htFP2Ot8nV8Q6r6q/otKxt5hsXImPFKjfLJKb3lFeH861JXF5wsSW +XTf8B/PCKwlnXxM16hHCh/AQc5YfFg+RnN6YmYtGcVdDwu2NxiRBfD8tpfpC4h/PSGX vzg0BZJ3b/4W1mMUj171mmqoQG2nU7K/1Sj0e2MZGfBwZRxM++BSZ1auHmNIJ8MhKnL0 9Gsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=V0JoJpg2; 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=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh15-20020a170906a0cf00b009885217c85bsi8919938ejb.275.2023.08.09.12.13.05; Wed, 09 Aug 2023 12:13:30 -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=@linux.microsoft.com header.s=default header.b=V0JoJpg2; 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=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232584AbjHISC4 (ORCPT + 99 others); Wed, 9 Aug 2023 14:02:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232245AbjHISCp (ORCPT ); Wed, 9 Aug 2023 14:02:45 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8FE2E19A1; Wed, 9 Aug 2023 11:02:43 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1052) id F276320FC4C4; Wed, 9 Aug 2023 11:02:42 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F276320FC4C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1691604163; bh=2BAEPHZjC1csVSUp5YiA21kHWYMQI2muR+jIz+ByF+4=; h=Date:From:To:Subject:References:In-Reply-To:From; b=V0JoJpg23L/peNkCEvzn4viDNmOHVq322EXzMIkHlzswJAG/7x2U+HK9aVOM+hySz mbJuWfMNHkSfC5A/dOjdMfskmaecJosfCzIgyyFlwjv23+hsdZtd9zVTW2hG2gpZGJ y6qnuS91reyXsJjl52Mc922yNssoBNVK4a9tvzQs= Date: Wed, 9 Aug 2023 11:02:42 -0700 From: Fan Wu To: Paul Moore , Mike Snitzer , corbet@lwn.net, zohar@linux.ibm.com, jmorris@namei.org, serge@hallyn.com, tytso@mit.edu, ebiggers@kernel.org, axboe@kernel.dk, agk@redhat.com, eparis@redhat.com, linux-doc@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org, dm-devel@redhat.com, audit@vger.kernel.org, roberto.sassu@huawei.com, linux-kernel@vger.kernel.org, Deven Bowers Subject: Re: [RFC PATCH v10 11/17] dm-verity: consume root hash digest and signature data via LSM hook Message-ID: <20230809180242.GA23396@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1687986571-16823-1-git-send-email-wufan@linux.microsoft.com> <1687986571-16823-12-git-send-email-wufan@linux.microsoft.com> <20230712034319.GA17642@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20230808224503.GA20095@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20230808234023.GC120054@agk-cloud1.hosts.prod.upshift.rdu2.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808234023.GC120054@agk-cloud1.hosts.prod.upshift.rdu2.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Wed, Aug 09, 2023 at 12:40:23AM +0100, Alasdair G Kergon wrote: > On Tue, Aug 08, 2023 at 03:45:03PM -0700, Fan Wu wrote: > > On Tue, Jul 25, 2023 at 04:43:48PM -0400, Paul Moore wrote: > > > Where would the finalize() hook be called? > > > > It is in the __bind function in drivers/md/dm.c, calling just before > > rcu_assign_pointer(md->map, (void *)t) which activates the inactive table. > > That would be after the existing commit point, meaning the table swap > cannot be cancelled there, so is the finalize() you are proposing void() > i.e. designed so it always succeeds? > > Alasdair Thanks for the input. Actually, no, the hook can be failed. I noticed the existing call before rcu_assign_pointer(md->map, (void *)t); (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c#n2255) can also be failed so I was following the same pattern. Could you explain a bit more about the "commit point"? It sounds like it might be better to move the hook call just before the commit point instead. -Fan