syscalls/lsm_list_modules02: Log unrecognized LSM IDs with TINFO instead of TBROK
PATCH 1/1 syscalls/lsm_list_modules02: Log unrecognized LSM IDs with TINFO instead of TBROK
When running lsm_list_modules02 on systems with newer upstream kernels containing newly introduced LSMs, or on vendor/OEM kernels with out-of-tree security modules enabled, lsm_list_modules(ids, size, 0) returns valid LSM IDs that might not yet be mapped in the hardcoded switch (ids[i]) table.
Currently, encountering any unrecognized LSM ID causes the test to immediately terminate with tst_brk(TBROK, "Unsupported LSM: %lu", ids[i]). This prevents testing of other well-known standard LSMs present on the system.
Downgrade the unrecognized LSM ID handling from TBROK to TINFO and continue iterating over the remaining IDs. This improves test robustness across various kernel configurations while maintaining rigorous verification for all known standard LSM modules.
--- testcases/kernel/syscalls/lsm/lsm_list_modules02.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/lsm/lsm_list_modules02.c +5 -2
@@ -95,8 +95,11 @@ static void run(void)break ; } -if (!name) -tst_brk (TBROK ,"Unsupported LSM: %lu" , ids[i]); +if (!name) { +tst_res (TINFO ,"Skipping unrecognized LSM ID: %lu" , + (unsigned long )ids[i]); +continue ; + }for (counter =0 ; counter < lsm_names_count; counter++) {if (!strcmp (name, lsm_names[counter].name)) {
Signature · 5 lines
2.55.0.rc0.799.gd6f94ed593-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wake,
Quoted 1 line · Wake Liu
syscalls/lsm_list_modules02: Log unrecognized LSM IDs with TINFO instead of TBROK
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wake,
Quoted 5 lines
When running
lsm_list_modules02on systems with newer upstream kernels containing newly introduced LSMs, or on vendor/OEM kernels with out-of-tree security modules enabled,lsm_list_modules(ids, size, 0)returns valid LSM IDs that might not yet be mapped in the hardcoded switch (ids[i]) table.
Quoted 8 lines
Currently, encountering any unrecognized LSM ID causes the test to immediately terminate with
tst_brk(TBROK, "Unsupported LSM: %lu", ids[i]). This prevents testing of other well-known standard LSMs present on the system.Downgrade the unrecognized LSM ID handling from TBROK to TINFO and continue iterating over the remaining IDs. This improves test robustness across various kernel configurations while maintaining rigorous verification for all known standard LSM modules.
Thanks!
Quoted 10 lines
Signed-off-by Wake Liu <[email protected]>--- testcases/kernel/syscalls/lsm/lsm_list_modules02.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)testcases/kernel/syscalls/lsm/lsm_list_modules02.c +0
-0
testcases/kernel/syscalls/lsm/lsm_list_modules02.c static void run(void) · line 99
Quoted 7 lines
testcases/kernel/syscalls/lsm/lsm_list_modules02.c +2
-2@@ -95,8 +95,11 @@ static void run(void)break ; } -if (!name) -tst_brk (TBROK ,"Unsupported LSM: %lu" , ids[i]); +if (!name) { + tst_res(TINFO, "Skipping unrecognized LSM ID: %lu",
How about changing this to TCONF? It would be more obvious something was skipped. This can be done before merge.
Kind regards,
Petr
Quoted 6 lines
testcases/kernel/syscalls/lsm/lsm_list_modules02.c +3
-0+ (unsigned long)ids[i]); +continue ; + }for (counter =0 ; counter < lsm_names_count; counter++) {if (!strcmp (name, lsm_names[counter].name)) {
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 2 lines
How about changing this to TCONF? It would be more obvious something was skipped. This can be done before merge.
This makes sense, I will add it before merge.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp