[AArch64,BZ,18400] fix elf_prpsinfo in procfs.h
Commit Message
Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.
This is an ABI breaking change so I created a bugzilla ticket,
but I guess glibc elf_prpsinfo is not widely used if this
haven't come up yet.
Changelog:
2015-05-12 Szabolcs Nagy <szabolcs.nagy@arm.com>
[BZ #18400]
* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (struct elf_prpsinfo):
Fix pr_uid and pr_gid members.
Comments
Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.
>
> This is an ABI breaking change so I created a bugzilla ticket,
> but I guess glibc elf_prpsinfo is not widely used if this
> haven't come up yet.
Can you find out where the struct is actually been used?
Andreas.
On 12 May 2015 11:49, Andreas Schwab wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> > Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.
> >
> > This is an ABI breaking change so I created a bugzilla ticket,
> > but I guess glibc elf_prpsinfo is not widely used if this
> > haven't come up yet.
>
> Can you find out where the struct is actually been used?
breakpad uses it, but i wouldn't worry too much about that ... it statically
links things in general and should be easy to fix it
otherwise, the usual debug culprits like gdb, libunwind, strace, etc... *might*
use it. i find these proc headers are fairly uncommon though.
maybe github code search would help ?
-mike
On 12/05/15 10:49, Andreas Schwab wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
>
>> Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.
>>
>> This is an ABI breaking change so I created a bugzilla ticket,
>> but I guess glibc elf_prpsinfo is not widely used if this
>> haven't come up yet.
>
> Can you find out where the struct is actually been used?
>
it should be used by things that look at elf core dumps, but
i cannot find any use of the glibc struct
binutils relies on the struct layout:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elfxx-aarch64.c;h=db9d4fa01924342cbc110877d1ac06c7a389debc;hb=HEAD#l526
note that those parts are not changed here
(the struct is 8 byte aligned so 2*short -> 2*int
does not change the layout for other members)
i've seen various packages defining their own prpsinfo
struct (uclibc, bionic, musl, google-breakpad, valgrind,
binutils, qemu) and some using the kernel definition
(undertaker).
some of the definitions are broken on various platforms
(i haven't seen the pr_uid/pr_gid fields used).
Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> note that those parts are not changed here
> (the struct is 8 byte aligned so 2*short -> 2*int
> does not change the layout for other members)
> (i haven't seen the pr_uid/pr_gid fields used).
Given these two statements this change should be pretty safe.
Andreas.
On 12 May 2015 at 09:48, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.
>
> This is an ABI breaking change so I created a bugzilla ticket,
> but I guess glibc elf_prpsinfo is not widely used if this
> haven't come up yet.
>
> Changelog:
>
> 2015-05-12 Szabolcs Nagy <szabolcs.nagy@arm.com>
>
> [BZ #18400]
> * sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (struct elf_prpsinfo):
> Fix pr_uid and pr_gid members.
All of the comments on this thread suggest the change is relatively
safe, go ahead and commit it.
/Marcus
@@ -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. */