mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/2] LSM: add a release() hook for the clean exit cleanup of the LSM modules
@ 2023-03-10 23:11 Mirsad Goran Todorovac
  2023-03-10 23:11 ` [PATCH v1 2/2] integrity: Add the release() hook to the integrity LSM module Mirsad Goran Todorovac
  2023-03-13 11:48 ` [PATCH v1 1/2] LSM: add a release() hook for the clean exit cleanup of the LSM modules Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Mirsad Goran Todorovac @ 2023-03-10 23:11 UTC (permalink / raw)
  To: Paul Moore, Roberto Sassu, linux-kernel
  Cc: Mirsad Goran Todorovac, Andy Shevchenko, Greg Kroah-Hartman,
	Mimi Zohar, Thomas Weißschuh, Casey Schaufler,
	Christian Göttsche, Mickaël Salaün,
	Frederick Lawler

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]

The LSM modules, namely integrity, do not have a clean way to deallocate
resources allocated in the init() hook or later in their lifetime. The
resources are destroyed on kernel shutdown in an undefined order.

This will allow a .release member per LSM module and calling proper
destructors in a well-behaved order.

Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mimi Zohar <zohar@linux.ibm.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Thomas Weißschuh <linux@weissschuh.net>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Cc: Christian Göttsche <cgzones@googlemail.com>
Cc: Mickaël Salaün <mic@digikod.net>
Cc: Frederick Lawler <fred@cloudflare.com>

---
 include/linux/lsm_hooks.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 6e156d2acffc..d5a6ab9b5eb2 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1724,6 +1724,7 @@ struct lsm_info {
 	unsigned long flags;	/* Optional: flags describing LSM */
 	int *enabled;		/* Optional: controlled by CONFIG_LSM */
 	int (*init)(void);	/* Required. */
+	int (*release)(void);	/* Release associated resources */
 	struct lsm_blob_sizes *blobs; /* Optional: for blob sharing. */
 };
 

--
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
 
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union

---
 include/linux/lsm_hooks.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 0a5ba81f7367..db3e57e7738b 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1724,6 +1724,7 @@ struct lsm_info {
 	unsigned long flags;	/* Optional: flags describing LSM */
 	int *enabled;		/* Optional: controlled by CONFIG_LSM */
 	int (*init)(void);	/* Required. */
+	int (*release)(void);	/* Release associated resources */
 	struct lsm_blob_sizes *blobs; /* Optional: for blob sharing. */
 };
 
-- 
2.30.2


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

end of thread, other threads:[~2023-03-13 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 23:11 [PATCH v1 1/2] LSM: add a release() hook for the clean exit cleanup of the LSM modules Mirsad Goran Todorovac
2023-03-10 23:11 ` [PATCH v1 2/2] integrity: Add the release() hook to the integrity LSM module Mirsad Goran Todorovac
2023-03-13 11:48 ` [PATCH v1 1/2] LSM: add a release() hook for the clean exit cleanup of the LSM modules Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®