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: Thu, 30 Jul 2026 02:19:50 +0000 [thread overview]
Message-ID: <20260730021950.8959-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260730020813.68630-1-sbertram@redhat.com>
Hi Stephen,
On Wed, 29 Jul 2026, Stephen Bertram wrote:
> semctl01: fix SEM_STAT failures under parallel LTP runs
> +/*
> + * get_sem_idx_from_id() relies on this same identity (SEM_STAT(i) == id)
> + * to find sem_index during setup. Re-checking it here still has
> + * meaning: it verifies that SEM_STAT still resolves to our set at
> + * test-execution time, catching the case where a parallel IPC test
> + * reused sem_index in between - the exact race this patch fixes.
> + */
> static void func_sstat(int semid)
Can a parallel IPC test really reuse sem_index here?
The kernel index is assigned by ipc_idr_alloc() when the set is created
and is only released by ipc_rmid() (ipc/util.c). The set created in
verify_semctl() stays alive until the IPC_RMID entry, which is the last
entry of tests[], so the index is reserved for this set for the whole
run and cannot be handed to another set in between.
The race the patch does fix looks like a different one: IPC_INFO returns
the globally highest used index, which need not belong to this test's
set. Would it be clearer to describe that instead?
Also, comments referring to "this patch" tend to age badly in the source
tree - could that rationale move to the commit message?
Last, the block documents get_sem_idx_from_id() but sits above
func_sstat(), before that helper is declared. Would it read better right
above the helper itself?
> +static int get_sem_idx_from_id(int id)
> +{
> + struct seminfo info;
> + struct semid_ds dummy_ds;
> + union semun arg;
> + int max_idx, i;
This is the same algorithm as get_shm_idx_from_id() in
testcases/kernel/syscalls/shmctl/shmctl01.c:227.
Would it make sense to put a common helper into libs/newipc so both
tests share it, instead of a second copy? If a shared helper is too
much for this fix, keeping the naming and the TBROK message aligned
with shmctl01 would still help.
Verdict - Needs revision
---
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-30 2:20 UTC|newest]
Thread overview: 23+ 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 ` [LTP] " linuxtestproject.agent
2026-07-30 2:08 ` [LTP] [PATCH v12] " Stephen Bertram via ltp
2026-07-30 2:19 ` 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=20260730021950.8959-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.