public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] syscalls/msgstress01: Fix timeouts
Date: Thu, 23 May 2024 17:55:46 +0200	[thread overview]
Message-ID: <Zk9nAjk6uqaN45HK@yuki> (raw)
In-Reply-To: <20240523154113.GB18111@pevik>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2024-05-23 15:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 13:31 [LTP] [PATCH 0/2] Fix msgstress01 timeouts Cyril Hrubis
2024-05-23 13:31 ` [LTP] [PATCH 1/2] syscalls/msgstress01: Fix the stop logic Cyril Hrubis
2024-05-23 13:40   ` Andrea Cervesato via ltp
2024-05-23 13:31 ` [LTP] [PATCH 2/2] syscalls/msgstress01: Fix timeouts Cyril Hrubis
2024-05-23 14:37   ` Martin Doucha
2024-05-23 15:20   ` Petr Vorel
2024-05-23 15:33     ` Cyril Hrubis
2024-05-23 15:41   ` Petr Vorel
2024-05-23 15:43     ` Petr Vorel
2024-05-23 15:55       ` Petr Vorel
2024-05-23 15:55     ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zk9nAjk6uqaN45HK@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox