[PATCH] D15532: [ELF] - implement support of extended length field for CIE/FDE records of eh_frame.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 15 08:49:19 PST 2015
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
Problem here in the next part of code:
```
void EHOutputSection<ELFT>::addSectionAux(
EHInputSection<ELFT> *S,
iterator_range<const Elf_Rel_Impl<ELFT, IsRela> *> Rels) {
...
uint32_t Length = read32<E>(D.data());
Length += 4;
...
```
Ian Lance Taylor writes: "Read 4 bytes. If they are not 0xffffffff, they are the length of the CIE or FDE record. Otherwise the next 64 bits holds the length, and this is a 64-bit DWARF format. This is like .debug_frame." (http://www.airs.com/blog/archives/460), that also consistent with spec (https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html).
When length was 0xffffffff overflow happened and code executed forward without any error here, failing much later.
Patch implements support of described extended length field and also adds few more checks for safety.
http://reviews.llvm.org/D15532
Files:
ELF/OutputSections.cpp
ELF/OutputSections.h
test/ELF/invalid-cie-length3.s
test/ELF/invalid-cie-length4.s
test/ELF/invalid-cie-length5.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15532.42863.patch
Type: text/x-patch
Size: 3398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151215/fb7ec6ab/attachment.bin>
More information about the llvm-commits
mailing list