Skip to content

integrity: Move hooks into LSM

Kees Cook linux-hardening linux-integrity linux-security-module lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 34 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9integrity: Prepare for having "ima" and "evm" available in "integrity" LSMsecurity/Kconfig security/integrity/evm/evm_main.c security/integrity/iint.c +2 more+32 -99 replies
2/9security: Move trivial IMA hooks into LSMinclude/linux/ima.h security/integrity/ima/ima_main.c security/security.c+37 -1057 replies
3/9ima: Move xattr hooks into LSMinclude/linux/ima.h security/integrity/ima/ima.h security/integrity/ima/ima_appraise.c +2 more+32 -272 replies
4/9ima: Move ima_file_free() into LSMfs/file_table.c include/linux/ima.h security/integrity/ima/ima_main.c+2 -85 replies
5/9LSM: Introduce inode_post_setattr hookfs/attr.c include/linux/evm.h include/linux/ima.h +6 more+25 -191 reply
6/9fs: Introduce file_to_perms() helperinclude/linux/fs.h security/apparmor/include/file.h+26 -144 replies
7/9ima: Move ima_file_check() into LSMfs/namei.c fs/nfsd/vfs.c include/linux/ima.h +1 more+7 -210 replies
8/9integrity: Move trivial hooks into LSMinclude/linux/integrity.h security/integrity/iint.c security/integrity/integrity.h +1 more+12 -270 replies
9/9integrity: Move integrity_inode_get() out of global headerinclude/linux/integrity.h security/integrity/integrity.h+2 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] integrity: Move hooks into LSM

Hi,

It's been over 4 years since LSM stack was introduced. The integrity subsystem is long overdue for moving to this infrastructure. Here's my first pass at converting integrity and ima (and some of evm) into LSM hooks. This should be enough of an example to finish evm, and introduce the missing hooks for both. For example, after this, it looks like ima only has a couple places it's still doing things outside of the LSM. At least these stood out:

fs/namei.c:     ima_post_create_tmpfile(mnt_userns, inode);
fs/namei.c:                             ima_post_path_mknod(mnt_userns, dentry);

Mimi, can you please take this series and finish the conversion for what's missing in ima and evm?

I would also call attention to "175 insertions(+), 240 deletions(-)" -- as expected, this is a net reduction in code.

Thanks!

-Kees

Kees Cook (9):
integrity: Prepare for having "ima" and "evm" available in "integrity"
LSM
security: Move trivial IMA hooks into LSM
ima: Move xattr hooks into LSM
ima: Move ima_file_free() into LSM
LSM: Introduce inode_post_setattr hook
fs: Introduce file_to_perms() helper
ima: Move ima_file_check() into LSM
integrity: Move trivial hooks into LSM
integrity: Move integrity_inode_get() out of global header

 fs/attr.c                             |  3 +-
 fs/file_table.c                       |  1 -
 fs/namei.c                            |  2 -
 fs/nfsd/vfs.c                         |  6 --
 include/linux/evm.h                   |  6 --
 include/linux/fs.h                    | 22 +++++++
 include/linux/ima.h                   | 87 ---------------------------
 include/linux/integrity.h             | 30 +--------
 include/linux/lsm_hook_defs.h         |  3 +
 security/Kconfig                      | 10 +--
 security/apparmor/include/file.h      | 18 ++----
 security/integrity/evm/evm_main.c     | 14 ++++-
 security/integrity/iint.c             | 28 +++++++--
 security/integrity/ima/ima.h          | 12 ++++
 security/integrity/ima/ima_appraise.c | 21 +++++--
 security/integrity/ima/ima_main.c     | 66 ++++++++++++++------
 security/integrity/integrity.h        |  8 +++
 security/security.c                   | 78 ++++++------------------
 18 files changed, 175 insertions(+), 240 deletions(-)
Signature · 1 line
2.34.1