From patchwork Mon Nov 28 14:42:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 13057624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6BEBC4321E for ; Mon, 28 Nov 2022 14:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbiK1Ond (ORCPT ); Mon, 28 Nov 2022 09:43:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiK1OnL (ORCPT ); Mon, 28 Nov 2022 09:43:11 -0500 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4226AF3D; Mon, 28 Nov 2022 06:43:09 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4NLShl3G7Cz9xGXF; Mon, 28 Nov 2022 22:36:39 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP1 (Coremail) with SMTP id LxC2BwC3oG3iyIRjL9qiAA--.42928S2; Mon, 28 Nov 2022 15:42:49 +0100 (CET) From: Roberto Sassu To: paul@paul-moore.com, casey@schaufler-ca.com, omosnace@redhat.com, john.johansen@canonical.com, kpsingh@kernel.org Cc: bpf@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Subject: [PATCH v2 0/2] lsm: Improve LSM hooks documentation Date: Mon, 28 Nov 2022 15:42:38 +0100 Message-Id: <20221128144240.210110-1-roberto.sassu@huaweicloud.com> X-Mailer: git-send-email 2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VFxhVjvjDU0xZFpf9x07jzQ6JUUUUU= X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQAKBF1jj4X7EgABsT X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org From: Roberto Sassu The recent discussion about return values from LSM hooks, available here: https://lore.kernel.org/bpf/20221115175652.3836811-1-roberto.sassu@huaweicloud.com/ motivated revisiting the documentation in include/linux/lsm_hooks.h, to ensure that it is complete and accurate. It was also a good occasion to fix discovered formatting issues. Changelog: v1 (security: Ensure LSMs return expected values): - A positive value, not only 1 can cause cap_set_admin to be set when calling __vm_enough_memory() (reported by Paul) - Improve description of the vm_enough_memory hook - Remove documentation of the sb_add_mnt_opt hook, as it was removed (reported by Paul) - Add more periods in the parameters description - Adjust mmap_addr and mmap_file semicolon - Move description of gfp parameter of xfrm_policy_alloc_security together with the others - Add missing return value description for binder_transaction, binder_transfer_binder, binder_transfer_file, quotactl and quota_on - Improve return value description for sb_eat_lsm_opts, sb_show_options, dentry_init_security, dentry_create_files_as and sctp_assoc_established Roberto Sassu (2): lsm: Clarify documentation of vm_enough_memory hook lsm: Add/fix return values in lsm_hooks.h and fix formatting include/linux/lsm_hooks.h | 227 ++++++++++++++++++++++++-------------- 1 file changed, 143 insertions(+), 84 deletions(-) Reviewed-by: Casey Schaufler