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
  • Issues
  • #2910
Closed
Open
Issue created Apr 06, 2018 by Derek Bruening@derekbrueningContributor

drreg does not support use during DR init due to TLS not being set up

Both drreg and drmgr rely on TLS, but it's not set up during DR init:

Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0  0x7396d994 in drmgr_current_bb_phase (drcontext=0xe774a780) at /work/drmemory/git/src/dynamorio/ext/drmgr/drmgr.c:1104
#1  0x7397aabb in drreg_reserve_aflags (drcontext=0xe774a780, ilist=0xe779512c, where=0x0)
    at /work/drmemory/git/src/dynamorio/ext/drreg/drreg.c:1305
#2  0x7382be8f in reserve_aflags (drcontext=0xe774a780, ilist=0xe779512c, where=0x0) at /work/drmemory/git/src/drmemory/spill.c:441
#3  0x739515d8 in add_shadow_table_lookup (drcontext=0xe774a780, bb=0xe779512c, inst=0x0, mi=0xffdc1688, get_value=0 '\000', 
    value_in_reg2=0 '\000', need_offs=0 '\000', zero_rest_of_offs=0 '\000', reg1=19, reg2=20, reg3=0, check_alignment=1 '\001')
    at /work/drmemory/git/src/drmemory/fastpath_x86.c:1995
#4  0x7393dc41 in generate_shared_esp_fastpath_helper (drcontext=0xe774a780, bb=0xe779512c, sp_action=SP_ADJUST_ACTION_SHADOW, 
    type=ESP_ADJUST_ABSOLUTE) at /work/drmemory/git/src/drmemory/stack_x86.c:752
#5  0x73840977 in generate_shared_esp_fastpath (drcontext=0xe774a780, ilist=0xe779512c, pc=0xe77fa179 '\253' <repeats 200 times>...)
    at /work/drmemory/git/src/drmemory/stack.c:473
#6  0x73834aff in gencode_init () at /work/drmemory/git/src/drmemory/slowpath.c:1353
#7  0x73820d74 in instrument_init () at /work/drmemory/git/src/drmemory/instru.c:261
#8  0x7381f824 in dr_init (id=0) at /work/drmemory/git/src/drmemory/drmemory.c:2028
#9  0x567c0e3c in instrument_init () at /work/drmemory/git/src/dynamorio/core/lib/instrument.c:683

Generating code at init time is not uncommon and it would be nice to support using drreg then.

Possible solutions:

  • Have drreg special-case this with a static TLS data structure
  • Disallow use during DR init and require clients to have a do-once in thread init to generate code

Unfortunately there does not seem to be a great solution. DR can't call the thread init event before the process init event.

Assignee
Assign to
Time tracking