From: linuxtestproject.agent@gmail.com
To: Runli <mingyu.he@shopee.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] pty09: Cap RLIMIT_NOFILE-based slave PTY opens
Date: Thu, 9 Jul 2026 10:33:23 +0000 [thread overview]
Message-ID: <20260709103323.3962-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260709074923.73372-1-mingyu.he@shopee.com>
Hi Runli,
On Thu, 09 Jul 2026 15:49:23 +0800, Runli wrote:
> pty09: Cap RLIMIT_NOFILE-based slave PTY opens
> max_pid_num = limit.rlim_cur - count;
> + if (max_pid_num > MAX_SLAVE_OPENS)
> + max_pid_num = MAX_SLAVE_OPENS;
>
> tst_res(TINFO, "Available number of pids: %u", max_pid_num);
After the cap fires, `max_pid_num` holds 4096 -- the test's self-imposed
limit -- but the TINFO label still says "Available number", which implies
the system's available FD count.
On a system where RLIMIT_NOFILE - open_fds is, say, 1048000, the output
would read "Available number of pids: 4096", which could mislead anyone
comparing it against the system limit.
Consider printing the uncapped available count and a separate note when
the cap applies, e.g.:
tst_res(TINFO, "Available number of pids: %u (capped at %d)",
max_pid_num, MAX_SLAVE_OPENS);
or split the TINFO into two calls -- one for the real available count
(computed before the cap), one confirming the cap was applied.
Verdict - Needs revision
Pre-existing issues:
1. `count_avail_pid()` and the variable `max_pid_num` both say "pid"
but the code tracks file-descriptor slots, not PIDs.
2. In run(): `tst_res(TPASS, "pty has been opened %d times", max_pid_num)`
uses %d for an unsigned int argument.
3. In run(): `int slavefd[max_pid_num]` is a VLA. If max_pid_num == 0
(all FD slots occupied) the zero-length VLA is undefined behaviour.
---
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
next prev parent reply other threads:[~2026-07-09 10:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 7:49 [LTP] [PATCH] pty09: Cap RLIMIT_NOFILE-based slave PTY opens Runli via ltp
2026-07-09 10:33 ` linuxtestproject.agent [this message]
2026-07-10 13:48 ` [LTP] " Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2026-07-14 3:15 [LTP] [PATCH v2] " Runli via ltp
2026-07-14 8:06 ` [LTP] " linuxtestproject.agent
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=20260709103323.3962-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=mingyu.he@shopee.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox