[PATCH ima-evm-utils v2 7/9] Adapt fsverity.test to work with UML kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Roberto Sassu <roberto.sassu@xxxxxxxxxx>

Adapt fsverity.test by adding calls to the UML kernel API in functions.sh.
If the UML_MODE environment variable is set to 1, run first the UML kernel
specified as first argument of _run_user_mode() and execute the tests in
the new environment. Otherwise, keep the current behavior.

Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
---
 tests/fsverity.test | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tests/fsverity.test b/tests/fsverity.test
index 549c42a32608..84312aa08a30 100755
--- a/tests/fsverity.test
+++ b/tests/fsverity.test
@@ -49,7 +49,7 @@ _require dd mkfs blkid e2fsck tune2fs evmctl setfattr
 
 trap cleanup SIGINT SIGTERM EXIT
 
-cleanup() {
+_cleanup() {
         if [ -e $TST_MNT ]; then
 		if [ $LOOPBACK_MOUNTED -eq 1 ]; then
 			umount $TST_MNT
@@ -61,6 +61,11 @@ cleanup() {
 	_report_exit_and_cleanup
 }
 
+cleanup() {
+	_cleanup_user_mode _cleanup
+	_report_exit_and_cleanup
+}
+
 # Loopback mount a file
 mount_loopback_file() {
 	local ret
@@ -309,6 +314,15 @@ measure-ima() {
 	return "$error"
 }
 
+# Run in User Mode Linux.
+_run_user_mode ../linux $PWD/$(basename $0) "UML_MODE=$UML_MODE PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH VERBOSE=$VERBOSE"
+
+# Exit from the parent if UML was used.
+_exit_user_mode ../linux
+
+# Mount filesystems in UML environment.
+_init_user_mode
+
 # Dependency on being able to read and write the IMA policy file.
 # Requires both CONFIG_IMA_WRITE_POLICY, CONFIG_IMA_READ_POLICY be
 # enabled.
-- 
2.25.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux