|
|
|
[PATCH v2] Ignore PT_NOTE program headers with offset 0. | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
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@xxxxxxxxxxxxx>
---
kexec/kexec-elf.c | 9 ++++++++-
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;
}
_______________________________________________
fastboot mailing list
fastboot@xxxxxxxxxxxxxx
https://lists.osdl.org/mailman/listinfo/fastboot
[Netdev] [Linux Wireless] [Kernel Newbies] [Security] [Linux for Hams] [Netfilter] [Bugtraq] [Photo] [Yosemite] [Yosemite Forum] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux Admin] [Samba] [Linux Media] [Linux Resources]