All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode
Date: Thu, 22 Oct 2026 15:25:49 +0200	[thread overview]
Message-ID: <atoO3dl4iBFOAWpb@yuki.lan> (raw)
In-Reply-To: <20260925082840.2408504-2-pvorel@suse.cz>

Hi!
> Kernel clamped shmmax returned from shmctl(IPC_INFO) in 32bit compat
> mode to INT_MAX due to a change in kernel v2.6.22 in commit
> af7c693f14606 ("Cap shmmax at INT_MAX in compat shminfo").
> Reflect that.
> 
> This fixes error:
> 
>     shmctl03.c:33: TFAIL: /proc/sys/kernel/shmmax != 2147483647 got 4294967295
> 
> Reported-by: Wei Gao <wegao@suse.com>
> Suggested-by: Andrea Cervesato <andrea.cervesato@suse.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/syscalls/shmctl/shmctl03.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/shmctl/shmctl03.c b/testcases/kernel/syscalls/shmctl/shmctl03.c
> index 9e1c2f0990..f2b735dc85 100644
> --- a/testcases/kernel/syscalls/shmctl/shmctl03.c
> +++ b/testcases/kernel/syscalls/shmctl/shmctl03.c
> @@ -16,6 +16,7 @@
>  static void verify_ipcinfo(void)
>  {
>  	struct shminfo info;
> +	unsigned long shmmax;
>  
>  	TEST(shmctl(0, IPC_INFO, (struct shmid_ds *)&info));
>  
> @@ -30,7 +31,12 @@ static void verify_ipcinfo(void)
>  	else
>  		tst_res(TPASS, "shmmin = 1");
>  
> -	TST_ASSERT_ULONG(PATH_KERN_SHMMAX, info.shmmax);
> +	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);
> +

Looks to me.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

>  	TST_ASSERT_ULONG(PATH_KERN_SHMMNI, info.shmmni);
>  	TST_ASSERT_ULONG(PATH_KERN_SHMALL, info.shmall);
>  }
> -- 
> 2.55.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-10-22 13:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  8:28 [LTP] [PATCH v3 0/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode Petr Vorel
2026-09-25  8:28 ` [LTP] [PATCH v3 1/2] " Petr Vorel
2026-09-25 11:21   ` [LTP] " linuxtestproject.agent
2026-10-22 13:25   ` Cyril Hrubis [this message]
2026-10-22 13:43     ` [LTP] [PATCH v3 1/2] " Cyril Hrubis
2026-09-25  8:28 ` [LTP] [PATCH v3 2/2] shmctl03: Use test macros Petr Vorel
2026-10-22 13:27   ` Cyril Hrubis

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=atoO3dl4iBFOAWpb@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.