Skip to contentSkip to conversation

uaccess.c: Skip on Lockdown/Secure Boot

PATCH In review Avinesh Kumar via ltp 2 participants 3 messages Jan 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uaccess.c: Skip on Lockdown/Secure Boot

following the commit (fca9460dee fw_load: Skip on Lockdown/Secure Boot) to take care of

ltp_uaccess 0 TINFO : module signature enforcement: off
insmod: ERROR: could not insert module ltp_uaccess.ko: Key was rejected by service

---
 testcases/kernel/device-drivers/uaccess/uaccess.c | 9 +++++++++
 1 file changed, 9 insertions(+)
testcases/kernel/device-drivers/uaccess/uaccess.c +9 -0
index ab6fa58a7..f337aba64 100644
@@ -29,6 +29,7 @@
 #include "test.h"
 #include "old_module.h"
 #include "safe_macros.h"
+#include "tst_security.h"
 
 #include "ltp_uaccess.h"
 
@@ -39,6 +40,12 @@ static const char dev_tcase[]	= "/sys/devices/" DEV_NAME "/tcase";
 static const char module_name[]	= DEV_NAME ".ko";
 static int module_loaded;
 
+static void setup(void)
+{
+	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
+		tst_brkm(TCONF, NULL, "Cannot load unsigned modules in Lockdown/Secure Boot");
+}
+
 static void cleanup(void)
 {
 	if (module_loaded)
@@ -94,6 +101,8 @@ int main(int argc, char *argv[])
 {
 	tst_parse_opts(argc, argv, NULL, NULL);
 
+	setup();
+
 	tst_require_root();
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
Signature · 5 lines
2.52.0


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

Hi Avinesh,

Quoted 5 lines

following the commit (fca9460dee fw_load: Skip on Lockdown/Secure Boot) to take care of

ltp_uaccess 0 TINFO : module signature enforcement: off
insmod: ERROR: could not insert module ltp_uaccess.ko: Key was rejected by service

...

Quoted 9 lines
testcases/kernel/device-drivers/uaccess/uaccess.c +5 -0
@@ -39,6 +40,12 @@ static const char dev_tcase[]	= "/sys/devices/" DEV_NAME "/tcase";
 static const char module_name[]	= DEV_NAME ".ko";
 static int module_loaded;
 
+static void setup(void)
+{
+	if (tst_lockdown_enabled() > 0 || tst_secureboot_enabled() > 0)
+		tst_brkm(TCONF, NULL, "Cannot load unsigned modules in Lockdown/Secure Boot");
+}

...

testcases/kernel/device-drivers/uaccess/uaccess.c int main(int argc, char *argv[]) · line 104

Quoted 1 line
testcases/kernel/device-drivers/uaccess/uaccess.c +1 -0
+	setup();

Thanks for fixing it!

Kind regards,
Petr

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