[LTP] [PATCH 2/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode

Petr Vorel pvorel@suse.cz
Thu Sep 24 13:03:53 CEST 2026


> Hi!
> > Reported-by: Wei Gao <wegao@suse.com>
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> > [ pvorel: separate into its own commit, write the commit message ]
> > Co-developed-by: Petr Vorel <pvorel@suse.cz>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/kernel/syscalls/shmctl/shmctl03.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)

> > diff --git a/testcases/kernel/syscalls/shmctl/shmctl03.c b/testcases/kernel/syscalls/shmctl/shmctl03.c
> > index 9e1c2f0990..0056f2c4b4 100644
> > --- a/testcases/kernel/syscalls/shmctl/shmctl03.c
> > +++ b/testcases/kernel/syscalls/shmctl/shmctl03.c
> > @@ -30,7 +30,11 @@ static void verify_ipcinfo(void)
> >  	else
> >  		tst_res(TPASS, "shmmin = 1");

> > -	TST_ASSERT_ULONG(PATH_KERN_SHMMAX, info.shmmax);
> > +	if (tst_is_compat_mode() && info.shmmax == INT_MAX)
> > +		tst_res(TPASS, "shmmax clamped to INT_MAX in compat mode");

> This should be turned into PATH_KERN_SHMMAX >= INT_MAX check instead of
> printing TPASS blindly.

Right, I'll send a patch which check:

	if (tst_is_compat_mode() && info.shmmax == INT_MAX) {
		unsigned long long shmmax;
		SAFE_FILE_SCANF(PATH_KERN_SHMMAX, "%llu", &shmmax);
		TST_EXP_LE_LU(INT_MAX, shmmax);
	} else {
		TST_ASSERT_ULONG(PATH_KERN_SHMMAX, info.shmmax);
	}

Kind regards,
Petr

> > +	else
> > +		TST_ASSERT_ULONG(PATH_KERN_SHMMAX, info.shmmax);
> > +
> >  	TST_ASSERT_ULONG(PATH_KERN_SHMMNI, info.shmmni);
> >  	TST_ASSERT_ULONG(PATH_KERN_SHMALL, info.shmall);
> >  }
> > -- 
> > 2.55.0


More information about the ltp mailing list