-
Notifications
You must be signed in to change notification settings - Fork 256
Track dirty pages via WP #1386
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
Closed
Closed
Track dirty pages via WP #1386
Changes from all commits
Commits
Show all changes
289 commits
Select commit
Hold shift + click to select a range
c5e55e3
Clarify comment
ValentaTomas b04e552
Remove yet non-relevant diagram
ValentaTomas 9607180
Remove comment
ValentaTomas 3cf3bec
Remove write protection field
ValentaTomas ac9bfdf
Add explicit mmap cleanup
ValentaTomas 3ab7848
Merge branch 'main' into uffd-extract
ValentaTomas 69954c5
Improve test names
ValentaTomas 4ce39ab
Fix test error message
ValentaTomas e8b9330
Cleanup tests
ValentaTomas e366753
Merge branch 'main' into uffd-extract
ValentaTomas 5ef4373
Fix lint error
ValentaTomas bb951ba
Add uffd write protect constants
ValentaTomas 8906575
Add UFFD write protection event diagram
ValentaTomas d89b81f
Add userfaultfd write protection methods
ValentaTomas f2a012a
Add tests todo
ValentaTomas e522612
[WIP] Add dirty tracking via WP
ValentaTomas 64e2b13
Clarify WP flow
ValentaTomas bd8988e
[WIP] Add WP to the serve loop
ValentaTomas 0dadb58
Wrap uffd fd in a struct with corresponding methods; Move the low lev…
ValentaTomas 34ccfc5
Unify receiver name
ValentaTomas 7312bca
[WIP] Add uffd tests
ValentaTomas 3c75576
Add disabled wp
ValentaTomas b67f0f2
[WIP] WP
ValentaTomas 9f1708c
[WIP] Check multicopy
ValentaTomas b07e13d
[WIP] Multicopy
ValentaTomas ff23f18
Remove experiments
ValentaTomas 389862e
Add the page alignment check (only in method)
ValentaTomas a8ec1bf
Remove commented out part
ValentaTomas 5632f63
Remove unused return field
ValentaTomas ef33099
Cleanup
ValentaTomas 5384bec
Remove WP parts
ValentaTomas f26cc5c
Cleanup
ValentaTomas 47e14b0
Fix compile errors
ValentaTomas 7ba06e7
Cleanup
ValentaTomas e91945f
Simplify offset check
ValentaTomas d4c2ea0
Clarify comment
ValentaTomas 091607e
Add test constant
ValentaTomas 7ae5f70
Fix incorrect log
ValentaTomas f9f95c5
Fix format
ValentaTomas 708d54b
Remove conversion
ValentaTomas 2aa9449
Make method public
ValentaTomas dc7dc60
Add command context
ValentaTomas 6331bd2
Fix error formatting
ValentaTomas 97ee756
Fix error formatting
ValentaTomas 03b0c46
Improve error comparison
ValentaTomas a331214
Fix error formatting
ValentaTomas 6855c56
Change process exit
ValentaTomas 359c17d
Trigger build
ValentaTomas 835a32d
Enable unpriviledged uffd mode in GH PR tests
ValentaTomas 76c3bf3
Fix uffd unpriviledged enable
ValentaTomas 0ba2a14
Use 4k pages in uffd cross process test
ValentaTomas 52d2fc7
Add access checks to tests
ValentaTomas f092687
Cleanup
ValentaTomas 3f7216a
Remove unused constants for now
ValentaTomas 7fb669e
Fix lint issue
ValentaTomas 052b09f
Clarify naming
ValentaTomas 1066947
Clarify comment
ValentaTomas d06985c
Remove yet non-relevant diagram
ValentaTomas 179ba74
Remove comment
ValentaTomas bacedce
Remove write protection field
ValentaTomas 5d4c576
Add explicit mmap cleanup
ValentaTomas fe1f562
Improve test names
ValentaTomas 70015bd
Fix test error message
ValentaTomas 6920876
Cleanup tests
ValentaTomas cb5cfdb
Fix lint error
ValentaTomas ac77fe5
Put back offset log on uffd panic
ValentaTomas c11e5ef
Fix lint errors
ValentaTomas dcea5f1
Merge branch 'main' into uffd-extract
djeebus 43f7daa
Merge branch 'main' into uffd-extract
ValentaTomas 6e6e073
Fix diagram flags
ValentaTomas 1ec8b01
Add uffd write handling
ValentaTomas f0247a0
Fix test errors
ValentaTomas 131b801
Merge branch 'uffd-extract' into use-uffd-wp-to-only-save-dirty-pages…
ValentaTomas c283d0c
Make offsetmap thread safe
ValentaTomas 7e78473
Fix merge problems; [WIP] Add triggerable uffd copy
ValentaTomas bc50b15
Fix refactor bug
ValentaTomas 96f546c
Fix compile error
ValentaTomas edb1c4c
[WIP] Refactor memory access
ValentaTomas ec4421f
Fix test after refactor
ValentaTomas f916358
Cleanup mapping
ValentaTomas 6838b66
Improve naming
ValentaTomas 0d4dc64
[WIP] Cleanup
ValentaTomas 65cf118
Fix test bugs
ValentaTomas 0505ab3
Add testing case
ValentaTomas a388c74
Cleanup
ValentaTomas 4f89a59
[WIP] Add overlay layer
ValentaTomas 2051bd6
Configure mise
ValentaTomas 8fc2164
Exclude mise tools from git
ValentaTomas 8995e6d
Extend tracker
ValentaTomas 7ac927b
[WIP] Add masked overlay
ValentaTomas 64be117
[WIP] Update masked overlay
ValentaTomas 20c0766
Remove files that will be added later
ValentaTomas ae57cb4
Cleanup
ValentaTomas 9783690
Remove files that will be added later
ValentaTomas aea1db4
Remove unnecessary change
ValentaTomas d9db61a
Cleanup
ValentaTomas 12911de
Remove files that will be added later
ValentaTomas 3b9249c
Add mapping tests
ValentaTomas 06a82ba
Add invalid event log
ValentaTomas 446c935
Remove files that will be added later
ValentaTomas 1bd8700
Remove methods that will be added later
ValentaTomas 345b335
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas 51ccb5e
Minimize changes
ValentaTomas bc3e626
Add settle counter tests
ValentaTomas ae02a32
Minimize changes
ValentaTomas 38e57f7
Cleanup
ValentaTomas 2055343
Fix lint issues
ValentaTomas 4d44340
Revert noop memory change
ValentaTomas 71103ec
Fix formatting
ValentaTomas 7ccc6fb
Add fc snapshot via proc mem
ValentaTomas 4f663ce
Fix lint
ValentaTomas c7db6b3
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas eb9bcfa
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas 98dfa4f
Fix uninitialized handler
ValentaTomas b5a632f
Fix lint errors
ValentaTomas 8614b7b
Test disabling dedup
ValentaTomas 031b7c9
Synchronize test
ValentaTomas 83566b0
Add wp dedup
ValentaTomas a716af2
Test removing only wp dedup
ValentaTomas 7c3cb44
Cleanup
ValentaTomas 41908a0
Fix linter errors
ValentaTomas 2fa17bc
Clarify uffd behavior
ValentaTomas 0237c08
Add tests for parallel uffd; [WIP] testing non-ready uffd
ValentaTomas 23836ca
[WIP] Add parallel test
ValentaTomas de1219d
Fix settle counter test
ValentaTomas 8018841
Cleanup
ValentaTomas 4b0ce69
Minimize changes
ValentaTomas 32fdc01
Minimize changes
ValentaTomas db1543a
Minimize changes
ValentaTomas 57c4f53
Minimize changes
ValentaTomas 450f278
Merge branch 'main' into uffd-refactor
ValentaTomas 2150035
Fix fmt
ValentaTomas 29dbcd3
Tweak tests
ValentaTomas 7ed0a49
Fix lint
ValentaTomas 680dcf5
Minimize changes
ValentaTomas 6bdfaa6
Remove log file
ValentaTomas 81238c0
[WIP] Add tests to current implementation
ValentaTomas 5b60d98
Refactor tracking; Add unregister on pause
ValentaTomas 087e05b
Fix lint errors
ValentaTomas 007420d
Cleanup
ValentaTomas 169a666
Fix test race
ValentaTomas 81fe1c7
Merge branch 'main' into uffd-tests
ValentaTomas 20f7757
Fix test operation
ValentaTomas e2b11e6
Cleanup tests
ValentaTomas bb5d630
Merge branch 'uffd-tests' into uffd-refactor
ValentaTomas 1bc2b21
Merge
ValentaTomas ed4516f
Fix map passing
ValentaTomas 4bf8fbd
Merge branch 'uffd-refactor' into add-tracker
ValentaTomas 6c46c07
Fix serve
ValentaTomas d08a2f9
Put back eagain increase
ValentaTomas 026471d
Remove log
ValentaTomas c1f8966
Remove unused var
ValentaTomas 1789c88
Merge branch 'main' into uffd-refactor
ValentaTomas be8c768
Merge
ValentaTomas 30fbc35
Fix map passing
ValentaTomas 1ff8982
Merge branch 'uffd-refactor' into add-tracker
ValentaTomas 116062b
Cleanup
ValentaTomas bdc15de
Merge branch 'main' into uffd-refactor
ValentaTomas d6dbdd5
Merge branch 'main' into uffd-refactor
ValentaTomas e33692c
Merge
ValentaTomas f04dcfa
Fix tests
ValentaTomas 73be91e
Cleanup
ValentaTomas 888bc66
Cleanup
ValentaTomas c505ed7
Cleanup
ValentaTomas 9ec00dd
Merge branch 'uffd-refactor' into add-tracker
ValentaTomas 21ff568
Cleanup
ValentaTomas e80a760
Remove unused sync.Map function from cross_process_helpers_test.go
ValentaTomas fe4f0a0
Refactor constant formatting in userfaultfd fd.go for improved readab…
ValentaTomas 0782fc4
Refactor Dirty method in Userfaultfd to accept context and update rel…
ValentaTomas e2b4ea4
Enhance SettleCounter functionality by improving context handling in …
ValentaTomas 9c6c60f
Refactor Wait method in SettleCounter to improve atomic checks and re…
ValentaTomas 40e4d5f
Refactor Dirty method in Userfaultfd to remove context parameter and …
ValentaTomas 642bf68
Refactor Pause method in Sandbox to improve error handling by reorder…
ValentaTomas b225692
Add Disable and update comments in Userfaultfd for improved clarity o…
ValentaTomas 6a49d5a
Refactor Userfaultfd to replace settle struct with sync.RWMutex for i…
ValentaTomas 520574f
Refactor Tracker's Add method to remove return value and simplify log…
ValentaTomas df33f90
Add write protection handling in Userfaultfd and enhance memory regio…
ValentaTomas 4fc3aa2
[WIP] Add WP tests
ValentaTomas b55be74
Refactor Userfaultfd methods to use uintptr for size parameters and e…
ValentaTomas 121c00b
Use constructor
ValentaTomas 05fb2ca
Refactor slice
ValentaTomas 896d177
Cleanup comments
ValentaTomas 320b26c
Add comments
ValentaTomas e630223
Improve tests
ValentaTomas 5897b18
Improve tracker tests
ValentaTomas cdfb109
Cleanup
ValentaTomas 4429aaf
Tweak the lock
ValentaTomas 070ddb6
Merge branch 'main' into add-tracker
ValentaTomas c43a4e0
Merge branch 'add-tracker' into refactor-uffd-add-wp
ValentaTomas 5899e59
Refactor newUffdioWriteProtect to use newUffdioRange constructor for …
ValentaTomas febd7e4
Update comments in userfaultfd.go for clarity on memory handling and …
ValentaTomas 050b187
Rename handleWriteProtection to handleWriteProtected for consistency …
ValentaTomas b7b5329
Add explicit dirty reset
ValentaTomas 2ea1261
Cleanup
ValentaTomas 4f13b7c
Merge branch 'add-tracker' into refactor-uffd-add-wp
ValentaTomas d282652
WIP: Add tests
ValentaTomas b6a0c3a
Merge branch 'main' into add-tracker
ValentaTomas 41da606
Refactor Userfaultfd to register memory regions with write protection…
ValentaTomas b5ffe46
Update memory mapping tests to use uintptr for expected size and repl…
ValentaTomas c897737
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas 4226213
Add helpers
ValentaTomas 45029a1
Refactor error handling in memory mapping: Introduce OffsetNotFoundEr…
ValentaTomas d409985
Refactor memory mapping: Rename variable 's' to 'remainingSize' for i…
ValentaTomas 7da216e
Remove outdated comments in uffd.go regarding the Disable method and …
ValentaTomas c9127db
Add tests for various read/write operations in userfaultfd, including…
ValentaTomas 7e6cd7f
[WIP] Refactor tests to allow testing locking
ValentaTomas 2f3cd2d
Add uffd event handler tests
ValentaTomas e9d6311
Fix event testing
ValentaTomas 185b242
Rename channel in TestUffdSettleRequests to better reflect its purpos…
ValentaTomas a5d81f7
Improve tests
ValentaTomas e5e5666
Merge branch 'add-tracker' into refactor-uffd-add-wp
ValentaTomas 6258ce4
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas 40029a2
Fix incorrect test label
ValentaTomas 90259f8
Improve comments
ValentaTomas 13bf3cc
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas 9f069df
Add MemoryNotFaultedError type and related tests; remove obsolete mem…
ValentaTomas 9705772
Enhance error handling in NewUserfaultfdFromFd by including the origi…
ValentaTomas 252b8f0
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas 8d5195b
Clarify comment
ValentaTomas 3de2466
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas d94e0be
Refactor userfaultfd_memory_view_test to improve read assertions and …
ValentaTomas 518d5da
Update comment to clarify that passing 0 as the mode removes write pr…
ValentaTomas de60520
Cleanup
ValentaTomas 97d6267
Fix host mapping
ValentaTomas 15ffaef
Add tests
ValentaTomas 62df6c5
Improve tests
ValentaTomas a5a38b6
Fix diff test order
ValentaTomas 7901cbb
Improve tests
ValentaTomas 176f283
Improve tests
ValentaTomas 09a5315
Update assertions in view tests to use pagesize and improve error rep…
ValentaTomas e5504c5
Fix tests
ValentaTomas 7d148a0
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas b11d70b
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas 734a9e2
Fix merge bugs
ValentaTomas 3fdd24a
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas f00ce48
Merge branch 'main' into add-tracker
ValentaTomas 16eaf89
Merge branch 'main' into add-tracker
ValentaTomas 0f2ad5c
Add comment
ValentaTomas 8dc51d0
Merge branch 'add-tracker' of https://github.com/e2b-dev/infra into a…
ValentaTomas 770c3a3
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas baa5ec3
Merge branch 'add-tracker' into refactor-uffd-add-wp
ValentaTomas 137d8bf
WIP
ValentaTomas b8c3e60
Merge branch 'refactor-uffd-add-wp' into proc-mem-access
ValentaTomas be2c9e3
Merge branch 'proc-mem-access' into proc-only
ValentaTomas 2e95a19
Merge
ValentaTomas 55df11d
Improve err return
ValentaTomas 94266b3
Incorporate custom fc changes
ValentaTomas 1e048cb
Remove unused parts
ValentaTomas 3e04c57
Cleanup
ValentaTomas 8d94828
Fix missing hook
ValentaTomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package fc | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/e2b-dev/infra/packages/orchestrator/internal/sandbox/uffd/memory" | ||
| ) | ||
|
|
||
| func (p *Process) Memory(ctx context.Context) (*memory.View, error) { | ||
| pid, err := p.Pid() | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get process pid: %w", err) | ||
| } | ||
|
|
||
| info, err := p.client.instanceInfo(ctx) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get instance info: %w", err) | ||
| } | ||
|
|
||
| mapping, err := memory.NewMappingFromFCInfo(info.MemoryRegions) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create memory mapping: %w", err) | ||
| } | ||
|
|
||
| view, err := memory.NewView(pid, mapping) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create memory view: %w", err) | ||
| } | ||
|
|
||
| return view, nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.