[LTP] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Fri Sep 25 13:21:28 CEST 2026
Hi Petr,
On Fri, 25 Sep 2026 10:28:39 +0200, Petr Vorel wrote:
> [PATCH 1/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode
--- [PATCH 1/2] ---
> + SAFE_FILE_SCANF(PATH_KERN_SHMMAX, "%lu", &shmmax);
> + if (tst_is_compat_mode() && info.shmmax == INT_MAX)
> + TST_EXP_LE_LU(INT_MAX, shmmax);
> + else
> + TST_EXP_EQ_LU(info.shmmax, shmmax);
Testing `info.shmmax == INT_MAX` in the condition masks regressions; if the
kernel fails to clamp `info.shmmax`, execution takes the else branch and
reports TPASS. Additionally, `TST_EXP_LE_LU(INT_MAX, shmmax)` compares
`INT_MAX` against `shmmax` rather than verifying `info.shmmax`. Use
`unsigned long long` with `"%llu"` to avoid 32-bit overflow when reading
`PATH_KERN_SHMMAX`, and assert `info.shmmax` equals `INT_MAX` when
`tst_is_compat_mode() && shmmax > INT_MAX` (or `shmmax` otherwise).
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
More information about the ltp
mailing list