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
  • !5143

i#5131 new linux syscalls: Handle clone3

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Abhinav Anil Sharma requested to merge i5131-handle-clone3 into master Oct 05, 2021
  • Overview 110
  • Commits 29
  • Pipelines 0
  • Changes 8

Adds support for the clone3 syscall, similar to existing support for the clone syscall. The functionality provided by clone3 is a superset of clone. It uses a struct to encapsulate all args. Also, the stack address is expected to be the lowest one in the stack (inclusive); this is unlike clone where it is expected to be the highest one (non-inclusive).

Creates a copy of the kernel's clone_args struct so that it is available on all Linux versions, which simplifies some code.

For clone3, we need to be more careful about restoring any clone args that were modified by DR. As clone3 accepts a pointer to the clone_args struct, any changes we make need to be reverted in the struct. The strategy we follow here is to create a copy of app's clone_args to make the syscall; this way the app's original copy remains intact. After the syscall, we modify the syscall arg reg so that it again contains the pointer to the app's original clone_args instead of DR's modified copy. This restoration is done in the parent and the child both.

Also adds a missing restore for the reg that holds the child's stack ptr arg, after the clone syscall, in the parent thread.

On AArchXX, the syscall reg for clone_args is the same as the one that contains the result of the syscall, so we skip writing the app's clone_args pointer in that case.

Extends the existing linux.clone test to verify behaviour on clone3 as well. As there is no glibc wrapper for clone3 yet, the test has to add a wrapper on its own.

Issue: #5131 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: i5131-handle-clone3