[PATCH] D43092: [DebugInfo] Prevent infinite recursion for malformed DWARF

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 11:46:41 PDT 2018



> On Apr 30, 2018, at 11:41 AM, Jonas Devlieghere <jdevlieghere at apple.com> wrote:
> 
> 
> 
>> On Apr 30, 2018, at 6:28 PM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>> 
>> Sorry - could we revisit this?
> 
> Of course :-) 
> 
>> 
>> I think my concerns expressed still haven't been resolved:
>> 
>> "Could you check the revision history here? I'm pretty sure the first version of this I reviewed from Greg wasn't recursive - and then it became recursive at some point to handle something needed, but maybe those decisions need to be reexamined?" (& related comments back there)
> 
> Greg added the recursiveness in D40156 because he saw DWARFDie::getName() failing “in the wild”. I think it was for some Google project but I’d have to double check the mail thread. 
> 
> IIRC we all agreed that for “valid” DWARF we shouldn’t need the recursion. The question is whether we want to support the “invalid case or not, as it’s definitely being generated (but maybe not by clang?). If the answer is yes, then r331200 is strictly better than what we had before. Now we don’t crash if there’s a cycle. If the answer is no, we just need to go back to the non-recursive implementation. Personally I don’t have a strong opinion, as long as we don’t crash.

I indeed did see a DIE that had a DW_AT_specification and pointed to another die that also had a DW_AT_specification. Regardless of what the DWARF spec says, compilers or post production DWARF tools are are producing DWARF that has these multiple chaining of specifications or abstract origins. There is also no enforcement of the DWARF spec anywhere, so compilers produce a wide variety of different DWARF that may or may not be legal. We have "llvm-dwarfdump --verify" but it isn't exhaustive in what it reports. So I would vote that we have a DWARF parser that can handle what ever is thrown at it when possible. Just my 2 cents.

Greg

> 
> Cheers,
> Jonas 
> 
>> 
>> On Mon, Apr 30, 2018 at 10:06 AM Jonas Devlieghere via Phabricator <reviews at reviews.llvm.org <mailto:reviews at reviews.llvm.org>> wrote:
>> This revision was automatically updated to reflect the committed changes.
>> Closed by commit rL331200: [DebugInfo] Prevent infinite recursion for malformed DWARF (authored by JDevlieghere, committed by ).
>> 
>> Changed prior to commit:
>>   https://reviews.llvm.org/D43092?vs=144485&id=144582#toc <https://reviews.llvm.org/D43092?vs=144485&id=144582#toc>
>> 
>> Repository:
>>   rL LLVM
>> 
>> https://reviews.llvm.org/D43092 <https://reviews.llvm.org/D43092>
>> 
>> Files:
>>   llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
>>   llvm/trunk/test/tools/llvm-dwarfdump/X86/invalid_abstract_origin.s
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180430/8647cec0/attachment.html>


More information about the llvm-commits mailing list