Skip to content

Add copy_wp() method for UFFDIO_COPY with UFFDIO_COPY_MODE_WP#83

Open
vtta wants to merge 1 commit intobytecodealliance:mainfrom
vtta:main
Open

Add copy_wp() method for UFFDIO_COPY with UFFDIO_COPY_MODE_WP#83
vtta wants to merge 1 commit intobytecodealliance:mainfrom
vtta:main

Conversation

@vtta
Copy link

@vtta vtta commented Feb 13, 2026

  • Add copy_wp() method that combines UFFDIO_COPY with UFFDIO_COPY_MODE_WP to resolve a page fault and enable write-protection tracking in a single ioctl call
  • Useful for dirty-page tracking scenarios where you want to resolve a missing-page fault while simultaneously enabling write-protection monitoring, avoiding a separate write_protect()
    call
  • Add test_copy_wp test validating the full missing-fault → copy+WP → write-protect-fault → remove-WP flow

Test plan

  • cargo build --features linux5_7 compiles
  • cargo test --features linux5_7 — all 9 tests pass (5 unit, 1 integration, 3 doc-tests) on Linux 6.8
  • New test_copy_wp verifies:
    1. Missing fault resolved with copy_wp() copies source data and sets WP in one ioctl
    2. Subsequent write triggers a write-protect fault
    3. After removing WP, the write lands successfully

Add a new method that combines UFFDIO_COPY with UFFDIO_COPY_MODE_WP to
resolve a page fault and enable write-protection tracking in a single
ioctl call, useful for dirty-page tracking scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant