[PATCH][Binutils] Always skip only 1 byte for CIE version 1's return address register.
Tamar Christina
Tamar.Christina@arm.com
Thu Feb 28 19:14:00 GMT 2019
Hi All,
According to the specification for the CIE entries, when the CIE version is 1 then
the return address register field is always 1 byte. Readelf does this correctly in
read_cie in dwarf.c but ld does this incorrectly and always tries to read a
skip_leb128. If the value here has the top bit set then ld will incorrectly read
at least another byte, causing either an assert failure or an incorrect address to
be used in eh_frame.
I'm not sure how to generate a generic test for this as I'd need to write assembly,
and it's a bit hard to trigger. Essentially the relocated value needs to start with
something that & 0x70 != 0x10 while trying to write a personality.
build on native hardware and regtested on
aarch64-none-elf, aarch64-none-elf (32 bit host),
aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)
Cross-compiled and regtested on
aarch64-none-linux-gnu, aarch64_be-none-linux-gnu
and no issues.
Ok for master?
Thanks,
Tamar
bfd/ChangeLog:
2019-02-28 Tamar Christina <tamar.christina@arm.com>
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Correct CIE parse.
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rb10753.patch
Type: text/x-diff
Size: 1215 bytes
Desc: rb10753.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20190228/5a44f596/attachment.bin>
More information about the Binutils
mailing list