From: Avinesh Kumar via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] tst_security.sh: Use enforce toggle to trigger SELinux measurement
Date: Mon, 15 Jun 2026 13:13:57 +0200 [thread overview]
Message-ID: <20260615111358.73462-1-avinesh.kumar@suse.com> (raw)
In-Reply-To: <20260612190750.3946-1-linuxtestproject.agent@gmail.com>
Upstream kernel commit
644132a48f4e ("selinux: prune /sys/fs/selinux/checkreqprot") [0]
removed the selinux_ima_measure_state() call from the checkreqprot
write handler.
This broke tst_update_selinux_state() which relied on writing to
checkreqprot to trigger IMA measurements of SELinux state.
Switch to toggling the enforce value instead, which still triggers
selinux_ima_measure_state() on all kernel versions >= 5.12.
[0] https://github.com/torvalds/linux/commit/644132a48f4e28a1d949d162160869286f3e75de
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
testcases/lib/tst_security.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 820736c72..8c23bc5a0 100644
--- a/testcases/lib/tst_security.sh
+++ b/testcases/lib/tst_security.sh
@@ -142,10 +142,13 @@ tst_get_enforce()
tst_update_selinux_state()
{
- local val
+ local val orig_val
local dir=$(tst_get_selinux_dir)
[ -n "$dir" ] || return 1
- val=$(cat $dir/checkreqprot)
- echo $val > $dir/checkreqprot
+ # Toggle enforce to trigger SELinux state measurement
+ orig_val=$(cat $dir/enforce)
+ val=$((1 - orig_val))
+ echo $val > $dir/enforce
+ echo $orig_val > $dir/enforce
}
--
2.54.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-06-15 11:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 16:38 [LTP] [PATCH] tst_security.sh: Use enforce toggle to trigger SELinux measurement Avinesh Kumar via ltp
2026-06-12 19:07 ` [LTP] " linuxtestproject.agent
2026-06-15 11:13 ` Avinesh Kumar via ltp [this message]
2026-06-15 13:17 ` linuxtestproject.agent
2026-06-16 8:34 ` [LTP] [PATCH v2] " Andrea Cervesato via ltp
2026-06-16 9:25 ` Avinesh Kumar via ltp
2026-06-16 10:58 ` Andrea Cervesato via ltp
2026-06-30 7:57 ` Andrea Cervesato via ltp
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=20260615111358.73462-1-avinesh.kumar@suse.com \
--to=ltp@lists.linux.it \
--cc=avinesh.kumar@suse.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