From: Roberto Sassu <roberto.sassu@huaweicloud.com>
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 <roberto.sassu@huawei.com>
Subject: [PATCH v2 1/2] lsm: Clarify documentation of vm_enough_memory hook
Date: Mon, 28 Nov 2022 15:42:39 +0100 [thread overview]
Message-ID: <20221128144240.210110-2-roberto.sassu@huaweicloud.com> (raw)
In-Reply-To: <20221128144240.210110-1-roberto.sassu@huaweicloud.com>
From: Roberto Sassu <roberto.sassu@huawei.com>
include/linux/lsm_hooks.h reports the result of the LSM infrastructure to
the callers, not what LSMs should return to the LSM infrastructure.
Clarify that and add that if all LSMs return a positive value
__vm_enough_memory() will be called with cap_sys_admin set. If at least one
LSM returns 0 or negative, it will be called with cap_sys_admin cleared.
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
include/linux/lsm_hooks.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 2831efebde69..c35e260efd8c 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1398,7 +1398,11 @@
* Check permissions for allocating a new virtual mapping.
* @mm contains the mm struct it is being added to.
* @pages contains the number of pages.
- * Return 0 if permission is granted.
+ * Return 0 if permission is granted by the LSM infrastructure to the
+ * caller. If all LSMs return a positive value, __vm_enough_memory() will
+ * be called with cap_sys_admin set. If at least one LSM returns 0 or
+ * negative, __vm_enough_memory() will be called with cap_sys_admin
+ * cleared.
*
* @ismaclabel:
* Check if the extended attribute specified by @name
--
2.25.1
next prev parent reply other threads:[~2022-11-28 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 14:42 [PATCH v2 0/2] lsm: Improve LSM hooks documentation Roberto Sassu
2022-11-28 14:42 ` Roberto Sassu [this message]
2022-12-06 22:51 ` [PATCH v2 1/2] lsm: Clarify documentation of vm_enough_memory hook Paul Moore
2022-11-28 14:42 ` [PATCH v2 2/2] lsm: Add/fix return values in lsm_hooks.h and fix formatting Roberto Sassu
2022-12-07 0:21 ` Paul Moore
2022-12-07 7:58 ` Roberto Sassu
2022-12-07 9:17 ` Roberto Sassu
2022-12-07 19:34 ` Paul Moore
2022-12-08 9:29 ` Roberto Sassu
2022-12-08 21:59 ` Paul Moore
2022-12-08 22:18 ` Casey Schaufler
2022-11-29 16:48 ` [PATCH v2 0/2] lsm: Improve LSM hooks documentation Casey Schaufler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221128144240.210110-2-roberto.sassu@huaweicloud.com \
--to=roberto.sassu@huaweicloud.com \
--cc=bpf@vger.kernel.org \
--cc=casey@schaufler-ca.com \
--cc=john.johansen@canonical.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).