diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2017-10-11 15:01:40 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2017-10-11 15:01:40 +0100 |
commit | 72bc1bb934ba99bc9182179a866c0d2c77d027c8 (patch) | |
tree | e5a5b2c9135c61b103dedfe4864bc5b752691aa7 /bfd | |
parent | 458ca1d02e47db0af0e22d524df0e4b88fc54b6e (diff) | |
download | gdb-72bc1bb934ba99bc9182179a866c0d2c77d027c8.zip gdb-72bc1bb934ba99bc9182179a866c0d2c77d027c8.tar.gz gdb-72bc1bb934ba99bc9182179a866c0d2c77d027c8.tar.bz2 |
ELF/BFD: Fix padding in `elf_external_linux_prpsinfo64'
Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO
notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>,
and move the padding of the `elf_external_linux_prpsinfo64' structure to
match the corresponding 64-bit Linux kernel `elf_prpsinfo' structure.
The 64-bit kernel structure is defined as follows:
(gdb) ptype struct elf_prpsinfo
type = struct elf_prpsinfo {
char pr_state;
char pr_sname;
char pr_zomb;
char pr_nice;
unsigned long pr_flag;
__kernel_uid_t pr_uid;
__kernel_gid_t pr_gid;
pid_t pr_pid;
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
char pr_fname[16];
char pr_psargs[80];
}
(gdb) print /x &((struct elf_prpsinfo *)0)->pr_nice
$1 = 0x3
(gdb) print /x &((struct elf_prpsinfo *)0)->pr_flag
$2 = 0x8
(gdb) print /x &((struct elf_prpsinfo *)0)->pr_uid
$3 = 0x10
(gdb) print sizeof(((struct elf_prpsinfo *)0)->pr_flag)
$4 = 8
(gdb)
with implicit padding present before the `pr_flag' member, to correctly
align it to a multiple of 8. Conversely `elf_external_linux_prpsinfo64'
has padding after its `pr_flag' member:
(top-gdb) ptype struct elf_external_linux_prpsinfo64
type = struct elf_external_linux_prpsinfo64 {
char pr_state;
char pr_sname;
char pr_zomb;
char pr_nice;
char pr_flag[8];
char gap[4];
char pr_uid[4];
char pr_gid[4];
char pr_pid[4];
char pr_ppid[4];
char pr_pgrp[4];
char pr_sid[4];
char pr_fname[16];
char pr_psargs[80];
}
(top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_nice
$1 = 0x3
(top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_flag
$2 = 0x4
(top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_uid
$3 = 0x10
(top-gdb)
and consequently `pr_flag' is misplaced. Move `gap' ahead of `pr_flag'
then.
bfd/
* elf-linux-core.h (elf_external_linux_prpsinfo64): Move the
`gap' member ahead of `pr_flag'.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf-linux-core.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 82bcbf2..f2ad127 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2017-10-11 Maciej W. Rozycki <macro@imgtec.com> + + * elf-linux-core.h (elf_external_linux_prpsinfo64): Move the + `gap' member ahead of `pr_flag'. + 2017-10-11 Pedro Alves <palves@redhat.com> * bfd.c (_doprnt): Rename to ... diff --git a/bfd/elf-linux-core.h b/bfd/elf-linux-core.h index 4dcc488..e904939 100644 --- a/bfd/elf-linux-core.h +++ b/bfd/elf-linux-core.h @@ -85,8 +85,8 @@ struct elf_external_linux_prpsinfo64 char pr_sname; /* Char for pr_state. */ char pr_zomb; /* Zombie. */ char pr_nice; /* Nice val. */ - char pr_flag[8]; /* Flags. */ char gap[4]; + char pr_flag[8]; /* Flags. */ char pr_uid[4]; char pr_gid[4]; char pr_pid[4]; |