mbox series

[bpf-next,v4,0/4] Fixes for ima selftest

Message ID 20201203191437.666737-1-kpsingh@chromium.org (mailing list archive)
Headers show
Series Fixes for ima selftest | expand

Message

KP Singh Dec. 3, 2020, 7:14 p.m. UTC
From: KP Singh <kpsingh@google.com>

# v3 -> v4

* Fix typos.
* Update commit message for the indentation patch.
* Added Andrii's acks.

# v2 -> v3

* Added missing tags.
* Indentation fixes + some other fixes suggested by Andrii.
* Re-indent file to tabs.

The selftest for the bpf_ima_inode_hash helper uses a shell script to
setup the system for ima. While this worked without an issue on recent
desktop distros, it failed on environments with stripped out shells like
busybox which is also used by the bpf CI.

This series fixes the assumptions made on the availablity of certain
command line switches and the expectation that securityfs being mounted
by default.

It also adds the missing kernel config dependencies in
tools/testing/selftests/bpf and, lastly, changes the indentation of
ima_setup.sh to use tabs.

KP Singh (4):
  selftests/bpf: Update ima_setup.sh for busybox
  selftests/bpf: Ensure securityfs mount before writing ima policy
  selftests/bpf: Add config dependency on BLK_DEV_LOOP
  selftests/bpf: Indent ima_setup.sh with tabs.

 tools/testing/selftests/bpf/config       |   1 +
 tools/testing/selftests/bpf/ima_setup.sh | 107 +++++++++++++----------
 2 files changed, 64 insertions(+), 44 deletions(-)

Comments

Andrii Nakryiko Dec. 3, 2020, 7:26 p.m. UTC | #1
On Thu, Dec 3, 2020 at 11:14 AM KP Singh <kpsingh@chromium.org> wrote:
>
> From: KP Singh <kpsingh@google.com>
>
> # v3 -> v4
>
> * Fix typos.
> * Update commit message for the indentation patch.
> * Added Andrii's acks.
>
> # v2 -> v3
>
> * Added missing tags.
> * Indentation fixes + some other fixes suggested by Andrii.
> * Re-indent file to tabs.
>
> The selftest for the bpf_ima_inode_hash helper uses a shell script to
> setup the system for ima. While this worked without an issue on recent
> desktop distros, it failed on environments with stripped out shells like
> busybox which is also used by the bpf CI.
>
> This series fixes the assumptions made on the availablity of certain
> command line switches and the expectation that securityfs being mounted
> by default.
>
> It also adds the missing kernel config dependencies in
> tools/testing/selftests/bpf and, lastly, changes the indentation of
> ima_setup.sh to use tabs.
>

Thanks, I think this reads much better. And a few months from now it
would be easier to understand and page back the context, if necessary.

I've pushed your fixes. ima selftest still emits a bunch of extra
output from dd and maybe other commands:

10+0 records in
10+0 records out
10485760 bytes (10.0MB) copied, 0.037096 seconds, 269.6MB/s
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
2560 inodes, 10240 blocks
512 blocks (5%) reserved for the super user
First data block=1
Maximum filesystem blocks=262144
2 block groups
8192 blocks per group, 8192 fragments per group
1280 inodes per group
Superblock backups stored on blocks:
        8193

Please follow up at your earliest convenience to silence those in
default (non-verbose) mode.

> KP Singh (4):
>   selftests/bpf: Update ima_setup.sh for busybox
>   selftests/bpf: Ensure securityfs mount before writing ima policy
>   selftests/bpf: Add config dependency on BLK_DEV_LOOP
>   selftests/bpf: Indent ima_setup.sh with tabs.
>
>  tools/testing/selftests/bpf/config       |   1 +
>  tools/testing/selftests/bpf/ima_setup.sh | 107 +++++++++++++----------
>  2 files changed, 64 insertions(+), 44 deletions(-)
>
> --
> 2.29.2.576.ga3fc446d84-goog
>
patchwork-bot+netdevbpf@kernel.org Dec. 3, 2020, 7:30 p.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (refs/heads/master):

On Thu,  3 Dec 2020 19:14:33 +0000 you wrote:
> From: KP Singh <kpsingh@google.com>
> 
> # v3 -> v4
> 
> * Fix typos.
> * Update commit message for the indentation patch.
> * Added Andrii's acks.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v4,1/4] selftests/bpf: Update ima_setup.sh for busybox
    https://git.kernel.org/bpf/bpf-next/c/3db980449bc3
  - [bpf-next,v4,2/4] selftests/bpf: Ensure securityfs mount before writing ima policy
    https://git.kernel.org/bpf/bpf-next/c/1ee076719d4e
  - [bpf-next,v4,3/4] selftests/bpf: Add config dependency on BLK_DEV_LOOP
    https://git.kernel.org/bpf/bpf-next/c/d932e043b9d6
  - [bpf-next,v4,4/4] selftests/bpf: Indent ima_setup.sh with tabs.
    https://git.kernel.org/bpf/bpf-next/c/ffebecd9d495

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
KP Singh Dec. 4, 2020, 12:53 a.m. UTC | #3
[...]

> output from dd and maybe other commands:
>
> 10+0 records in
> 10+0 records out
> 10485760 bytes (10.0MB) copied, 0.037096 seconds, 269.6MB/s
> Filesystem label=
> OS type: Linux
> Block size=1024 (log=0)
> Fragment size=1024 (log=0)
> 2560 inodes, 10240 blocks
> 512 blocks (5%) reserved for the super user
> First data block=1
> Maximum filesystem blocks=262144
> 2 block groups
> 8192 blocks per group, 8192 fragments per group
> 1280 inodes per group
> Superblock backups stored on blocks:
>         8193
>
> Please follow up at your earliest convenience to silence those in
> default (non-verbose) mode.

Thanks, fixed. I added a verbosity flag to ima_setup.sh
and am using env.verbosity to toggle this extra output. I will send
in my patch tomorrow.

[...]