public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: libc-stable@sourceware.org
Subject: [COMMITTED 2.32 1/2] sysvipc: Fix tst-sysvshm-linux on x32
Date: Sun, 22 Aug 2021 15:59:17 +0200	[thread overview]
Message-ID: <20210822135918.1010437-1-aurelien@aurel32.net> (raw)

From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

The Linux shminfo fields are '__syscall_ulong_t' (which is 64-bit
for x32).  This patch fixes the test to compare againt the correct
type and to only clamp the value if '__syscall_ulong_t' is the same
size of 'unsigned long int'.

Checked on x86_64-linux-gnu-x32.

(cherry picked from commit 602da9de696099f543ee2bb3c1520bc178f42fc9)
---
 sysdeps/unix/sysv/linux/tst-sysvshm-linux.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c
index 7128ae2e14..cb32bd522e 100644
--- a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c
+++ b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c
@@ -54,9 +54,9 @@ do_prepare (int argc, char *argv[])
 
 struct test_shminfo
 {
-  unsigned long int shmall;
-  unsigned long int shmmax;
-  unsigned long int shmmni;
+  __syscall_ulong_t shmall;
+  __syscall_ulong_t shmmax;
+  __syscall_ulong_t shmmni;
 };
 
 /* It tries to obtain some system-wide SysV shared memory information from
@@ -128,7 +128,8 @@ do_test (void)
 #if LONG_MAX == INT_MAX
     /* Kernel explicit clamp the value for shmmax on compat symbol (32-bit
        binaries running on 64-bit kernels).  */
-    if (v > INT_MAX)
+    if (sizeof (__syscall_ulong_t) == sizeof (unsigned long int)
+        && v > INT_MAX)
       v = INT_MAX;
 #endif
     tipcinfo.shmmax = v;
-- 
2.30.2


             reply	other threads:[~2021-08-22 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 13:59 Aurelien Jarno [this message]
2021-08-22 13:59 ` [COMMITTED 2.32 2/2] linux: Remove shmmax check from tst-sysvshm-linux Aurelien Jarno

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=20210822135918.1010437-1-aurelien@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=libc-stable@sourceware.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).