Skip to content

Commit

Permalink
Merge pull request iovisor#2030 from vijunag/master
Browse files Browse the repository at this point in the history
Fix symbol resolution across mount namespaces (iovisor#2029)
  • Loading branch information
palmtenor authored Nov 8, 2018
2 parents f395931 + 6c85d2c commit 2747504
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cc/bcc_syms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ int ProcSyms::_add_load_sections(uint64_t v_addr, uint64_t mem_sz,
}

void ProcSyms::load_exe() {
ProcMountNSGuard g(mount_ns_instance_.get());
std::string exe = ebpf::get_pid_exe(pid_);
Module module(exe.c_str(), mount_ns_instance_.get(), &symbol_option_);

if (module.type_ != ModuleType::EXEC)
return;

ProcMountNSGuard g(mount_ns_instance_.get());

bcc_elf_foreach_load_section(exe.c_str(), &_add_load_sections, &module);

Expand Down Expand Up @@ -163,6 +163,7 @@ int ProcSyms::_add_module(const char *modname, uint64_t start, uint64_t end,
// It only gives the mmap offset. We need the real offset for symbol
// lookup.
if (module.type_ == ModuleType::SO) {
ProcMountNSGuard g(ps->mount_ns_instance_.get());
if (bcc_elf_get_text_scn_info(modname, &module.elf_so_addr_,
&module.elf_so_offset_) < 0) {
fprintf(stderr, "WARNING: Couldn't find .text section in %s\n", modname);
Expand Down

0 comments on commit 2747504

Please sign in to comment.