It fixes possible scenarios when we crash/assert with --hash-symbols when
dumping an invalid GNU hash table which has a broken value in the buckets array.
This fixes a crash reported in comments for
https://bugs.llvm.org/show_bug.cgi?id=47681
Differential D88561
[llvm-readobj] - Fix possible crashes related to dumping gnu hash symbols. grimar on Sep 30 2020, 5:22 AM. Authored by
Details It fixes possible scenarios when we crash/assert with --hash-symbols when This fixes a crash reported in comments for
Diff Detail Event Timeline
Comment Actions I think the handling of the GNU hash table is actually already fully correct. The crash (or error message when using this patch) is simply a side effect of the fact that size of the DynSymRegion was clobbered here (near the end of ELFDumper<ELFT>::parseDynamicTable()): DynSymRegion->Size = HashTable->nchain * DynSymRegion->EntSize; This in turn is because HashTable->nchain (like all of HashTable) is just incorrect on s390x at the moment, as discussed in https://bugs.llvm.org/show_bug.cgi?id=47681
Comment Actions That is true for you executable. But this patch fixes a bit different case. Here I am creating the .gnu.hash table with a broken value in the buckets array.
Comment Actions I see. In this case this patch doesn't really address PR47681, but only replaces a crash with wrong output ... Still preferable to not crash, but of course we still need to fix the root cause (at the least, by ignoring the .hash section if the entry size doesn't match). Comment Actions The fix for PR47681 (s390 specific) is independent from the crash (all platforms), so it should be fixed separatelly. Comment Actions
Comment Actions Looks good aside from a possible broken test.
|
It's not clear from this comment what is causing the attempt to read past the end of file. Please could you clarify.