Skip to content

Commit

Permalink
security: audit and remove any unnecessary uses of module.h
Browse files Browse the repository at this point in the history
Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.
This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.

The advantage in removing such instances is that module.h itself
sources about 15 other headers; adding significantly to what we feed
cpp, and it can obscure what headers we are effectively using.

Since module.h might have been the implicit source for init.h
(for __init) and for export.h (for EXPORT_SYMBOL) we consider each
instance for the presence of either and replace as needed.

Cc: James Morris <[email protected]>
Cc: "Serge E. Hallyn" <[email protected]>
Cc: John Johansen <[email protected]>
Cc: Mimi Zohar <[email protected]>
Cc: Dmitry Kasatkin <[email protected]>
Cc: David Howells <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Paul Gortmaker <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Paul Gortmaker authored and James Morris committed Dec 12, 2018
1 parent 3aafb1f commit 876979c
Show file tree
Hide file tree
Showing 24 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion security/apparmor/apparmorfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/ctype.h>
#include <linux/security.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <linux/mount.h>
Expand Down
1 change: 0 additions & 1 deletion security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <linux/capability.h>
#include <linux/audit.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/lsm_hooks.h>
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/evm/evm_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/export.h>
#include <linux/crypto.h>
#include <linux/xattr.h>
#include <linux/evm.h>
Expand Down
1 change: 0 additions & 1 deletion security/integrity/evm/evm_posix_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* the Free Software Foundation, version 2 of the License.
*/

#include <linux/module.h>
#include <linux/xattr.h>
#include <linux/evm.h>

Expand Down
2 changes: 1 addition & 1 deletion security/integrity/evm/evm_secfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <linux/audit.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include "evm.h"

Expand Down
2 changes: 1 addition & 1 deletion security/integrity/iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* using a rbtree tree.
*/
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/rbtree.h>
#include <linux/file.h>
Expand Down
1 change: 0 additions & 1 deletion security/integrity/ima/ima_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* Implements must_appraise_or_measure, collect_measurement,
* appraise_measurement, store_measurement and store_template.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/fs.h>
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_appraise.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/xattr.h>
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <linux/fcntl.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/seq_file.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/init.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/err.h>
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* - initialize default measure policy rules
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/fs.h>
#include <linux/security.h>
Expand Down
1 change: 0 additions & 1 deletion security/integrity/ima/ima_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/rculist.h>
#include <linux/slab.h>
#include "ima.h"
Expand Down
1 change: 0 additions & 1 deletion security/keys/encrypted-keys/masterkey_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/err.h>
#include <keys/trusted-type.h>
#include <keys/encrypted-type.h>
Expand Down
1 change: 0 additions & 1 deletion security/keys/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* 2 of the Licence, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/security.h>
#include <keys/keyring-type.h>
Expand Down
2 changes: 1 addition & 1 deletion security/keys/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/poison.h>
#include <linux/sched.h>
Expand Down
1 change: 0 additions & 1 deletion security/keys/keyctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/sched/task.h>
Expand Down
2 changes: 1 addition & 1 deletion security/keys/keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/slab.h>
Expand Down
2 changes: 1 addition & 1 deletion security/keys/permission.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/security.h>
#include "internal.h"

Expand Down
1 change: 0 additions & 1 deletion security/keys/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion security/keys/process_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/sched/user.h>
Expand Down
2 changes: 1 addition & 1 deletion security/keys/request_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* See Documentation/security/keys/request-key.rst
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/err.h>
Expand Down
1 change: 0 additions & 1 deletion security/keys/request_key_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* See Documentation/security/keys/request-key.rst
*/

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/err.h>
#include <linux/seq_file.h>
Expand Down
2 changes: 1 addition & 1 deletion security/keys/user_defined.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
Expand Down
2 changes: 1 addition & 1 deletion security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/bpf.h>
#include <linux/capability.h>
#include <linux/dcache.h>
#include <linux/module.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/lsm_hooks.h>
Expand Down

0 comments on commit 876979c

Please sign in to comment.