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
  • #2592
Closed
Open
Issue created Aug 03, 2017 by Derek Bruening@derekbrueningContributor

improve stack overflow detection

DR has a special crash message for a stack overflow, but is_stack_overflow() only checks the dstack and initstack (i.e., not the signal stack). It is also under ifdef STACK_GUARD_PAGE which is only on for debug builds.

Furthermore, we do have -guard_pages on for release builds but is_stack_overflow() does not check for them, only the (extra) guard page taken away from the stack space for STACK_GUARD_PAGE.

This issue covers:

  • having is_stack_overflow() also look for the -guard_pages page
  • enabling the STACK_GUARD_PAGE code (at least the is_stack_overflow() and crash message) in release build
  • eliminating the redundant guard page for STACK_GUARD_PAGE + -guard_pages
  • labeling stack overflow on signal stacks as such

Elaborating further on the extra page: With -guard_pages (on by default) there's already a stack guard page, yet we take away one page from each stack for an extra one in debug build:

5484e000-54855000 ---p 00000000 00:00 0 
54855000-54856000 r-xp 00000000 00:00 0 
54856000-54859000 rw-p 00000000 00:00 0 
54859000-5485d000 ---p 00000000 00:00 0 

On UNIX, we just bail on a write to the extra page: we don't expand the stack into it. (On Windows we mark it PAGE_GUARD: but on the guard page fault we terminate.)

We should change the is_stack_overflow() code to use the inaccessible guard page that's already there and eliminate this extra one for -guard_pages.

For -no_guard_pages, IMHO we should also not include this extra page in the size: it's misleading to users who know their max stack size yet won't be getting that much when they request it. The original thinking was that we wanted debug build overflow a full page before release build might so we're conservative in our sizing.

Assignee
Assign to
Time tracking