cve/ghostlock.c: Print return value and attempt in TBROK message
PATCH 1/1 cve/ghostlock.c: Print return value and attempt in TBROK message
From: Avinesh Kumar <[email protected]>
The check after FUTEX_CMP_REQUEUE_PI breaks if the call did not fail with EDEADLK, but the message only said "did not return -EDEADLK" and TTERRNO appended errno, which is 0 when the call succeeds. The resulting "SUCCESS (0)" reads like a return value of 0 and hides what the call actually returned.
ghostlock.c:243: TBROK: FUTEX_CMP_REQUEUE_PI did not return -EDEADLK: SUCCESS (0)
Print TST_RET and the attempt number, so a TBROK here shows right away whether the call succeeded (and how many waiters it moved) or failed with another errno, and on which attempt it happened.
--- testcases/cve/ghostlock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/cve/ghostlock.c +3 -1
@@ -240,7 +240,9 @@ static void run(void)if (TST_ERR ==ENOSYS )tst_brk (TCONF ,"FUTEX_CMP_REQUEUE_PI not supported" );if (TST_RET !=-1 ||TST_ERR !=EDEADLK ) -tst_brk (TBROK |TTERRNO ,"FUTEX_CMP_REQUEUE_PI did not return -EDEADLK" ); +tst_brk (TBROK |TTERRNO , +"FUTEX_CMP_REQUEUE_PI returned %ld on attempt %d/%d, expected -EDEADLK" , +TST_RET , i +1 ,ATTEMPTS );TST_CHECKPOINT_WAIT2 (CP_SPRAYED ,18000 );
Signature · 5 lines
2.56.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 11 lines
The check after
FUTEX_CMP_REQUEUE_PIbreaks if the call did not fail with EDEADLK, but the message only said "did not return-EDEADLK" and TTERRNO appended errno, which is 0 when the call succeeds. The resulting "SUCCESS (0)" reads like a return value of 0 and hides what the call actually returned.ghostlock.c:243: TBROK:
FUTEX_CMP_REQUEUE_PIdid not return-EDEADLK: SUCCESS (0)TST_RETand the attempt number, so a TBROK here shows right away whether the call succeeded (and how many waiters it moved) or failed with another errno, and on which attempt it happened.
Make sense, merged.
Thank you!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp