public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.32/master] sysvipc: Fix tst-sysvshm-linux on x32
@ 2021-08-22 13:59 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2021-08-22 13:59 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cc6ff883a63ef0f8e2dad8f97a5784c30acd2d49

commit cc6ff883a63ef0f8e2dad8f97a5784c30acd2d49
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Oct 15 15:45:26 2020 -0300

    sysvipc: Fix tst-sysvshm-linux on x32
    
    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)

Diff:
---
 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-22 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 13:59 [glibc/release/2.32/master] sysvipc: Fix tst-sysvshm-linux on x32 Aurelien Jarno

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).