security: clarify that some code is really non-modular
Subsystems (4)
cover security: clarify that some code is really non-modular
The goal is to ensure that non-modular code doesn't appear modular just by accident. Here we have two more commits to do that and they are of the trivial nature (i.e. no ".remove" functions deleted and no need to block any unbind actions). We just change the registration functions to be the non modular versions and adjust the include headers to match.
Paul Gortmaker (2):
security/keys: make big_key.c explicitly non-modular security/integrity: make ima/ima_mok.c explicitly non-modular
security/integrity/ima/ima_mok.c | 5 ++--- security/keys/big_key.c | 15 +-------------- 2 files changed, 3 insertions(+), 17 deletions(-)
---
2.6.1
PATCH 1/2 security/keys: make big_key.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
config BIG_KEYS
bool "Large payload keys"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag since all that information is already contained at the top of the file in the comments.
--- security/keys/big_key.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
security/keys/big_key.c +1 -14
@@ -9,7 +9,6 @@* 2 of the Licence, or (at your option) any later version. */ -#include <linux/module.h> #include <linux/init.h> #include <linux/seq_file.h> #include <linux/file.h>
@@ -18,8 +17,6 @@#include <keys/user-type.h> #include <keys/big_key-type.h> -MODULE_LICENSE ("GPL" ); -/* * Layout of key payload words. */
@@ -212,18 +209,8 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen)return ret; } -/* -* Module stuff -*/ static int __init big_key_init (void ) {return register_key_type (&key_type_big_key); } - -static void __exit big_key_cleanup(void) -{ -unregister_key_type (&key_type_big_key); -} - -module_init (big_key_init); -module_exit (big_key_cleanup); +device_initcall (big_key_init);
Signature · 1 line
2.6.1
Re: [PATCH 1/2] security/keys: make big_key.c explicitly non-modular
Quoted 16 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:config
BIG_KEYS
bool "Large payload keys"...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.
Since
module_inittranslates todevice_initcallin the non-modular case, the init ordering remains unchanged with this commit.We also delete the
MODULE_LICENSEtag since all that information is already contained at the top of the file in the comments.
Quoted 6 lines
Cc David Howells <[email protected]>Cc James Morris <[email protected]>Cc "Serge E. Hallyn" <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
I've applied this patch to my next tree.
David
PATCH 2/2 security/integrity: make ima/ima_mok.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
ima/Kconfig:config IMA_MOK_KEYRING
ima/Kconfig: bool "Create IMA machine owner keys (MOK) and blacklist keyrings"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple of traces of modularity so that when reading the driver there is no doubt it really is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
--- security/integrity/ima/ima_mok.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
security/integrity/ima/ima_mok.c +2 -3
@@ -16,7 +16,7 @@#include <linux/sched.h> #include <linux/cred.h> #include <linux/err.h> -#include <linux/module.h> +#include <linux/init.h> #include <keys/asymmetric-type.h>
@@ -52,5 +52,4 @@ __init int ima_mok_init(void)set_bit (KEY_FLAG_KEEP , &ima_blacklist_keyring->flags);return 0 ; } - -module_init (ima_mok_init); +device_initcall (ima_mok_init);
Signature · 1 line
2.6.1
Re: [PATCH 2/2] security/integrity: make ima/ima_mok.c explicitly non-modular
Quoted 13 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:ima/Kconfig:config
IMA_MOK_KEYRING
ima/Kconfig: bool "Create IMA machine owner keys (MOK) and blacklist keyrings"...meaning that it currently is not being built as a module by anyone.
Lets remove the couple of traces of modularity so that when reading the driver there is no doubt it really is builtin-only.
Since
module_inittranslates todevice_initcallin the non-modular case, the init ordering remains unchanged with this commit.
Quoted 8 lines
Cc Mimi Zohar <[email protected]>Cc Dmitry Kasatkin <[email protected]>Cc James Morris <[email protected]>Cc "Serge E. Hallyn" <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Thanks, this patch is queued to be upstreamed with the original ima_mok keyring patch.
Mimi
Quoted 24 lines
--- security/integrity/ima/ima_mok.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)security/integrity/ima/ima_mok.c +2
-3@@ -16,7 +16,7 @@#include <linux/sched.h> #include <linux/cred.h> #include <linux/err.h> -#include <linux/module.h> +#include <linux/init.h> #include <keys/asymmetric-type.h> @@ -52,5 +52,4 @@ __init int ima_mok_init(void)set_bit (KEY_FLAG_KEEP , &ima_blacklist_keyring->flags);return 0 ; } - -module_init (ima_mok_init); +device_initcall (ima_mok_init);
David Howells
maintainerQuoted 3 lines · Paul Gortmaker
Paul Gortmaker (2):
security/keys: makebig_key.cexplicitly non-modularsecurity/integrity: makeima/ima_mok.cexplicitly non-modular
Note that I only see patch 1. Note also that [email protected] should now be [email protected].
David