Merge branch 'bpf-lsm: Extend interoperability with IMA'
authorAlexei Starovoitov <ast@kernel.org>
Fri, 11 Mar 2022 02:58:04 +0000 (18:58 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Mar 2022 03:10:13 +0000 (19:10 -0800)
commita77c2cfd4ee4bfb5267653dad3de8ec45a58b0b7
tree4b6611d6f456f2f2ef7c44e1ce579cffece0ef11
parent357b3cc3c0467b2f7cd6c4a87f7a18bfd779ce5b
parent7bae42b68d7f070a346fde4c7c1ce182f2284933
Merge branch 'bpf-lsm: Extend interoperability with IMA'

Roberto Sassu says:

====================
Extend the interoperability with IMA, to give wider flexibility for the
implementation of integrity-focused LSMs based on eBPF.

Patch 1 fixes some style issues.

Patches 2-6 give the ability to eBPF-based LSMs to take advantage of the
measurement capability of IMA without needing to setup a policy in IMA
(those LSMs might implement the policy capability themselves).

Patches 7-9 allow eBPF-based LSMs to evaluate files read by the kernel.

Changelog

v2:
- Add better description to patch 1 (suggested by Shuah)
- Recalculate digest if it is not fresh (when IMA_COLLECTED flag not set)
- Move declaration of bpf_ima_file_hash() at the end (suggested by
  Yonghong)
- Add tests to check if the digest has been recalculated
- Add deny test for bpf_kernel_read_file()
- Add description to tests

v1:
- Modify ima_file_hash() only and allow the usage of the function with the
  modified behavior by eBPF-based LSMs through the new function
  bpf_ima_file_hash() (suggested by Mimi)
- Make bpf_lsm_kernel_read_file() sleepable so that bpf_ima_inode_hash()
  and bpf_ima_file_hash() can be called inside the implementation of
  eBPF-based LSMs for this hook
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>