[LTP] shmctl03: Fix 32-bit compat mode failure by adjusting comparisons for compat mode truncation

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu Apr 30 08:35:00 CEST 2026


Hi Wei,

On Thu, 30 Apr 2026, Wei Gao wrote:
> shmctl03: Fix 32-bit compat mode failure by adjusting comparisons for
> compat mode truncation

> +#define TST_ASSERT_SATURATED_INT   0x01
[...]
> +	if (flags & TST_ASSERT_SATURATED_INT) {
> +		if (sys_val_64 > (unsigned long long)INT_MAX)
> +			expected_val = (unsigned long)INT_MAX;

For shmmax in compat mode, can you confirm the saturation is to INT_MAX
(2^31-1) rather than UINT_MAX (2^32-1)?  The compat_shminfo64.shmmax
field is __compat_ulong_t (unsigned 32-bit), so truncation to UINT_MAX
would be the natural expectation.  A reference to the relevant kernel
compat code path in ipc/shm.c would help clarify.

Pre-existing issues noticed in the surrounding code (not introduced
by this patch):

- testcases/kernel/syscalls/ipc/shmctl/shmctl03.c:13 — #include
  "tse_newipc.h" appears unused; no symbols from it are referenced.

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25150858881

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