From: Mimi Zohar <zohar@linux.ibm.com>
To: ltp@lists.linux.it
Cc: Mimi Zohar <zohar@linux.ibm.com>,
Stefan Berger <stefanb@linux.ibm.com>,
Petr Vorel <pvorel@suse.cz>,
linux-integrity@vger.kernel.org
Subject: [PATCH v3 4/5] ima_violations.sh: additional ToMToU violation tests
Date: Wed, 5 Mar 2025 09:54:20 -0500 [thread overview]
Message-ID: <20250305145421.638857-4-zohar@linux.ibm.com> (raw)
In-Reply-To: <20250305145421.638857-1-zohar@linux.ibm.com>
Kernel patch "ima: limit the number of ToMToU integrity violations"
prevents superfluous ToMToU violations. Add corresponding LTP tests.
Link: https://lore.kernel.org/linux-integrity/20250228205505.476845-3-zohar@linux.ibm.com/
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
.../integrity/ima/tests/ima_violations.sh | 46 ++++++++++++++++++-
1 file changed, 45 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 d3081a4d1..0395f8d0a 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
@@ -8,7 +8,7 @@
TST_SETUP="setup"
TST_CLEANUP="cleanup"
-TST_CNT=6
+TST_CNT=8
REQUIRED_BUILTIN_POLICY="tcb"
REQUIRED_POLICY_CONTENT='violations.policy'
@@ -247,6 +247,50 @@ test6()
validate "$num_violations" "$count" "$search" 2
}
+test7()
+{
+ tst_res TINFO "verify limiting single open reader ToMToU violations"
+
+ local search="ToMToU"
+ local count num_violations
+
+ read num_violations < $IMA_VIOLATIONS
+ count="$(get_count $search)"
+
+ open_file_read
+ open_file_write
+ close_file_write
+
+ open_file_write
+ close_file_write
+ close_file_read
+
+ validate "$num_violations" "$count" "$search" 1
+}
+
+test8()
+{
+ tst_res TINFO "verify new open reader causes additional violation"
+
+ local search="ToMToU"
+ local count num_violations
+
+ read num_violations < $IMA_VIOLATIONS
+ count="$(get_count $search)"
+
+ open_file_read
+ open_file_write
+ close_file_write
+ close_file_read
+
+ open_file_read
+ open_file_write
+ close_file_write
+ close_file_read
+
+ validate "$num_violations" "$count" "$search" 2
+}
+
. ima_setup.sh
. daemonlib.sh
tst_run
--
2.48.1
next prev parent reply other threads:[~2025-03-05 14:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 14:54 [PATCH v3 1/5] ima_violations.sh: force $LOG ToMToU violation earlier Mimi Zohar
2025-03-05 14:54 ` [PATCH v3 2/5] ima_violations.sh: Update validate() to support multiple violations Mimi Zohar
2025-03-05 14:54 ` [PATCH v3 3/5] ima_violations.sh: additional open-writer violation tests Mimi Zohar
2025-03-05 14:54 ` Mimi Zohar [this message]
2025-03-05 14:54 ` [PATCH v3 5/5] ima_violations.sh: require kernel v6.14 for minimizing violations tests Mimi Zohar
2025-03-06 17:26 ` Petr Vorel
2025-03-06 21:02 ` Mimi Zohar
2025-03-06 17:07 ` [PATCH v3 1/5] ima_violations.sh: force $LOG ToMToU violation earlier Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250305145421.638857-4-zohar@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=stefanb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox