<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/tools/testing/selftests/bpf/progs/ima.c, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-03-11T02:57:55Z</updated>
<entry>
<title>selftests/bpf: Check that bpf_kernel_read_file() denies reading IMA policy</title>
<updated>2022-03-11T02:57:55Z</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-03-02T11:14:04Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7bae42b68d7f070a346fde4c7c1ce182f2284933'/>
<id>urn:sha1:7bae42b68d7f070a346fde4c7c1ce182f2284933</id>
<content type='text'>
Check that bpf_kernel_read_file() denies the reading of an IMA policy, by
ensuring that ima_setup.sh exits with an error.

Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220302111404.193900-10-roberto.sassu@huawei.com
</content>
</entry>
<entry>
<title>selftests/bpf: Add test for bpf_lsm_kernel_read_file()</title>
<updated>2022-03-11T02:57:55Z</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-03-02T11:14:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e6dcf7bbf37c9ae72b0bc3a09d5f91dd1f5c19e1'/>
<id>urn:sha1:e6dcf7bbf37c9ae72b0bc3a09d5f91dd1f5c19e1</id>
<content type='text'>
Test the ability of bpf_lsm_kernel_read_file() to call the sleepable
functions bpf_ima_inode_hash() or bpf_ima_file_hash() to obtain a
measurement of a loaded IMA policy.

Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220302111404.193900-9-roberto.sassu@huawei.com
</content>
</entry>
<entry>
<title>selftests/bpf: Check if the digest is refreshed after a file write</title>
<updated>2022-03-11T02:57:54Z</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-03-02T11:14:01Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=91e8fa254dbd0890c34286acdc12e96412305840'/>
<id>urn:sha1:91e8fa254dbd0890c34286acdc12e96412305840</id>
<content type='text'>
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 &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220302111404.193900-7-roberto.sassu@huawei.com
</content>
</entry>
<entry>
<title>selftests/bpf: Add test for bpf_ima_file_hash()</title>
<updated>2022-03-11T02:57:54Z</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-03-02T11:14:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=27a77d0d460cdeec57fda2bb6c4f8820ab6e8b38'/>
<id>urn:sha1:27a77d0d460cdeec57fda2bb6c4f8820ab6e8b38</id>
<content type='text'>
Add new test to ensure that bpf_ima_file_hash() returns the digest of the
executed files.

Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220302111404.193900-6-roberto.sassu@huawei.com
</content>
</entry>
<entry>
<title>selftests/bpf: Move sample generation code to ima_test_common()</title>
<updated>2022-03-11T02:57:54Z</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-03-02T11:13:59Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2746de3c53d64436a5a565e87d74b65d82ab6ac7'/>
<id>urn:sha1:2746de3c53d64436a5a565e87d74b65d82ab6ac7</id>
<content type='text'>
Move sample generator code to ima_test_common() so that the new function
can be called by multiple LSM hooks.

Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220302111404.193900-5-roberto.sassu@huawei.com
</content>
</entry>
<entry>
<title>bpf/selftests: Update the IMA test to use BPF ring buffer</title>
<updated>2021-02-05T00:35:05Z</updated>
<author>
<name>KP Singh</name>
<email>kpsingh@kernel.org</email>
</author>
<published>2021-02-04T19:36:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f446b570ac7e1e71ffd6d2a31ffbcc5f32330a6d'/>
<id>urn:sha1:f446b570ac7e1e71ffd6d2a31ffbcc5f32330a6d</id>
<content type='text'>
Instead of using shared global variables between userspace and BPF, use
the ring buffer to send the IMA hash on the BPF ring buffer. This helps
in validating both IMA and the usage of the ringbuffer in sleepable
programs.

Signed-off-by: KP Singh &lt;kpsingh@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210204193622.3367275-3-kpsingh@kernel.org
</content>
</entry>
<entry>
<title>bpf: Add a selftest for bpf_ima_inode_hash</title>
<updated>2020-11-25T23:25:47Z</updated>
<author>
<name>KP Singh</name>
<email>kpsingh@google.com</email>
</author>
<published>2020-11-24T15:12:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=34b82d3ac1058653b3de7be4697b55f67533b1f1'/>
<id>urn:sha1:34b82d3ac1058653b3de7be4697b55f67533b1f1</id>
<content type='text'>
The test does the following:

- Mounts a loopback filesystem and appends the IMA policy to measure
  executions only on this file-system. Restricting the IMA policy to
  a particular filesystem prevents a system-wide IMA policy change.
- Executes an executable copied to this loopback filesystem.
- Calls the bpf_ima_inode_hash in the bprm_committed_creds hook and
  checks if the call succeeded and checks if a hash was calculated.

The test shells out to the added ima_setup.sh script as the setup is
better handled in a shell script and is more complicated to do in the
test program or even shelling out individual commands from C.

The list of required configs (i.e. IMA, SECURITYFS,
IMA_{WRITE,READ}_POLICY) for running this test are also updated.

Suggested-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt; (limit policy rule to loopback mount)
Signed-off-by: KP Singh &lt;kpsingh@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20201124151210.1081188-4-kpsingh@chromium.org
</content>
</entry>
</feed>
