@@ -9,6 +9,7 @@
TST_SETUP="setup"
TST_CLEANUP="cleanup"
TST_CNT=4
+REQUIRED_BUILTIN_POLICY="appraise_tcb"
setup()
{
@@ -17,8 +18,6 @@ setup()
[ -f "$EVM_FILE" ] || tst_brk TCONF "EVM not enabled in kernel"
[ $(cat $EVM_FILE) -eq 1 ] || tst_brk TCONF "EVM not enabled for this boot"
- require_ima_policy_cmdline "appraise_tcb"
-
lower="$TST_MNTPOINT/lower"
upper="$TST_MNTPOINT/upper"
work="$TST_MNTPOINT/work"
@@ -1,19 +1,19 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018-2025 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
#
# Verify that measurements are added to the measurement list based on policy.
+# Test requires ima_policy=tcb.
TST_NEEDS_CMDS="awk cut sed"
TST_SETUP="setup"
TST_CNT=3
+REQUIRED_BUILTIN_POLICY="tcb"
setup()
{
- require_ima_policy_cmdline "tcb"
-
TEST_FILE="$PWD/test.txt"
[ -f "$IMA_POLICY" ] || tst_res TINFO "not using default policy"
}
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018-2025 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
TST_TESTFUNC="test"
@@ -180,6 +180,10 @@ ima_setup()
cd "$TST_MNTPOINT"
fi
+ if [ "$REQUIRED_BUILTIN_POLICY" ]; then
+ require_ima_policy_cmdline "$REQUIRED_BUILTIN_POLICY"
+ fi
+
[ -n "$TST_SETUP_CALLER" ] && $TST_SETUP_CALLER
}
Signed-off-by: Petr Vorel <pvorel@suse.cz> --- .../kernel/security/integrity/ima/tests/evm_overlay.sh | 3 +-- .../kernel/security/integrity/ima/tests/ima_measurements.sh | 6 +++--- testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 6 +++++- 3 files changed, 9 insertions(+), 6 deletions(-)