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

i#5131 new Linux syscalls: fix clone3 struct handling

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Abhinav Anil Sharma requested to merge i5131-clone3-struct-usage into master Nov 03, 2021
  • Overview 74
  • Commits 21
  • Pipelines 0
  • Changes 9

Fixes DR's handling of the clone_args struct used by the app. While creating our own copy of the app's clone_args object, we need to allocate as much space as specified by the app in the clone3 syscall's args. We should not use the size of DR's internal struct copy (clone3_syscall_args_t) for this, as it may contain less/more fields than the one used by the app.

Replaces memcpy with d_r_safe_read to properly handle the case where reading of the user-provided clone args faults. Adds checks to match kernel's behaviour for EINVAL and EFAULT.

Also fixes an existing bug where we were fixing syscall params and freeing mem in the fork case as well.

Fixes handling for the !CLONE_VM case in clone3, to match what we do for the same in clone.

Adds test for the !CLONE_VM case, and for some cases where clone3 should return EINVAL or EFAULT.

Performs some refactoring: makes asm code in linux.clone test more verbose by using explicit move/load/store to set up registers for the syscall; use separate routine for pre-syscall handling of clone3; use DR's copy of clone args and saved flags everywhere, instead of reading the app clone args without a safe-read.

Issue: #5131 (closed)

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