<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I have a Linux core dump that causes LLDB 3.9 on Linux crash. I would greatly appreciate any advise how to deal with the problem or what else I should look at.</p>
<p><br>
</p>
<p>The core dump was produced by GDB and GDB itself opens it without problems.</p>
<p><br>
</p>
<p>So, during loading the core we call <span>DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() which enumerates all the modules and does some processing. In the course of actions, it calls the </span> <span>ObjectFileELF::GetSectionHeaderInfo() for each module.
This guy tries to load section headers and read string table. Well, it gets some garbage in the section header struct and tries to allocate 1.5TB memory which causes operator new throw.</span></p>
<p><span><br>
</span></p>
<p><span>So, why we get garbage?</span></p>
<p><span><br>
</span></p>
<p><span>The module in question is libc++abi.so.1:</span></p>
<p><span><br>
</span></p>
<p><span></p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
521 ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
(gdb) p I->file_spec</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
$95 = {</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_directory = {</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_string = 0x829a58 "... <i>redacted</i> ..."</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
},</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_filename = {</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_string = <span style="background:yellow;mso-highlight:
yellow">0x7cc9e8 "libc++abi.so.1"</span></p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
},</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_is_resolved = false,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
m_syntax = lldb_private::FileSpec::ePathSyntaxPosix</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
}</p>
<br>
</span>
<p></p>
<p><span>The module header lives at address <span>0x7f699a270000 </span> and looks OK. The section headers are supposed to be at offset 2495600 == 0x261470</span></p>
<p><span><br>
</span></p>
<p><span></p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
$96 = (const elf::ELFHeader &) @0x953a78: {</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_ident = "\177ELF\002\001\001\000\000\000\000\000\000\000\000",</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_entry = 33392,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_phoff = 64,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
<span style="background-color: rgb(255, 255, 0);">e_shoff = 2495600</span>,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_flags = 0,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_version = 1,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_type = 3,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_machine = 62,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_ehsize = 64,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_phentsize = 56,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_phnum = 7,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_shentsize = 64,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
e_shnum = 38,</p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
<span style="background: rgb(255, 255, 255);">e_shstrndx = 35</span></p>
<p style="margin:0in;margin-left:.375in;font-family:"Courier New";font-size:
8.0pt">
}</p>
<br>
</span>
<p></p>
<p><span>LLDB tries to read the section headers from that address <span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">0x7f699a270000 </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"> + <span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">0x261470
== 0x<span>7F699A4D1470 without a second thought, but this number is a lie. The /proc/<pid>/maps file shows it as belonging to something else:</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span><br>
</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span></p>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a270000-7f699a2ba000 r-xp 00000000 fd:02 537796791 .../libc++abi.so.1</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a2ba000-7f699a4b9000 ---p 0004a000 fd:02 537796791 .../libc++abi.so.1</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a4b9000-7f699a4bb000 r--p 00049000 fd:02 537796791 .../libc++abi.so.1</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a4bb000-7f699a4bc000 rw-p 0004b000 fd:02 537796791 .../libc++abi.so.1</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt; background-color: rgb(255, 255, 0);">7f699a4bc000-7f699a520000 r-xp 00000000 fd:00 202587414 /usr/lib64/libssl.so.1.0.1e</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a520000-7f699a71f000 ---p 00064000 fd:00 202587414 /usr/lib64/libssl.so.1.0.1e</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a71f000-7f699a723000 r--p 00063000 fd:00 202587414 /usr/lib64/libssl.so.1.0.1e</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 8pt;">7f699a723000-7f699a72a000 rw-p 00067000 fd:00 202587414 /usr/lib64/libssl.so.1.0.1e</span></div>
<div><br>
</div>
I.e. LLDB should verify the module boundaries and fall back to some other plan if the memory is not there. </span></span></span></span>
<p></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span><br>
</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span>Now
the question is - where would be the right place to do the fix?</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span><br>
</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span>Thanks,</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span>Eugene</span></span></span></span></p>
<p><span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span><br>
</span></span></span></span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
<p><br>
</p>
<div id="Signature">
<p>Sent from <a href="http://aka.ms/weboutlook" id="LPNoLP">Outlook</a><br>
</p>
</div>
</div>
</body>
</html>