* [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check
@ 2021-09-21 11:33 Martin Doucha
2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Martin Doucha @ 2021-09-21 11:33 UTC (permalink / raw)
To: ltp
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
include/tst_test_macros.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 91671d1b8..4a023b700 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -176,7 +176,7 @@ extern void *TST_RET_PTR;
break; \
} \
\
- if (TST_ERR == ERRNO) { \
+ if (TST_ERR == (ERRNO)) { \
TST_MSG_(TPASS | TTERRNO, " ", \
SSCALL, ##__VA_ARGS__); \
TST_PASS = 1; \
--
2.33.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips 2021-09-21 11:33 [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Martin Doucha @ 2021-09-21 11:33 ` Martin Doucha 2021-09-21 13:32 ` Petr Vorel 2021-09-21 14:03 ` Cyril Hrubis 2021-09-21 13:31 ` [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Petr Vorel 2021-09-21 13:39 ` Cyril Hrubis 2 siblings, 2 replies; 7+ messages in thread From: Martin Doucha @ 2021-09-21 11:33 UTC (permalink / raw) To: ltp Different kernels may return different module signature validation errors for null-param and invalid_param test cases. Skip both test cases when the kernel is in lockdown. Signed-off-by: Martin Doucha <mdoucha@suse.cz> --- .../syscalls/init_module/init_module02.c | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/testcases/kernel/syscalls/init_module/init_module02.c b/testcases/kernel/syscalls/init_module/init_module02.c index dac99a4da..ad6569a06 100644 --- a/testcases/kernel/syscalls/init_module/init_module02.c +++ b/testcases/kernel/syscalls/init_module/init_module02.c @@ -34,16 +34,16 @@ static struct tcase { unsigned long *size; const char *param; int cap; + int skip_in_lockdown; int exp_errno; - int lockdown_errno; } tcases[] = { - {"NULL-buffer", &null_buf, &size, "", 0, EFAULT, EFAULT}, - {"faulty-buffer", &faulty_buf, &size, "", 0, EFAULT, EFAULT}, - {"null-param", &buf, &size, NULL, 0, EFAULT, EPERM}, - {"zero-size", &buf, &zero_size, "", 0, ENOEXEC, ENOEXEC}, - {"invalid_param", &buf, &size, "status=invalid", 0, EINVAL, EPERM}, - {"no-perm", &buf, &size, "", 1, EPERM, EPERM}, - {"module-exists", &buf, &size, "", 0, EEXIST, EPERM}, + {"NULL-buffer", &null_buf, &size, "", 0, 0, EFAULT}, + {"faulty-buffer", &faulty_buf, &size, "", 0, 0, EFAULT}, + {"null-param", &buf, &size, NULL, 0, 1, EFAULT}, + {"zero-size", &buf, &zero_size, "", 0, 0, ENOEXEC}, + {"invalid_param", &buf, &size, "status=invalid", 0, 1, EINVAL}, + {"no-perm", &buf, &size, "", 1, 0, EPERM}, + {"module-exists", &buf, &size, "", 0, 1, EEXIST}, }; static void setup(void) @@ -67,23 +67,20 @@ static void run(unsigned int n) { struct tcase *tc = &tcases[n]; + if (tc->skip_in_lockdown && kernel_lockdown) { + tst_res(TCONF, "Kernel is locked down, skipping %s", tc->name); + return; + } + if (tc->cap) tst_cap_action(&cap_drop); /* Insert module twice */ - if (tc->exp_errno == EEXIST) { - if (kernel_lockdown) { - tst_res(TCONF, "Kernel is locked down, skipping %s", - tc->name); - return; - } - + if (tc->exp_errno == EEXIST) tst_module_load(MODULE_NAME, NULL); - } TST_EXP_FAIL(init_module(*tc->buf, *tc->size, tc->param), - kernel_lockdown ? tc->lockdown_errno : tc->exp_errno, - "TestName: %s", tc->name); + tc->exp_errno, "TestName: %s", tc->name); if (tc->exp_errno == EEXIST) tst_module_unload(MODULE_NAME); -- 2.33.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips 2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha @ 2021-09-21 13:32 ` Petr Vorel 2021-09-21 14:03 ` Cyril Hrubis 1 sibling, 0 replies; 7+ messages in thread From: Petr Vorel @ 2021-09-21 13:32 UTC (permalink / raw) To: Martin Doucha; +Cc: ltp Hi Martin, Reviewed-by: Petr Vorel <pvorel@suse.cz> Thanks! -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips 2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha 2021-09-21 13:32 ` Petr Vorel @ 2021-09-21 14:03 ` Cyril Hrubis 2021-09-22 9:46 ` Petr Vorel 1 sibling, 1 reply; 7+ messages in thread From: Cyril Hrubis @ 2021-09-21 14:03 UTC (permalink / raw) To: Martin Doucha; +Cc: ltp Hi! Looks good as well: Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips 2021-09-21 14:03 ` Cyril Hrubis @ 2021-09-22 9:46 ` Petr Vorel 0 siblings, 0 replies; 7+ messages in thread From: Petr Vorel @ 2021-09-22 9:46 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp Hi Martin, Cyril, thanks, merged! Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check 2021-09-21 11:33 [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Martin Doucha 2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha @ 2021-09-21 13:31 ` Petr Vorel 2021-09-21 13:39 ` Cyril Hrubis 2 siblings, 0 replies; 7+ messages in thread From: Petr Vorel @ 2021-09-21 13:31 UTC (permalink / raw) To: Martin Doucha; +Cc: ltp Hi Martin, Reviewed-by: Petr Vorel <pvorel@suse.cz> Thanks! -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check 2021-09-21 11:33 [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Martin Doucha 2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha 2021-09-21 13:31 ` [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Petr Vorel @ 2021-09-21 13:39 ` Cyril Hrubis 2 siblings, 0 replies; 7+ messages in thread From: Cyril Hrubis @ 2021-09-21 13:39 UTC (permalink / raw) To: Martin Doucha; +Cc: ltp Hi! Good catch. Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-22 9:46 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-09-21 11:33 [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Martin Doucha 2021-09-21 11:33 ` [LTP] [PATCH 2/2] syscalls/init_module02: Rewrite lockdown skips Martin Doucha 2021-09-21 13:32 ` Petr Vorel 2021-09-21 14:03 ` Cyril Hrubis 2021-09-22 9:46 ` Petr Vorel 2021-09-21 13:31 ` [LTP] [PATCH 1/2] Add missig parentheses to TST_EXP_FAIL() errno check Petr Vorel 2021-09-21 13:39 ` Cyril Hrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox