lkml.org 
[lkml]   [2010]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[Patch 17/21] Calculate the size of the core file
Calculate the size of the core file

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Ananth N. Mavinakayanahalli <ananth@in.ibm.com>

---
fs/proc/gencore-elf.c | 6 ++++++
fs/proc/gencore.h | 1 +
2 files changed, 7 insertions(+)
Index: linux-2.6.36-rc7/fs/proc/gencore.h
===================================================================
--- linux-2.6.36-rc7.orig/fs/proc/gencore.h
+++ linux-2.6.36-rc7/fs/proc/gencore.h
@@ -27,6 +27,7 @@ struct core_proc {
size_t elf_buflen; /* size of elf_buf */
size_t nphdrs; /* number of phdrs */
size_t notes_size;
+ size_t size;
};

extern void try_to_freeze_core_threads(struct core_proc *cp);
Index: linux-2.6.36-rc7/fs/proc/gencore-elf.c
===================================================================
--- linux-2.6.36-rc7.orig/fs/proc/gencore-elf.c
+++ linux-2.6.36-rc7/fs/proc/gencore-elf.c
@@ -310,6 +310,9 @@ static int create_elf_header(struct core
dataoff, cp->nphdrs);
dataoff += sizeof(struct elf_shdr);
}
+
+ cp->size = dataoff;
+
/* Store the notes */
tinfo = cp->tinfo;
do {
@@ -371,6 +374,9 @@ ssize_t elf_read_gencore(struct core_pro
}
}

+ if (*fpos > cp->size)
+ goto out;
+
out:
return ret;
}

\
 
 \ /
  Last update: 2010-12-14 11:23    [from the cache]
©2003-2011 Jasper Spaans