Skip to contentSkip to conversation

fw_load0[12]: Skip on Lockdown and Secure Boot

PATCH Superseded Avinesh Kumar via ltp 2 participants 6 messages Jun 17 – Jun 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fw_load0[12]: Skip on Lockdown and Secure Boot

looks like these checks were lost in the recent commit converting these tests to new API.

tst_module.c:139: TINFO: module signature enforcement: off
insmod: ERROR: could not insert module ltp_fw_load.ko: Key was rejected by service

Fixes fd2c4d2c25d3 ("fw_load: rewrite test using new LTP API")
---
 testcases/kernel/firmware/fw_load/fw_load01.c | 3 +++
 testcases/kernel/firmware/fw_load/fw_load02.c | 3 +++
 2 files changed, 6 insertions(+)
testcases/kernel/firmware/fw_load/fw_load01.c +3 -0
index 4b30a3b40..c3d0c8c28 100644
@@ -57,6 +57,9 @@ static void setup(void)
 		tst_brk(TCONF, "Skipping test due to read-only %s",
 			LIB_PATH);
 
+	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
+			tst_brk(TCONF, "Cannot load unsigned modules in Lockdown/Secure Boot");
+
 	tst_requires_module_signature_disabled();
 
 	snprintf(fw_size_param, sizeof(fw_size_param), "fw_size=%d", FW_SIZE);
testcases/kernel/firmware/fw_load/fw_load02.c +3 -0
index 8d2063772..0a3a614d0 100644
@@ -54,6 +54,9 @@ static void setup(void)
 	char fw_size_param[32];
 	char *tmpdir = tst_tmpdir_path();
 
+	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
+			tst_brk(TCONF, "Cannot load unsigned modules in Lockdown/Secure Boot");
+
 	tst_requires_module_signature_disabled();
 
 	SAFE_FILE_PRINTF(FW_PATH, "%s", tmpdir);
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Avinesh,

Review

Quoted 4 lines · Avinesh Kumar

fw_load0[12]: Skip on Lockdown and Secure Boot

(quoted diff) +2 -0
+	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
+			tst_brk(TCONF, "Cannot load unsigned modules in Lockdown/Secure Boot");

Two issues here:

1) The tst_brk() line is indented with two extra tabs (three total) but should use one extra tab (two total) per kernel coding style.

2) struct tst_test already provides .skip_in_lockdown and .skip_in_secureboot fields that perform the same tst_lockdown_enabled()/tst_secureboot_enabled() checks from the framework initialization path. Using these declarative fields is the idiomatic approach:

    static struct tst_test test = {
        ...
        .skip_in_lockdown = 1,
        .skip_in_secureboot = 1,
    };

This would replace the manual if-statement in both fw_load01.c and fw_load02.c.

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
#2 lore raw

PATCH v2 1/1 fw_load0[12]: Skip on Lockdown and Secure Boot

these checks were lost in the recent commit converting these tests to new API.

tst_module.c:139: TINFO: module signature enforcement: off
insmod: ERROR: could not insert module ltp_fw_load.ko: Key was rejected by service tst_cmd.c:112: TBROK: 'insmod' exited with a non-zero code 1 at tst_cmd.c:112

with checks added:

tst_security.c:104: TINFO: Kernel lockdown: on tst_test.c:1467: TCONF: Kernel is locked down, skipping test

Fixes fd2c4d2c25d3 ("fw_load: rewrite test using new LTP API")

---
Changes in v2:
Use .skip_in_lockdown and .skip_in_secureboot fields in struct tst_test instead of tst_lockdown_enabled()/tst_secureboot_enabled()

---
 testcases/kernel/firmware/fw_load/fw_load01.c | 2 ++
 testcases/kernel/firmware/fw_load/fw_load02.c | 2 ++
 2 files changed, 4 insertions(+)
testcases/kernel/firmware/fw_load/fw_load01.c +2 -0
index 4b30a3b40..cdf0d387b 100644
@@ -108,4 +108,6 @@ static struct tst_test test = {
 		"CONFIG_FW_LOADER=y|CONFIG_FW_LOADER=m",
 		NULL,
 	},
+	.skip_in_lockdown = 1,
+	.skip_in_secureboot = 1,
 };
testcases/kernel/firmware/fw_load/fw_load02.c +2 -0
index 8d2063772..fbcfd3faf 100644
@@ -90,4 +90,6 @@ static struct tst_test test = {
 		{FW_PATH, NULL, TST_SR_TCONF},
 		{},
 	},
+	.skip_in_lockdown = 1,
+	.skip_in_secureboot = 1,
 };
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi

Quoted 48 lines

these checks were lost in the recent commit converting these tests to new API.

tst_module.c:139: TINFO: module signature enforcement: off
insmod: ERROR: could not insert module ltp_fw_load.ko: Key was rejected by service tst_cmd.c:112: TBROK: 'insmod' exited with a non-zero code 1 at tst_cmd.c:112

with checks added:

tst_security.c:104: TINFO: Kernel lockdown: on tst_test.c:1467: TCONF: Kernel is locked down, skipping test

Fixes fd2c4d2c25d3 ("fw_load: rewrite test using new LTP API")

---
Changes in v2:
Use .skip_in_lockdown and .skip_in_secureboot fields in struct tst_test instead of tst_lockdown_enabled()/tst_secureboot_enabled()

---
 testcases/kernel/firmware/fw_load/fw_load01.c | 2 ++
 testcases/kernel/firmware/fw_load/fw_load02.c | 2 ++
 2 files changed, 4 insertions(+)
testcases/kernel/firmware/fw_load/fw_load01.c +2 -0
index 4b30a3b40..cdf0d387b 100644
@@ -108,4 +108,6 @@ static struct tst_test test = {
 		"CONFIG_FW_LOADER=y|CONFIG_FW_LOADER=m",
 		NULL,
 	},
+	.skip_in_lockdown = 1,
+	.skip_in_secureboot = 1,
 };
testcases/kernel/firmware/fw_load/fw_load02.c +2 -0
index 8d2063772..fbcfd3faf 100644
@@ -90,4 +90,6 @@ static struct tst_test test = {
 		{FW_PATH, NULL, TST_SR_TCONF},
 		{},
 	},
+	.skip_in_lockdown = 1,
+	.skip_in_secureboot = 1,
 };
Signature · 1 line
2.54.0

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

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