[LTP] [PATCH] uaccess.c: Skip on Lockdown/Secure Boot

Avinesh Kumar via ltp
2026-01-08T13:00:37Z

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

Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
testcases/kernel/device-drivers/uaccess/uaccess.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/testcases/kernel/device-drivers/uaccess/uaccess.c b/testcases/kernel/device-drivers/uaccess/uaccess.c
index ab6fa58a7..f337aba64 100644
--- a/testcases/kernel/device-drivers/uaccess/uaccess.c
+++ b/testcases/kernel/device-drivers/uaccess/uaccess.c
@@ -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);

--
2.52.0