Commit bcba0212 authored by Ernie Petrides's avatar Ernie Petrides Committed by Linus Torvalds

[PATCH] minor conceptual fix for /proc/kcore header size

While investigating the 2.4 memory corruption problem fixed by the patch
previously posted, it was noticed that the 2.6 version of get_kcore_size()
inappropriately uses sizeof(struct memelfnote) in its calculation of the
/proc/kcore ELF header size.  What is actually stored in the header is an
"elf_note" structure plus the 4 ASCII chars "CORE".

It just so happens that on 32-bit arches, both calculations result in the
same value (16).  But on 64-bit arches, the allocated size (24) is larger
than necessary (16).  This does not result in any possible data corruption,
but it might be nice to correct this "conceptual" error.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 08d081db
......@@ -84,7 +84,7 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
}
*elf_buflen = sizeof(struct elfhdr) +
(*nphdr + 2)*sizeof(struct elf_phdr) +
3 * sizeof(struct memelfnote) +
3 * (sizeof(struct elf_note) + 4) +
sizeof(struct elf_prstatus) +
sizeof(struct elf_prpsinfo) +
sizeof(struct task_struct);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment