diff mbox series

[1/1] ima_setup.sh: Fix loop device workaround

Message ID 20220920214301.12828-1-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/1] ima_setup.sh: Fix loop device workaround | expand

Commit Message

Petr Vorel Sept. 20, 2022, 9:43 p.m. UTC
Since 1f6bd6e66 ("tst_test.sh: Add $TST_ALL_FILESYSTEMS") ima_keys.sh
and other following tests fail on systems with tmpfs on $TMPDIR:

    ima_keys 1 TCONF: IMA policy does not specify '^measure.*func=KEY_CHECK'
    tst_device.c:255: TWARN: ioctl(/dev/loop0, LOOP_CLR_FD, 0) no ENXIO for too long

    Usage:
    tst_device acquire [size [filename]]
    tst_device release /path/to/device
    tst_device clear /path/to/device

    ima_keys 1 TWARN: Failed to release device '/dev/loop0'
    rm: cannot remove '/tmp/LTP_ima_keys.YArl935DCg/mntpoint': Device or resource busy

unset TST_NEEDS_DEVICE should have been done before loading tst_test.sh,
as it's not a good idea to modify TST_* variables after loading tst_test.sh
(It worked before just by change).

Fixes: 04021637f ("tst_test.sh: Cleanup getopts usage")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Li Wang Sept. 21, 2022, 2:08 a.m. UTC | #1
Reviewed-by: Li Wang <liwang@redhat.com>
Petr Vorel Sept. 22, 2022, 12:24 p.m. UTC | #2
Hi all,

FYI this needs more fixes (WIP).

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
index a626aae44..4b6690ce6 100644
--- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
@@ -348,10 +348,9 @@  require_evmctl()
 	fi
 }
 
-. tst_test.sh
-
 # loop device is needed to use only for tmpfs
 TMPDIR="${TMPDIR:-/tmp}"
 if [ "$(df -T $TMPDIR | tail -1 | awk '{print $2}')" != "tmpfs" -a -n "$TST_NEEDS_DEVICE" ]; then
 	unset TST_NEEDS_DEVICE
 fi
+. tst_test.sh