summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@xensource.com>2007-03-16 14:41:24 +0000
committerSimon Horman <horms@verge.net.au>2007-03-19 13:38:50 +0900
commitefac1da616a211517a4b0eaae098db6ade3bdd26 (patch)
treeda887a32bc268ed379e891d37581990c80a64146
parent78cd98999c9e00c2fe3347d4664c5bdc8dd91497 (diff)
Ignore PT_NOTE program headers with offset 0.
There is a binutils bug which causes PT_NOTE segments to have an offset of zero (http://sourceware.org/bugzilla/show_bug.cgi?id=594). The fix has not made it into any release binutils, although several distributions have backported it. Signed-off-by: Ian Campbell <ian.campbell@xensource.com> Acked-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/kexec-elf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
index 63f5b4c..a930485 100644
--- a/kexec/kexec-elf.c
+++ b/kexec/kexec-elf.c
@@ -676,7 +676,14 @@ static int build_mem_notes(const char *buf, off_t len, struct mem_ehdr *ehdr)
note_start = note_end = NULL;
for(i = 0; !note_start && (i < ehdr->e_phnum); i++) {
struct mem_phdr *phdr = &ehdr->e_phdr[i];
- if (phdr->p_type == PT_NOTE) {
+ /*
+ * binutils <= 2.17 has a bug where it can create the
+ * PT_NOTE segment with an offset of 0. Therefore
+ * check p_offset > 0.
+ *
+ * See: http://sourceware.org/bugzilla/show_bug.cgi?id=594
+ */
+ if (phdr->p_type == PT_NOTE && phdr->p_offset) {
note_start = (unsigned char *)phdr->p_data;
note_end = note_start + phdr->p_filesz;
}