From: linuxtestproject.agent@gmail.com
To: Stephen Bertram <sbertram@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] semctl01: fix SEM_STAT failures under parallel LTP runs
Date: Wed, 29 Jul 2026 22:07:59 +0000 [thread overview]
Message-ID: <20260729220759.8984-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260729210019.7647-1-sbertram@redhat.com>
Hi Stephen,
On Wed, 29 Jul 2026, Stephen Bertram wrote:
> semctl01: fix SEM_STAT failures under parallel LTP runs
> SEM_STAT was using the global high index from IPC_INFO, which is not
> stable when other IPC tests run in parallel and can abort the test with
> TBROK.
The body only describes the SEM_STAT part, but the patch also changes
func_iinfo() so that it no longer derives sem_index, and tightens
func_sstat() to compare against sem_id instead of just ">= 0".
Could one more sentence be added so the diff scope is predictable from
the message alone?
> +static int get_sem_idx_from_id(int id)
> +{
> + struct seminfo info;
> + struct semid_ds dummy_ds;
> + union semun arg;
> + int max_idx, i;
> +
> + arg.__buf = &info;
> + /* SEM_INFO ignores semid; but SAFE_SEMCTL requires an lvalue */
> + max_idx = SAFE_SEMCTL(id, 0, SEM_INFO, arg);
msgctl12.c currently has the very same construct that this patch is
removing here:
index_q = SAFE_MSGCTL(msg_q, IPC_INFO, (struct msqid_ds*)&msginfo_buf);
and then uses index_q for MSG_STAT, so it can break the same way under
parallel runs.
Would it make sense to put this id -> index lookup into
include/tse_newipc.h and libs/newipc, so semctl01, msgctl12 and any
future shmctl test can share one implementation instead of open-coding
it per test?
> + arg.buf = &dummy_ds;
> + for (i = 0; i <= max_idx; i++) {
> + /*
> + * Bare semctl: unused/unreadable indices fail with
> + * EINVAL/EACCES; SAFE_SEMCTL would abort the test.
> + */
> + if (semctl(i, 0, SEM_STAT, arg) == id)
> + return i;
> + }
This makes the SEM_STAT test case tautological: the index is found by
calling SEM_STAT and comparing the result to sem_id, and the test case
then repeats the same call on the same index and asserts the same
equality.
> -static void func_sstat(int semidx)
> +static void func_sstat(int semid)
> {
> - if (semidx >= 0)
> + if (semid == sem_id)
> tst_res(TPASS, "id of the semaphore set is correct");
The tcase passes SEMUN_CAST & buf, so the kernel fills the global
struct semid_ds, but func_sstat() never looks at it.
Checking the returned data as well, e.g. buf.sem_nsems == PSEMS the way
func_stat() does for IPC_STAT, would give the SEM_STAT case something to
verify beyond the identity the helper already established.
Verdict - Needs revision
Pre-existing issues in the surrounding code, not introduced by this
patch:
The tests[] table declares its callbacks as "void (*func_test)()" and
"void (*func_setup)()". Because of the empty parameter lists, sparse
reports "too many arguments for function func_setup" at lines 308 and
311 and "too many arguments for function func_test" at line 327, plus
several "incorrect type in initializer (different argument counts)"
warnings on the table entries.
sall_setup() uses braces around a single statement body (line 174),
which checkpatch flags.
---
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-07-29 22:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 16:49 [LTP] [PATCH v2] semctl: updates for multi worker testing Stephen Bertram via ltp
2026-04-14 17:15 ` [LTP] " linuxtestproject.agent
2026-07-20 22:49 ` [LTP] [PATCH v3] semctl01: tolerate SEM_STAT races under parallel LTP runs Stephen Bertram via ltp
2026-07-20 23:13 ` [LTP] " linuxtestproject.agent
2026-07-20 23:56 ` [LTP] [PATCH v4] " Stephen Bertram via ltp
2026-07-21 2:38 ` [LTP] " linuxtestproject.agent
2026-07-21 13:55 ` [LTP] [PATCH v5] " Stephen Bertram via ltp
2026-07-21 14:40 ` [LTP] " linuxtestproject.agent
2026-07-28 13:06 ` [LTP] [PATCH v5] " Andrea Cervesato via ltp
2026-07-28 16:23 ` [LTP] [PATCH v6] " Stephen Bertram via ltp
2026-07-28 17:31 ` [LTP] " linuxtestproject.agent
2026-07-28 20:33 ` [LTP] [PATCH v7] semctl01: look up SEM_STAT index for this test's sem_id Stephen Bertram via ltp
2026-07-28 21:12 ` [LTP] " linuxtestproject.agent
2026-07-29 14:53 ` [LTP] [PATCH v8] semctl01: fix SEM_STAT failures under parallel LTP runs Stephen Bertram via ltp
2026-07-29 16:26 ` [LTP] " linuxtestproject.agent
2026-07-29 17:56 ` [LTP] [PATCH v9] " Stephen Bertram via ltp
2026-07-29 18:14 ` [LTP] " linuxtestproject.agent
2026-07-29 19:33 ` [LTP] [PATCH v10] " Stephen Bertram via ltp
2026-07-29 20:20 ` [LTP] " linuxtestproject.agent
2026-07-29 21:00 ` [LTP] [PATCH v11] " Stephen Bertram via ltp
2026-07-29 22:07 ` linuxtestproject.agent [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=20260729220759.8984-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=sbertram@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.