[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/8] ELF unexec (bug#20614)
From: |
Alan Modra |
Subject: |
[PATCH 0/8] ELF unexec (bug#20614) |
Date: |
Mon, 2 Nov 2015 12:23:34 +1030 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
This series of patches addresses bug #20614 by rewriting the bss
handling code rather than adding yet more hacks. Finding bss sections
by name as we do currently results in complicated code that
- does not account for all names of possible bss sections,
- assumes specific ordering of bss sections,
- can wrongly choose a SHT_NOBITS section not in the bss segment,
- incorrectly calculates bss size (no accounting for alignment gaps),
- assumes .data and .bss are in the same segment.
All of these problems and more are solved by finding the bss segment
in PT_LOAD headers, ie. the address range included in p_memsz but not
p_filesz of the last PT_LOAD header, then matching SHT_NOBITS sections
in that address range.
I've split the patch into a series as there are multiple problems of
varying severity in this code, and it might be a little easier to
review this way. The series was tested indiviually on x86_64-linux
and on powerpc64-linux and powerpc64le-linux after fixing bug #20614
with patch 7/8.
Patch 8/8 goes further and removes the added .data2 section. I don't
see any need for a new SHT_PROGBITS section to cover the old bss
section(s) plus dumped data. Not adding a section means there is no
need to patch symbol st_shndx or section sh_info and sh_link fields,
which is fragile code. At least, sh_info shouldn't really be patched
unless SHF_INFO_LINK is set in sh_flags, but not all linkers set the
flag properly.
Alan Modra (8):
ELF unexec: Correct section header index
ELF unexec: Tidy code
ELF unexec: Merge Alpha and MIPS COFF debug handling
ELF unexec: Symbol table patching
ELF unexec: _OBJC_ symbols in bss sections
ELF unexec: R_*_NONE relocs
ELF unexec: Drive from PT_LOAD header rather than sections
ELF unexec: Don't insert a new section
src/unexelf.c | 1022 ++++++++++++---------------------------------------------
1 file changed, 206 insertions(+), 816 deletions(-)
--
Alan Modra
Australia Development Lab, IBM
- [PATCH 0/8] ELF unexec (bug#20614),
Alan Modra <=