Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp597340rwb; Wed, 7 Dec 2022 02:36:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5C6zvG8ObInXo0eHUQ7/nOTYRufDC2IYz/3MLqXgY6K+fEXPVJTTLmLt/rSly46IqG4XNR X-Received: by 2002:a17:902:784c:b0:189:65c5:4507 with SMTP id e12-20020a170902784c00b0018965c54507mr57000746pln.172.1670409377034; Wed, 07 Dec 2022 02:36:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670409377; cv=none; d=google.com; s=arc-20160816; b=I4IYueq1wtc8VCIYUS4Z6pKMRkeMCkni3ciaJknLbIWKg4BEAwEDovEJUxKCNnlV6e tgIM0b+DkX5CC4V3RIf7YVKJPrA4qpWco++d7fIkRKBuwRf2PHweOpVe3Ct2WTwhnA5P wMkrkKINntlh9BPrZq3uDRsw5v2Nq9LwY2w3OGJCkGzDlqoxC5EWABmPZoHSjm2wmFNo pi+cVu76oWrnLNAeztuCLMGP0aNZrXczlsfCocojrAjXtMP9yH47XLNv9YiITvND/KZP 7G0G9OlKlDwuibOqk2n7/e3wyOHV4LKJA6aGU9xEhwXacL7v+ZLSxlOP4v9eCCuG03/b ZiEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=HpPJ17DHNKAY0goYxuL0xYcXvkKNoTdZMfZL7VdeWOM=; b=vCX7c/pQmkQJhMCtME30nNBT8y11Mz0ETCNCSt2AV8gUZFLWPKLnr7JwhCEXHZj4SM 4QIP4PiPrtUO6TE7U3BkCoC8AqZW/hmbO1pC36tn1yYi6yy78T0+Y5tdmmjlykocW2GC f+TbgBYeUmlDGZ4HQZPKlE/pcygJrVaTd0KwvoXSvXquId55BXXtdqkEzj2k1bz75sDA aEveUqnt9bFmEV5/nW+cv45/QVTa77IVdYj9ACgR9E1C694ijNZX2cjPD+g1KAMMe1Ve ExBTbaNAplxWVHBXdTLVoX1Kelj9HF0xSxcx7ALvMrz9oqbwk/o4g79tyQA8Z70zlPRh 8o5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc15-20020a17090b3b8f00b0021a1261c317si1229893pjb.126.2022.12.07.02.36.06; Wed, 07 Dec 2022 02:36:17 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiLGJSr (ORCPT + 76 others); Wed, 7 Dec 2022 04:18:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiLGJSW (ORCPT ); Wed, 7 Dec 2022 04:18:22 -0500 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B05C00; Wed, 7 Dec 2022 01:18:20 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4NRs3X4pZqz9v7H4; Wed, 7 Dec 2022 17:11:36 +0800 (CST) Received: from roberto-ThinkStation-P620 (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwDH+fVBWpBjTaXHAA--.61258S2; Wed, 07 Dec 2022 10:18:01 +0100 (CET) Message-ID: <0682348d9601ca3847ce9ba035e4ab1b586cf712.camel@huaweicloud.com> Subject: Re: [PATCH v2 2/2] lsm: Add/fix return values in lsm_hooks.h and fix formatting From: Roberto Sassu To: Paul Moore , David Howells Cc: casey@schaufler-ca.com, omosnace@redhat.com, john.johansen@canonical.com, kpsingh@kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Date: Wed, 07 Dec 2022 10:17:49 +0100 In-Reply-To: <7225e76c09c7ff68937e37ee041fefdd6ccac1c8.camel@huaweicloud.com> References: <20221128144240.210110-1-roberto.sassu@huaweicloud.com> <20221128144240.210110-3-roberto.sassu@huaweicloud.com> <7225e76c09c7ff68937e37ee041fefdd6ccac1c8.camel@huaweicloud.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-CM-TRANSID: GxC2BwDH+fVBWpBjTaXHAA--.61258S2 X-Coremail-Antispam: 1UD129KBjvJXoWxZrWrZw1UJr47tF4Utw45trb_yoW5Jw4kpF Z5G3WYyF1kZryIkr43A3W7Jw4Sy395KF13XryxWw18Zw1YyrWxKryakF4Y9FWDGrWkCFyj vFWaq3sruFy7AaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42 xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UWE__UUUUU= X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQATBF1jj4ZgCAAAsJ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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, 2022-12-07 at 08:58 +0100, Roberto Sassu wrote: > On Tue, 2022-12-06 at 19:21 -0500, Paul Moore wrote: > > On Mon, Nov 28, 2022 at 9:43 AM Roberto Sassu > > wrote: > > > From: Roberto Sassu > > > > > > Ensure that for non-void LSM hooks there is a description of the return > > > values. > > > > > > Also, replace spaces with tab for indentation, remove empty lines between > > > the hook description and the list of parameters, adjust semicolons and add > > > the period at the end of the parameter description. > > > > > > Finally, move the description of gfp parameter of the > > > xfrm_policy_alloc_security hook together with the others. > > > > > > Signed-off-by: Roberto Sassu > > > --- > > > include/linux/lsm_hooks.h | 221 ++++++++++++++++++++++++-------------- > > > 1 file changed, 138 insertions(+), 83 deletions(-) > > > > Thanks Roberto, I've merged this into lsm/next with one small tweak (below). > > > > > diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h > > > index c35e260efd8c..6502a1bea93a 100644 > > > --- a/include/linux/lsm_hooks.h > > > +++ b/include/linux/lsm_hooks.h > > > @@ -677,7 +695,7 @@ > > > * indicates which of the set*uid system calls invoked this hook. If > > > * @new is the set of credentials that will be installed. Modifications > > > * should be made to this rather than to @current->cred. > > > - * @old is the set of credentials that are being replaces > > > + * @old is the set of credentials that are being replaces. > > > > Might as well change "replaces" to "replaced". I'll go ahead and fix > > that up during the merge. > > Thanks a lot! Ops, I found an issue for fs_context_parse_param. It seems that the kernel doc and lsm_hooks.h provide different conventions for it. + David Kernel doc: It should return 0 to indicate that the parameter should be passed on to the filesystem, 1 to indicate that the parameter should be discarded or an error to indicate that the parameter should be rejected. lsm_hooks.h: The LSM may reject it with an error and may use it for itself, in which case it should return 0; otherwise it should return -ENOPARAM to pass it on to the filesystem. Looking at the code, the latter seems the right one. I would send another patch to fix the kernel doc. For this patch, I saw it is already in lsm/next. Paul, should I do an incremental patch or change the one in the repo and you force push it? I would just remove the three lines after the parameters description. Thanks Roberto