public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ima_violations.sh: Wait for ima_mmap to exit
@ 2026-04-28 16:10 Petr Vorel
  2026-04-28 16:10 ` [PATCH 2/2] ima_violations.sh: ima_mmap.c: Replace sleep with checkpoints Petr Vorel
  2026-04-30  9:03 ` [PATCH 1/2] ima_violations.sh: Wait for ima_mmap to exit Cyril Hrubis
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2026-04-28 16:10 UTC (permalink / raw)
  To: ltp
  Cc: Petr Vorel, Cyril Hrubis, Avinesh Kumar, Wei Gao, Mimi Zohar,
	linux-integrity, Martin Doucha

This fixes a race when even 2 sec sleep is not enough (f26399583e was
a wrong approach).

While at it, check for ima_mmap exit code (missing since ever).

Fixes: f26399583e ("ima/{ima_measurements,ima_violations}.sh: Avoid running on tmpfs")
Fixes: 3a8efbcc46 ("This patch adds Integrity Measurement Architecture(IMA) testing support ...")
Reported-by: Martin Doucha <mdoucha@suse.cz>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../kernel/security/integrity/ima/tests/ima_violations.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
index 13cc9d804d..0c03c30786 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
@@ -157,6 +157,8 @@ test2()
 
 test3()
 {
+	local pid
+
 	tst_res TINFO "verify open_writers using mmapped files"
 
 	local search="open_writers"
@@ -168,6 +170,7 @@ test3()
 	echo 'testing testing' > $FILE
 
 	ima_mmap -f $FILE &
+	pid=$!
 	# wait for violations appear in logs
 	tst_sleep 1s
 
@@ -177,7 +180,10 @@ test3()
 	validate $num_violations $count $search
 
 	# wait for ima_mmap to exit, so we can umount
-	tst_sleep 2s
+	wait $pid
+	if [ $? -ne 0 ]; then
+		tst_brk TBROK "failed to execute ima_mmap"
+	fi
 }
 
 test4()
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-30  9:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 16:10 [PATCH 1/2] ima_violations.sh: Wait for ima_mmap to exit Petr Vorel
2026-04-28 16:10 ` [PATCH 2/2] ima_violations.sh: ima_mmap.c: Replace sleep with checkpoints Petr Vorel
2026-04-29 11:15   ` [LTP] " Martin Doucha
2026-04-29 12:00     ` Petr Vorel
2026-04-30  9:16   ` Cyril Hrubis
2026-04-30  9:03 ` [PATCH 1/2] ima_violations.sh: Wait for ima_mmap to exit Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox