Skip to content

Commit

Permalink
[PATCH] Kcore elf note namesz field fix
Browse files Browse the repository at this point in the history
o As per ELF specifications, it looks like that elf note "namesz" field
  contains the length of "name" including the size of null character.  And
  currently we are filling "namesz" without taking into the consideration
  the null character size.

o Kexec-tools performs this check deligently hence I ran into the issue
  while trying to open /proc/kcore in kexec-tools for some info.

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Vivek Goyal authored and Linus Torvalds committed Sep 29, 2006
1 parent 327dcaa commit 632dd20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/proc/kcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int notesize(struct memelfnote *en)
int sz;

sz = sizeof(struct elf_note);
sz += roundup(strlen(en->name), 4);
sz += roundup((strlen(en->name) + 1), 4);
sz += roundup(en->datasz, 4);

return sz;
Expand All @@ -116,7 +116,7 @@ static char *storenote(struct memelfnote *men, char *bufp)

#define DUMP_WRITE(addr,nr) do { memcpy(bufp,addr,nr); bufp += nr; } while(0)

en.n_namesz = strlen(men->name);
en.n_namesz = strlen(men->name) + 1;
en.n_descsz = men->datasz;
en.n_type = men->type;

Expand Down

0 comments on commit 632dd20

Please sign in to comment.