[LTP] [PATCH] cve/ghostlock.c: Print return value and attempt in TBROK message

Avinesh Kumar avinesh.kumar@suse.com
Tue Nov 10 16:25:30 CET 2026


From: Avinesh Kumar <avinesh.kumar@suse.com>

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.

Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
 testcases/cve/ghostlock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/cve/ghostlock.c b/testcases/cve/ghostlock.c
index 3afedf9ab5ad..b37d6e9ca4e1 100644
--- a/testcases/cve/ghostlock.c
+++ b/testcases/cve/ghostlock.c
@@ -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);
 
-- 
2.56.0



More information about the ltp mailing list