public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests
@ 2023-09-22  7:42 Martin Doucha
  2023-09-22  7:42 ` [LTP] [PATCH 2/3] madvise11: Fix lockdown check Martin Doucha
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin Doucha @ 2023-09-22  7:42 UTC (permalink / raw)
  To: ltp

Negative return value from the helper functions means no check could be
performend. Only positive return value indicates that secureboot/lockdown
is active.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/finit_module/finit_module02.c | 4 ++--
 testcases/kernel/syscalls/init_module/init_module02.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/finit_module/finit_module02.c b/testcases/kernel/syscalls/finit_module/finit_module02.c
index af4feb76b..223d9b388 100644
--- a/testcases/kernel/syscalls/finit_module/finit_module02.c
+++ b/testcases/kernel/syscalls/finit_module/finit_module02.c
@@ -83,8 +83,8 @@ static void setup(void)
 
 	tst_module_exists(MODULE_NAME, &mod_path);
 
-	kernel_lockdown = tst_lockdown_enabled();
-	secure_boot = tst_secureboot_enabled();
+	kernel_lockdown = tst_lockdown_enabled() > 0;
+	secure_boot = tst_secureboot_enabled() > 0;
 
 	SAFE_MKDIR(TEST_DIR, 0700);
 	fd_dir = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
diff --git a/testcases/kernel/syscalls/init_module/init_module02.c b/testcases/kernel/syscalls/init_module/init_module02.c
index 15a482664..e6730e21c 100644
--- a/testcases/kernel/syscalls/init_module/init_module02.c
+++ b/testcases/kernel/syscalls/init_module/init_module02.c
@@ -53,8 +53,8 @@ static void setup(void)
 
 	tst_module_exists(MODULE_NAME, NULL);
 
-	kernel_lockdown = tst_lockdown_enabled();
-	secure_boot = tst_secureboot_enabled();
+	kernel_lockdown = tst_lockdown_enabled() > 0;
+	secure_boot = tst_secureboot_enabled() > 0;
 	fd = SAFE_OPEN(MODULE_NAME, O_RDONLY|O_CLOEXEC);
 	SAFE_FSTAT(fd, &sb);
 	size = sb.st_size;
-- 
2.42.0


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 2/3] madvise11: Fix lockdown check
  2023-09-22  7:42 [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Martin Doucha
@ 2023-09-22  7:42 ` Martin Doucha
  2023-09-22  7:42 ` [LTP] [PATCH 3/3] Fix shell library secureboot and lockdown helpers Martin Doucha
  2023-09-22  8:57 ` [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Doucha @ 2023-09-22  7:42 UTC (permalink / raw)
  To: ltp

Negative return value from the helper functions means no check could be
performend. Only positive return value indicates that secureboot/lockdown
is active.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/madvise/madvise11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c
index 4c960dd35..3cde85ef5 100644
--- a/testcases/kernel/syscalls/madvise/madvise11.c
+++ b/testcases/kernel/syscalls/madvise/madvise11.c
@@ -325,7 +325,7 @@ static int open_unpoison_pfn(void)
 
 	TEST(open(debugfs_fp, O_WRONLY));
 
-	if (TST_RET == -1 && TST_ERR == EPERM && tst_lockdown_enabled()) {
+	if (TST_RET == -1 && TST_ERR == EPERM && tst_lockdown_enabled() > 0) {
 		tst_res(TINFO,
 			"Cannot restore soft-offlined memory due to lockdown");
 		return TST_RET;
-- 
2.42.0


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 3/3] Fix shell library secureboot and lockdown helpers
  2023-09-22  7:42 [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Martin Doucha
  2023-09-22  7:42 ` [LTP] [PATCH 2/3] madvise11: Fix lockdown check Martin Doucha
@ 2023-09-22  7:42 ` Martin Doucha
  2023-09-22  8:57 ` [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Doucha @ 2023-09-22  7:42 UTC (permalink / raw)
  To: ltp

Negative return value from the helper functions means no check could be
performend. Only positive return value indicates that secureboot/lockdown
is active.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/lib/tst_lockdown_enabled.c   | 2 +-
 testcases/lib/tst_secureboot_enabled.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/lib/tst_lockdown_enabled.c b/testcases/lib/tst_lockdown_enabled.c
index 0e40c428c..30abe3e5e 100644
--- a/testcases/lib/tst_lockdown_enabled.c
+++ b/testcases/lib/tst_lockdown_enabled.c
@@ -8,5 +8,5 @@
 
 int main(void)
 {
-	return !tst_lockdown_enabled();
+	return tst_lockdown_enabled() <= 0;
 }
diff --git a/testcases/lib/tst_secureboot_enabled.c b/testcases/lib/tst_secureboot_enabled.c
index 7c26fb118..dadc0413c 100644
--- a/testcases/lib/tst_secureboot_enabled.c
+++ b/testcases/lib/tst_secureboot_enabled.c
@@ -8,5 +8,5 @@
 
 int main(void)
 {
-	return !tst_secureboot_enabled();
+	return tst_secureboot_enabled() <= 0;
 }
-- 
2.42.0


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests
  2023-09-22  7:42 [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Martin Doucha
  2023-09-22  7:42 ` [LTP] [PATCH 2/3] madvise11: Fix lockdown check Martin Doucha
  2023-09-22  7:42 ` [LTP] [PATCH 3/3] Fix shell library secureboot and lockdown helpers Martin Doucha
@ 2023-09-22  8:57 ` Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2023-09-22  8:57 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi!
Patchset pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-22  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22  7:42 [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Martin Doucha
2023-09-22  7:42 ` [LTP] [PATCH 2/3] madvise11: Fix lockdown check Martin Doucha
2023-09-22  7:42 ` [LTP] [PATCH 3/3] Fix shell library secureboot and lockdown helpers Martin Doucha
2023-09-22  8:57 ` [LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox