OSDN Git Service

ima: Implement ima_inode_hash
authorKP Singh <kpsingh@google.com>
Tue, 24 Nov 2020 15:12:08 +0000 (15:12 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 25 Nov 2020 23:04:04 +0000 (00:04 +0100)
commit403319be5de51167cd70ddf594b76c95e6d26844
tree330fb9618146152fb2f0e30c1168e91609e9e2be
parentdb13db9f67fe5049159a05e870daedcee5879f8d
ima: Implement ima_inode_hash

This is in preparation to add a helper for BPF LSM programs to use
IMA hashes when attached to LSM hooks. There are LSM hooks like
inode_unlink which do not have a struct file * argument and cannot
use the existing ima_file_hash API.

An inode based API is, therefore, useful in LSM based detections like an
executable trying to delete itself which rely on the inode_unlink LSM
hook.

Moreover, the ima_file_hash function does nothing with the struct file
pointer apart from calling file_inode on it and converting it to an
inode.

Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Mimi Zohar <zohar@linux.ibm.com>
Link: https://lore.kernel.org/bpf/20201124151210.1081188-2-kpsingh@chromium.org
include/linux/ima.h
security/integrity/ima/ima_main.c