linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][RFC][PATCH 1/3] lsm: Clarify documentation of vm_enough_memory hook
@ 2022-10-28 16:54 Roberto Sassu
  2022-10-28 16:54 ` [RESEND][RFC][PATCH 2/3] bpf-lsm: Limit values that can be returned by security modules Roberto Sassu
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Roberto Sassu @ 2022-10-28 16:54 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, mykolal, revest, jackmanb, shuah,
	paul, casey, zohar
  Cc: bpf, linux-security-module, linux-integrity, linux-kselftest,
	linux-kernel, nicolas.bouchinet

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 returning 1 from the LSMs means calling
__vm_enough_memory() with cap_sys_admin set, 0 without.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 include/linux/lsm_hooks.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 4ec80b96c22e..f40b82ca91e7 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1411,7 +1411,9 @@
  *	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 LSMs to the caller. LSMs should
+ *	return 1 if __vm_enough_memory() should be called with
+ *	cap_sys_admin set, 0 if not.
  *
  * @ismaclabel:
  *	Check if the extended attribute specified by @name
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-07 16:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 16:54 [RESEND][RFC][PATCH 1/3] lsm: Clarify documentation of vm_enough_memory hook Roberto Sassu
2022-10-28 16:54 ` [RESEND][RFC][PATCH 2/3] bpf-lsm: Limit values that can be returned by security modules Roberto Sassu
2022-11-03 15:09   ` KP Singh
2022-11-04 15:28     ` Roberto Sassu
2022-11-05  0:42       ` Alexei Starovoitov
2022-11-07 12:32         ` Roberto Sassu
2022-11-07 16:00           ` Alexei Starovoitov
2022-11-07 16:19             ` Roberto Sassu
2022-10-28 16:54 ` [RESEND][RFC][PATCH 3/3] selftests/bpf: Check if return values of LSM programs are allowed Roberto Sassu
2022-11-03 15:11 ` [RESEND][RFC][PATCH 1/3] lsm: Clarify documentation of vm_enough_memory hook KP Singh

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).