summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-11-03 21:10:48 +1100
committerMichael Ellerman <michael@ellerman.id.au>2005-11-04 12:10:51 +1100
commit30415f6a63f3383a18e9adf7c144acabe6893f63 (patch)
tree1243fd078c52fca858145d5b96e6e4a2d310de4e /fs
parentb8f510219edc719d4c305918e16edc578bcfc16f (diff)
downloadlinux-30415f6a63f3383a18e9adf7c144acabe6893f63.tar.gz
powerpc: Fix random memory corruption in merged elf.h
The merged verison of ELF_CORE_COPY_REGS is basically the PPC64 version, with
a memset that came from PPC and a few types abstracted out into #defines. But
it's not _quite_ right.

The first problem is we calculate the number of registers with:
        nregs = sizeof(struct pt_regs) / sizeof(ELF_GREG_TYPE)

For a 32-bit process on a 64-bit kernel that's bogus because the registers are
64 bits, but ELF_GREG_TYPE is u32, so nregs == 88 which is wrong.

The other problem is the memset, which assumes a struct pt_regs is smaller
than a struct elf_regs. For a 32-bit process on a 64-bit kernel that's false.

The fix is to calculate the number of regs using sizeof(unsigned long), which
should always be right, and just memset the whole damn thing _before_ copying
the registers in.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions