All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: ltp@lists.linux.it
Cc: Petr Vorel <pvorel@suse.cz>,
	Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
	linux-integrity@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>
Subject: [PATCH] ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured
Date: Fri, 21 Aug 2026 16:06:20 -0400	[thread overview]
Message-ID: <20260821200620.902699-1-zohar@linux.ibm.com> (raw)

test2 uses the last "selinux-state" record stored in the IMA measurement
list to determine whether SELinux is in enforcing mode and then compares
it to the selinux enforce file status.

The tst_update_selinux_state flips the SELinux enforce status
(/sys/fs/selinux/enforce) to force a new "selinux-state" record to be
appended to the IMA measurement list.  However, this only happens when
CONFIG_IMA_DISABLE_HTABLE is configured.

Don't fail the test when CONFIG_IMA_DISABLE_HTABLE is not configured.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 .../kernel/security/integrity/ima/tests/ima_selinux.sh      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
index e64a7739f..9b312f8b7 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
@@ -147,7 +147,11 @@ test2()
 	enforced_value=$(echo $measured_data | awk -F'[=;]' '{print $4}')
 	expected_enforced_value=$(cat $SELINUX_DIR/enforce)
 	if [ "$expected_enforced_value" != "$enforced_value" ]; then
-		tst_res $IMA_FAIL "enforce: expected: $expected_enforced_value, got: $enforced_value"
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"
+		else
+			tst_res $IMA_FAIL "enforce: expected: $expected_enforced_value, got: $enforced_value"
+		fi
 		return
 	fi
 
-- 
2.55.0


WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.ibm.com>
To: ltp@lists.linux.it
Cc: linux-integrity@vger.kernel.org,
	Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Subject: [LTP] [PATCH] ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured
Date: Fri, 21 Aug 2026 16:06:20 -0400	[thread overview]
Message-ID: <20260821200620.902699-1-zohar@linux.ibm.com> (raw)

test2 uses the last "selinux-state" record stored in the IMA measurement
list to determine whether SELinux is in enforcing mode and then compares
it to the selinux enforce file status.

The tst_update_selinux_state flips the SELinux enforce status
(/sys/fs/selinux/enforce) to force a new "selinux-state" record to be
appended to the IMA measurement list.  However, this only happens when
CONFIG_IMA_DISABLE_HTABLE is configured.

Don't fail the test when CONFIG_IMA_DISABLE_HTABLE is not configured.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 .../kernel/security/integrity/ima/tests/ima_selinux.sh      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
index e64a7739f..9b312f8b7 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
@@ -147,7 +147,11 @@ test2()
 	enforced_value=$(echo $measured_data | awk -F'[=;]' '{print $4}')
 	expected_enforced_value=$(cat $SELINUX_DIR/enforce)
 	if [ "$expected_enforced_value" != "$enforced_value" ]; then
-		tst_res $IMA_FAIL "enforce: expected: $expected_enforced_value, got: $enforced_value"
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"
+		else
+			tst_res $IMA_FAIL "enforce: expected: $expected_enforced_value, got: $enforced_value"
+		fi
 		return
 	fi
 
-- 
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-08-21 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 20:06 Mimi Zohar [this message]
2026-08-21 20:06 ` [LTP] [PATCH] ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured Mimi Zohar
2026-08-21 20:26 ` [LTP] " linuxtestproject.agent

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=20260821200620.902699-1-zohar@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=nramas@linux.microsoft.com \
    --cc=pvorel@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.