Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Merge requests
  • !5574

i#5570: Use unhide variant for linking DR statically

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Abhinav Anil Sharma requested to merge i5570-unhide-dr-symbols into master Jul 21, 2022
  • Overview 6
  • Commits 5
  • Pipelines 0
  • Changes 2

Switches to dynamorio_static_unhide for configuring static DR so that DR's symbols are visible when building static binaries.

Various symbols in dynamorio_static, like d_r_safe_read and safe_read_if_fast in core/unix/os.c are non-weak symbols, but they are not exported by the static DR library because we use --localize_hidden during build.

$ nm --defined ../../lib64/debug/libdynamorio_static.a | grep d_r_safe_read 00000000002962e8 t d_r_safe_read $ nm --defined ../../lib64/debug/libdynamorio_static.a | grep safe_read_if_fast 0000000000296272 t safe_read_if_fast

This causes drlibc code to use the wrong routines in is_elf_so_header. The same would happen for other weakly linked routines in drlibc which are actually supposed to be suppressed by their respective DR definitions.

There's an existing version of static DR, libdynamorio_static_nohide, which does not use --localize_hidden. Now, we use that instead while configuring static DR.

This issue revealed itself on the recent Ubuntu 20 update which has a non-readable vsyscall entry in maps. When drlibc tries to read it, it crashes, and our main_signal_handler isn't able to recognize it as a safe_read crash because the incorrect d_r_safe read is used. After this fix, the correct one is used, which helps the DR signal handler to recover as intended.

Some cleanup will follow in the next PR: renaming the nohide version to make it clear that it is the default, evaluating whether we still need the static_nohide_api tests.

Issue: #5570 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: i5570-unhide-dr-symbols