Hi, folks.  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.

Cheers.  -ernie



--- linux-2.6.10/fs/proc/kcore.c.orig   2004-12-24 16:34:58.000000000 -0500
+++ linux-2.6.10/fs/proc/kcore.c        2005-02-02 20:44:13.000000000 -0500
@@ -101,7 +101,7 @@ static size_t get_kcore_size(int *nphdr,
        }
        *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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to