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

Andrea Cervesato andrea.cervesato@suse.com
Thu May 7 12:01:24 CEST 2026


Hi Wei,

> 
> Kernel indeed saturates shmmax to INT_MAX for compat syscalls
> Relevant kernel code in ipc/shm.c:
> 
> static int copy_compat_shminfo_to_user(void __user *buf, struct shminfo64 *in,
>                                         int version)
> {
>         if (in->shmmax > INT_MAX)
>                 in->shmmax = INT_MAX; <<<<<<<
>         if (version == IPC_64) {
>                 struct compat_shminfo64 info;
>                 memset(&info, 0, sizeof(info));
>                 info.shmmax = in->shmmax;
> 

You are right, LGTM

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list