]> sourceware.org Git - glibc.git/commitdiff
Fix sys/procfs.h pr_uid, pr_gid type (bug 23649).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 14 Sep 2018 13:21:33 +0000 (13:21 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 14 Sep 2018 13:21:33 +0000 (13:21 +0000)
As noted in
<https://sourceware.org/ml/libc-alpha/2018-09/msg00178.html>, glibc's
sys/procfs.h headers for microblaze, mips (n64), nios2 and riscv have
incorrect types for the pr_uid and pr_gid members of struct
elf_prpsinfo (as does the generic Linux version, but nothing uses
that).

This patch fixes those headers to use unsigned int.  The generic Linux
version is also fixed, but I do *not* recommend making new
architectures use it yet.  Rather, I think it should be reworked to
look more like a copy of the AArch64 version, but with a new
<bits/procfs.h> header included to provide register set definitions;
<bits/procfs.h> would then be architecture-specific while many
architectures could use the generic <sys/procfs.h>.  This fix is
deliberately separate from any reworking to use a generic header more,
since it's possible there could be uses for backporting this fix but
not for backporting a subsequent cleanup.

Tested with build-many-glibcs.py.  This of course doesn't provide much
validation of the structure layout; if the Linux kernel is fixed so
that "#include <linux/elfcore.h>" actually compiles with the headers
from "make headers_install" (and if the layout in both headers is
meant to be the same, whatever ABI we are building for), I have a test
that can be added to glibc to check the layout against that from the
Linux kernel.

[BZ #23649]
* sysdeps/unix/sysv/linux/microblaze/sys/procfs.h (struct
elf_prpsinfo): Use unsigned int for pr_uid and pr_gid.
* sysdeps/unix/sysv/linux/mips/sys/procfs.h (struct elf_prpsinfo):
Likewise.
* sysdeps/unix/sysv/linux/nios2/sys/procfs.h (struct
elf_prpsinfo): Likewise.
* sysdeps/unix/sysv/linux/riscv/sys/procfs.h (struct
elf_prpsinfo): Likewise.
* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prpsinfo):
Likewise.

ChangeLog
NEWS
sysdeps/unix/sysv/linux/microblaze/sys/procfs.h
sysdeps/unix/sysv/linux/mips/sys/procfs.h
sysdeps/unix/sysv/linux/nios2/sys/procfs.h
sysdeps/unix/sysv/linux/riscv/sys/procfs.h
sysdeps/unix/sysv/linux/sys/procfs.h

index 6f71e67eb2eb7a264e20467efc6d9108da83b697..28ec6df0f319c686841e112c87cd10e4b24acde1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2018-09-14  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #23649]
+       * sysdeps/unix/sysv/linux/microblaze/sys/procfs.h (struct
+       elf_prpsinfo): Use unsigned int for pr_uid and pr_gid.
+       * sysdeps/unix/sysv/linux/mips/sys/procfs.h (struct elf_prpsinfo):
+       Likewise.
+       * sysdeps/unix/sysv/linux/nios2/sys/procfs.h (struct
+       elf_prpsinfo): Likewise.
+       * sysdeps/unix/sysv/linux/riscv/sys/procfs.h (struct
+       elf_prpsinfo): Likewise.
+       * sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prpsinfo):
+       Likewise.
+
        * include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
        __FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (rint): Redirect
        using MATH_REDIRECT.
diff --git a/NEWS b/NEWS
index 04a0e89010adcb7e38f0823351a87608e8b570b7..dbb86a73a3d0b89df2e7f16f3baaa9e6a16abbce 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,11 @@ Deprecated and removed features, and other changes affecting compatibility:
 * The glibc.tune tunable namespace has been renamed to glibc.cpu and the
   tunable glibc.tune.cpu has been renamed to glibc.cpu.name.
 
+* The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined
+  in <sys/procfs.h>, has been corrected to match the type actually used by
+  the Linux kernel.  This affects the size and layout of that structure on
+  MicroBlaze, MIPS (n64 ABI only), Nios II and RISC-V.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
index 17c52519e74662b28d26cfea64438a1126f6aa39..7a9832371e35d0008ad01f1fb18fbe292ef6fedb 100644 (file)
@@ -91,8 +91,8 @@ struct elf_prpsinfo
     char pr_zomb;                      /* Zombie.  */
     char pr_nice;                      /* Nice val.  */
     unsigned long int pr_flag;         /* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
+    unsigned int pr_uid;
+    unsigned int pr_gid;
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing.  */
     char pr_fname[16];                 /* Filename of executable.  */
index 2be0c7e8180d188252aed4f94d0253066f559a4e..523317dec788f25340f6078437e2b279b15248fc 100644 (file)
@@ -97,8 +97,8 @@ struct elf_prpsinfo
 #else
     unsigned long int pr_flag;         /* Flags.  */
 #endif
-    long pr_uid;
-    long pr_gid;
+    unsigned int pr_uid;
+    unsigned int pr_gid;
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing */
     char pr_fname[16];                 /* Filename of executable.  */
index a61fe96c6bfd534e3986b36f4b2a7beedfecfa08..1bb18f1e58c301e330ed00dfca87dceac069fbf3 100644 (file)
@@ -91,8 +91,8 @@ struct elf_prpsinfo
     char pr_zomb;                      /* Zombie.  */
     char pr_nice;                      /* Nice val.  */
     unsigned long int pr_flag;         /* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
+    unsigned int pr_uid;
+    unsigned int pr_gid;
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing */
     char pr_fname[16];                 /* Filename of executable.  */
index 518de567410d42c9afea78efa83f86d0200b4aba..3abbecf957d84c09bc05f06fe711161d7c0d5788 100644 (file)
@@ -82,8 +82,8 @@ struct elf_prpsinfo
     char pr_zomb;                      /* Zombie.  */
     char pr_nice;                      /* Nice val.  */
     unsigned long int pr_flag;         /* Flags.  */
-    long int pr_uid;
-    long int pr_gid;
+    unsigned int pr_uid;
+    unsigned int pr_gid;
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing */
     char pr_fname[16];                 /* Filename of executable.  */
index 3c417bab296338fc56aa3d03244d4e49f9f3408f..6af44c02cab1ada0470582ecf1fb48a3a0264bff 100644 (file)
@@ -86,8 +86,8 @@ struct elf_prpsinfo
     char pr_zomb;                      /* Zombie.  */
     char pr_nice;                      /* Nice val.  */
     unsigned long int pr_flag;         /* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
+    unsigned int pr_uid;
+    unsigned int pr_gid;
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing */
     char pr_fname[16];                 /* Filename of executable.  */
This page took 0.137314 seconds and 5 git commands to generate.