[LTP] [PATCH 2/2] syscalls/msgstress01: Fix timeouts

Cyril Hrubis chrubis@suse.cz
Thu May 23 17:55:46 CEST 2024


Hi!
> BTW I have found problem on Alpine:
> 
> tst_pid.c:84: TINFO: Cannot read session user limits from '/sys/fs/cgroup/user.slice/user-1000.slice/pids.max'
> tst_pid.c:84: TINFO: Cannot read session user limits from '/sys/fs/cgroup/pids/user.slice/user-1000.slice/pids.max'
> msgstress01.c:269: TINFO: Available messages slots: 5530
> msgstress01.c:164: TFAIL: Received wrong data at index 99: ffffffa3 != 19
> 
> It looks to me it's not related to using busybox init system (e.g. IMHO not
> related to the Cannot read session user limits, but I can be wrong).
> Anyway, this is for sure not a blocker for the release (and probably wait for
> LTP musl users).

So looks like we are using wrong message size for the message buffer.

We are using size returned from the msgrcv() that returns the size of
the payload but the payload looks like:

struct {
	char len;
	char pbytes[99];
} data;

This means that the size returned from msgrcv() is one more byte longer
than the pbytes array.

Quick fix would be:

diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
index 5c84957b3..b0d945a11 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
@@ -131,7 +131,7 @@ static void reader(const int id, const int pos)
                        return;
                }

-               for (int i = 0; i < size; i++) {
+               for (int i = 0; i < msg_recv.data.len; i++) {
                        if (msg_recv.data.pbytes[i] != buff->msg.data.pbytes[i]) {
                                tst_res(TFAIL, "Received wrong data at index %d: %x != %x", i,
                                        msg_recv.data.pbytes[i],


Better fix would remove the len from the sysv_msg structure and use the
size only, but I would go for the easy fix before the release and
do cleanup later on. I will send a proper patch.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list