-
Notifications
You must be signed in to change notification settings - Fork 178
Extract low level UFFD handler to a separate package #973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c85fec0
to
855369b
Compare
I'll improve the tests a little, but the rest should be ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extracts the low-level user fault file descriptor (UFFD) handler into a separate userfaultfd package, improving code organization and modularity. The extraction refactors the UFFD functionality out of the main uffd package into a dedicated userfaultfd subpackage.
- Moved UFFD handling logic from uffd package to new userfaultfd package
- Created abstraction layer with memory mapping interfaces
- Added comprehensive test coverage for UFFD functionality including cross-process scenarios
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go | Comprehensive test suite for UFFD missing page and write protection scenarios |
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_cross_process_test.go | Cross-process UFFD tests simulating FC-orchestrator interaction |
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd.go | Core UFFD operations including registration and copy functionality |
packages/orchestrator/internal/sandbox/uffd/userfaultfd/serve.go | UFFD event handling and page fault processing logic |
packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go | UFFD constants and helper functions with improved address handling |
packages/orchestrator/internal/sandbox/uffd/uffd.go | Updated to use new userfaultfd package and memory interfaces |
packages/orchestrator/internal/sandbox/uffd/testutils/ | Test utilities for memory mapping and data preparation |
packages/orchestrator/internal/sandbox/uffd/memory/ | Memory mapping interfaces and Firecracker-specific implementations |
Comments suppressed due to low confidence (2)
packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go:1
- The constant
UFFD_FEATURE_WP_HUGETLBFS_SHMEM
is being removed but may be needed for write protection features. Verify this removal is intentional and doesn't break functionality.
package userfaultfd
packages/orchestrator/internal/sandbox/uffd/uffd.go:1
- The
TrackAndReturnNil
method is being removed. Ensure all callers of this method have been updated to handle its removal.
package uffd
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_cross_process_test.go
Outdated
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_cross_process_test.go
Outdated
Show resolved
Hide resolved
bugbot run |
✅ Extracted all non-relevant (mostly write-protection and direct memory access related) code to separate PRs so it can be merged in steps. |
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Outdated
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Outdated
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Outdated
Show resolved
Hide resolved
packages/orchestrator/internal/sandbox/uffd/userfaultfd/userfaultfd_test.go
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just added some opinions, none of which are critical.
…el uffd handling to a subpackage
1d37eef
to
c11e5ef
Compare
Note
Extracts low-level UFFD into a new userfaultfd package, replaces mapping with memory map API, wires into orchestrator, and adds robust 4K/2MB tests; CI enables UFFD and hugepages.
userfaultfd
package (Serve
,configureApi
,Register
,copy
,Close
).mapping
withmemory
package (MemfileMap
,MemoryMap.GetOffset
); update Firecracker mapping and JSON parsing.uffd
integration to useuserfaultfd.NewUserfaultfdFromFd(...).Serve(...)
; removeTrackAndReturnNil
.userfaultfd
tests covering 4K and 2MB hugepages; ensure non-flaky behavior.testutils
helpers (NewPageMmap
,ContiguousMap
, random data, content slicer) andutils.MapKeys
.userfaultfd
and mounts hugepages before tests.MaskTemplate.Close
.Written by Cursor Bugbot for commit dcea5f1. This will update automatically on new commits. Configure here.