[LTP] [PATCH 2/3] madvise11: Fix lockdown check

Martin Doucha mdoucha@suse.cz
Fri Sep 22 09:42:15 CEST 2023


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



More information about the ltp mailing list