GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Parse dynamic linking structures · Issue #761 · async-profiler/async-profiler

Parse dynamic linking structures #761

New issue
Copy link
New issue
Copy link
Closed
Closed
Parse dynamic linking structures#761
Copy link
Labels
enhancement

Description

@apangin
apangin
opened on Jul 2, 2023
Issue body actions

Background

Async-profiler currently extracts symbols from .symtab and .dynsym sections of shared libraries on a disk. Additionally, it locates GOT (global offset table) in loaded libraries and searches it for the addresses of dlopen and certain pthreads functions to hook them. However, if the address in GOT differs from the address resolved by async-profiler for some reason (e.g. GOT has already been patched by a previous version of async-profiler), the following error will occurs:

Could not set dlopen hook. Unsupported JVM?

Proposal

Instead of looking for GOT entries by an address, resolve imported symbols like a dynamic linker does. To do this, parse ELF program headers in memory and the dynamic section in particular. Find the relocation entries associated with the imported symbols in .rela.plt or .rela.dyn table, using the data in .dynsym/.dynstr sections to resolve symbolic function names.

Outcome

New approach to parsing dynamic linking structures opens a path to solving the following problems:

  1. ✅ Fix Could not set dlopen hook issue and allow running multiple instances of the profiler simultaneously.
  2. ✅ Parse symbols of shared libraries that were removed from a disk (it's typical to extract a JNI library in a temporary directory and remove it immediately after loading).
  3. (future work) Provide a mechanism to hook other library functions in runtime, e.g., malloc and free for native memory profiling.
Reacted by Long Yang

Activity

  1. apangin
    added
    enhancement
    on Jul 2, 2023
  2. apangin
    added 3 commits that reference this issue on Jul 2, 2023

    #761: Parse dynamic linking structures

    ce5ce61

    #761: Parse dynamic linking structures: macOS

    e3d129c

    #761: Parse dynamic linking structures

    89bf3ea
  3. apangin
    closed this as completedon Jul 4, 2023
  4. apangin
    added a commit that references this issue on Jul 16, 2023

    Fix for #761: relocate addresses in .dynamic section properly

    3c33c75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.