selftests/bpf: Check if the digest is refreshed after a file write
authorRoberto Sassu <roberto.sassu@huawei.com>
Wed, 2 Mar 2022 11:14:01 +0000 (12:14 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Mar 2022 02:57:54 +0000 (18:57 -0800)
commit91e8fa254dbd0890c34286acdc12e96412305840
tree104a74b7fb4da33feca8414534af9c66594ca898
parent27a77d0d460cdeec57fda2bb6c4f8820ab6e8b38
selftests/bpf: Check if the digest is refreshed after a file write

Verify that bpf_ima_inode_hash() returns a non-fresh digest after a file
write, and that bpf_ima_file_hash() returns a fresh digest. Verification is
done by requesting the digest from the bprm_creds_for_exec hook, called
before ima_bprm_check().

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220302111404.193900-7-roberto.sassu@huawei.com
tools/testing/selftests/bpf/ima_setup.sh
tools/testing/selftests/bpf/prog_tests/test_ima.c
tools/testing/selftests/bpf/progs/ima.c