GNU Binutils with patches for OS216
修訂 | c4ab9505b53cdc899506ed421fddb7e1f8faf7a3 (tree) |
---|---|
時間 | 2017-04-26 05:11:49 |
作者 | Maciej W. Rozycki <macro@imgt...> |
Commiter | Maciej W. Rozycki |
MIPS/readelf: Simplify GOT[1] data availability check
Unavailable data is handled gracefully in MIPS GOT processing done by
print_mips_got_entry', so all that is needed in special GOT[1] handling
is to verify whether data can be retrieved for the purpose of the GNU
marker check done with byte_get'. Remove the extra error reporting
code then, introduced with commit 75ec1fdbb797 ("Fix runtime seg-fault
in readelf when parsing a corrupt MIPS binary.") in the course of
addressing PR binutils/21344, and defer the error case to regular local
GOT entry processing.
binutils/
* readelf.c (process_mips_specific): Remove error reporting from
GOT[1] processing.
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2017-04-25 Maciej W. Rozycki <macro@imgtec.com> |
2 | 2 | |
3 | + * readelf.c (process_mips_specific): Remove error reporting from | |
4 | + GOT[1] processing. | |
5 | + | |
6 | +2017-04-25 Maciej W. Rozycki <macro@imgtec.com> | |
7 | + | |
3 | 8 | * readelf.c (process_mips_specific): Remove null GOT data check. |
4 | 9 | |
5 | 10 | 2017-04-25 Maciej W. Rozycki <macro@imgtec.com> |
@@ -15500,24 +15500,20 @@ process_mips_specific (FILE * file) | ||
15500 | 15500 | if (ent == (bfd_vma) -1) |
15501 | 15501 | goto got_print_fail; |
15502 | 15502 | |
15503 | - if (data) | |
15504 | - { | |
15505 | - /* PR 21344 */ | |
15506 | - if (data + ent - pltgot > data_end - addr_size) | |
15507 | - { | |
15508 | - error (_("Invalid got entry - %#lx - overflows GOT table\n"), | |
15509 | - (long) ent); | |
15510 | - goto got_print_fail; | |
15511 | - } | |
15512 | - | |
15513 | - if (byte_get (data + ent - pltgot, addr_size) | |
15514 | - >> (addr_size * 8 - 1) != 0) | |
15515 | - { | |
15516 | - ent = print_mips_got_entry (data, pltgot, ent, data_end); | |
15517 | - printf (_(" Module pointer (GNU extension)\n")); | |
15518 | - if (ent == (bfd_vma) -1) | |
15519 | - goto got_print_fail; | |
15520 | - } | |
15503 | + /* Check for the MSB of GOT[1] being set, denoting a GNU object. | |
15504 | + This entry will be used by some runtime loaders, to store the | |
15505 | + module pointer. Otherwise this is an ordinary local entry. | |
15506 | + PR 21344: Check for the entry being fully available before | |
15507 | + fetching it. */ | |
15508 | + if (data | |
15509 | + && data + ent - pltgot + addr_size <= data_end | |
15510 | + && (byte_get (data + ent - pltgot, addr_size) | |
15511 | + >> (addr_size * 8 - 1)) != 0) | |
15512 | + { | |
15513 | + ent = print_mips_got_entry (data, pltgot, ent, data_end); | |
15514 | + printf (_(" Module pointer (GNU extension)\n")); | |
15515 | + if (ent == (bfd_vma) -1) | |
15516 | + goto got_print_fail; | |
15521 | 15517 | } |
15522 | 15518 | printf ("\n"); |
15523 | 15519 |