Skip to content

Commit 194c7ed

Browse files
committed
IMA: Move requirement check to ima_setup.sh
Link: https://lore.kernel.org/ltp/[email protected]/ Reviewed-by: Mimi Zohar <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
1 parent c195372 commit 194c7ed

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

testcases/kernel/security/integrity/ima/tests/evm_overlay.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
TST_SETUP="setup"
1010
TST_CLEANUP="cleanup"
1111
TST_CNT=4
12+
REQUIRED_BUILTIN_POLICY="appraise_tcb"
1213

1314
setup()
1415
{
@@ -17,8 +18,6 @@ setup()
1718
[ -f "$EVM_FILE" ] || tst_brk TCONF "EVM not enabled in kernel"
1819
[ $(cat $EVM_FILE) -eq 1 ] || tst_brk TCONF "EVM not enabled for this boot"
1920

20-
require_ima_policy_cmdline "appraise_tcb"
21-
2221
lower="$TST_MNTPOINT/lower"
2322
upper="$TST_MNTPOINT/upper"
2423
work="$TST_MNTPOINT/work"

testcases/kernel/security/integrity/ima/tests/ima_measurements.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0-or-later
33
# Copyright (c) 2009 IBM Corporation
4-
# Copyright (c) 2018-2021 Petr Vorel <[email protected]>
4+
# Copyright (c) 2018-2025 Petr Vorel <[email protected]>
55
# Author: Mimi Zohar <[email protected]>
66
#
77
# Verify that measurements are added to the measurement list based on policy.
8+
# Test requires ima_policy=tcb.
89

910
TST_NEEDS_CMDS="awk cut sed"
1011
TST_SETUP="setup"
1112
TST_CNT=3
13+
REQUIRED_BUILTIN_POLICY="tcb"
1214

1315
setup()
1416
{
15-
require_ima_policy_cmdline "tcb"
16-
1717
TEST_FILE="$PWD/test.txt"
1818
[ -f "$IMA_POLICY" ] || tst_res TINFO "not using default policy"
1919
}

testcases/kernel/security/integrity/ima/tests/ima_setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0-or-later
33
# Copyright (c) 2009 IBM Corporation
4-
# Copyright (c) 2018-2020 Petr Vorel <[email protected]>
4+
# Copyright (c) 2018-2025 Petr Vorel <[email protected]>
55
# Author: Mimi Zohar <[email protected]>
66

77
TST_TESTFUNC="test"
@@ -181,6 +181,10 @@ ima_setup()
181181
cd "$TST_MNTPOINT"
182182
fi
183183

184+
if [ "$REQUIRED_BUILTIN_POLICY" ]; then
185+
require_ima_policy_cmdline "$REQUIRED_BUILTIN_POLICY"
186+
fi
187+
184188
[ -n "$TST_SETUP_CALLER" ] && $TST_SETUP_CALLER
185189
}
186190

0 commit comments

Comments
 (0)