Skip to contentSkip to conversation

ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

PATCH In review Mimi Zohar 3 participants 5 messages Aug 21 – Aug 26 Keys-trusted

lore
Share & tools
lore

Mimi Zohar

author maintainer
#0 lore raw

PATCH 1/1 ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

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.

---
 .../kernel/security/integrity/ima/tests/ima_selinux.sh      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/security/integrity/ima/tests/ima_selinux.sh +5 -1
index e64a7739f..9b312f8b7 100755
@@ -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
 
Signature · 1 line
2.55.0
#1 lore raw

Hi Mimi,

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh test2() · line 151

Quoted 4 lines · Mimi Zohar

ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh +2 -0
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"

Could this path report TCONF instead? Without duplicate records, test2 cannot compare the current enforcing state with a fresh measurement and returns before checking the remaining state fields. TPASS turns this untested configuration into a successful test result.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#2 lore raw

Hi Mimi,

Quoted 7 lines

Hi Mimi,

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh test2() · line 151

Quoted 4 lines · Mimi Zohar

ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh +2 -0
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"

I would suggest the same, it makes sense to use TCONF to make it visible that it's not an error but OTOH it was not actually tested due CONFIG_IMA_DISABLE_HTABLE not set. If you don't mind, I'd change TPASS to TCONF before merge (or feel free to send v2 with this change yourself with my

).

Thanks for the fix!

Kind regards,
Petr

Quoted 16 lines

Could this path report TCONF instead? Without duplicate records, test2 cannot compare the current enforcing state with a fresh measurement and returns before checking the remaining state fields. TPASS turns this untested configuration into a successful test result.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author maintainer
#3 lore raw

Hi Petr.

On Tue, 2026-08-25 at 06:44 +0200, Petr Vorel wrote:
[...]

Quoted 10 lines
Quoted 5 lines · Mimi Zohar

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh test2() · line 151

Quoted 4 lines

ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh +2 -0
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"

I would suggest the same, it makes sense to use TCONF to make it visible that it's not an error but OTOH it was not actually tested due CONFIG_IMA_DISABLE_HTABLE not set. If you don't mind, I'd change TPASS to TCONF before merge (or feel free to send v2 with this change yourself with my

Quoted 4 lines

).

Thanks for the fix!

Agreed, it should be TCONF. Please make the change.

thanks,

Mimi

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi Mimi,

Quoted 17 lines

Hi Petr.

On Tue, 2026-08-25 at 06:44 +0200, Petr Vorel wrote:
[...]

Quoted 12 lines
Quoted 5 lines · Mimi Zohar

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh test2() · line 151

Quoted 4 lines

ima_selinux.sh: test2 assumes CONFIG_IMA_DISABLE_HTABLE is configured

testcases/kernel/security/integrity/ima/tests/ima_selinux.sh +2 -0
+		if ! tst_check_kconfigs "CONFIG_IMA_DISABLE_HTABLE=y"; then
+			tst_res TPASS "Duplicate \"selinux-state\" record missing (CONFIG_IMA_DISABLE_HTABLE not set)"

I would suggest the same, it makes sense to use TCONF to make it visible that it's not an error but OTOH it was not actually tested due CONFIG_IMA_DISABLE_HTABLE not set. If you don't mind, I'd change TPASS to TCONF before merge (or feel free to send v2 with this change yourself with my

).

Quoted 3 lines
Quoted 1 line

Thanks for the fix!

Agreed, it should be TCONF. Please make the change.

Thanks for your ack, merged with TCONF.

Kind regards,
Petr

Quoted 3 lines

thanks,

Mimi

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp