Commit ae910818 authored by Mark Williams's avatar Mark Williams Committed by Facebook Github Bot

Prevent a crash in folly::Symbolizer

Summary:
dbg and dbgo builds of hhvm with gcc-5 crash when generating
backtraces using folly::Symbolizer, because the .debug_aranges for
libc-2.23.so are SHF_COMPRESSED, and folly::Symbolizer doesn't
recognize that.

Just pretend that the section doesn't exist if it has SHF_COMPRESSED
set.

We might eventually want to support decompressing such sections under
an option - but folly::Symbolizer's goal is to just mmap and walk the
debug info without allocating memory (so that it can run while
handling signals etc).

Reviewed By: pixelb

Differential Revision: D4586762

fbshipit-source-id: bef61ed670d1a80caa4f7aac1f80fd2a92cc4ba9
parent f795d501
/* /*
* Copyright 2017 Facebook, Inc. * Copyright 2017-present Facebook, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
#include <folly/experimental/symbolizer/Dwarf.h> #include <folly/experimental/symbolizer/Dwarf.h>
#include <type_traits> #include <type_traits>
...@@ -304,7 +303,11 @@ bool Dwarf::getSection(const char* name, folly::StringPiece* section) const { ...@@ -304,7 +303,11 @@ bool Dwarf::getSection(const char* name, folly::StringPiece* section) const {
if (!elfSection) { if (!elfSection) {
return false; return false;
} }
#ifdef SHF_COMPRESSED
if (elfSection->sh_flags & SHF_COMPRESSED) {
return false;
}
#endif
*section = elf_->getSectionBody(*elfSection); *section = elf_->getSectionBody(*elfSection);
return true; return true;
} }
...@@ -318,7 +321,6 @@ void Dwarf::init() { ...@@ -318,7 +321,6 @@ void Dwarf::init() {
elf_ = nullptr; elf_ = nullptr;
return; return;
} }
getSection(".debug_str", &strings_);
// Optional: fast address range lookup. If missing .debug_info can // Optional: fast address range lookup. If missing .debug_info can
// be used - but it's much slower (linear scan). // be used - but it's much slower (linear scan).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment