[v1,1/2] LSM: add a release() hook for the clean exit cleanup of the LSM modules
Commit Message
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(+)
Comments
On Sat, Mar 11, 2023 at 12:11:08AM +0100, Mirsad Goran Todorovac wrote:
> 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.
...
> 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>
As I told you, try to use my script instead, run it as
`ge2maintainer.sh -c 2 -v 2 HEAD~0 --annotate --cover-letter`
(assuming your 2 patches are on the top of the current branch
in the Git tree of Linux kernel source code).
It will create a template for the cover letter, automatically
applies To and Cc lists based on the MAINTAINERS database and
sends them.
@@ -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(+)
@@ -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. */
};