Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
a929999
Wrap uffd fd in a struct with corresponding methods; Move the low lev…
ValentaTomas Aug 7, 2025
58a4d41
Unify receiver name
ValentaTomas Aug 7, 2025
e3d6716
[WIP] Add uffd tests
ValentaTomas Aug 7, 2025
56e43c8
Add disabled wp
ValentaTomas Aug 7, 2025
acc2d66
[WIP] WP
ValentaTomas Aug 8, 2025
1c4b8ea
[WIP] Check multicopy
ValentaTomas Aug 10, 2025
9d7f5e5
[WIP] Multicopy
ValentaTomas Aug 12, 2025
66a1bbe
Remove experiments
ValentaTomas Aug 19, 2025
e774a92
Add the page alignment check (only in method)
ValentaTomas Aug 19, 2025
f240542
Remove commented out part
ValentaTomas Aug 19, 2025
f31cb47
Remove unused return field
ValentaTomas Aug 19, 2025
bfc5935
Cleanup
ValentaTomas Aug 19, 2025
f732d5a
Remove WP parts
ValentaTomas Aug 19, 2025
855369b
Cleanup
ValentaTomas Aug 19, 2025
f981d76
Fix compile errors
ValentaTomas Oct 3, 2025
ccd8396
Cleanup
ValentaTomas Oct 4, 2025
fbf258a
Simplify offset check
ValentaTomas Oct 4, 2025
67b1bfb
Clarify comment
ValentaTomas Oct 4, 2025
28c48a7
Add test constant
ValentaTomas Oct 4, 2025
1ecd0a1
Fix incorrect log
ValentaTomas Oct 4, 2025
4fe40a0
Fix format
ValentaTomas Oct 4, 2025
bd8dc0b
Remove conversion
ValentaTomas Oct 4, 2025
f0d17ef
Make method public
ValentaTomas Oct 4, 2025
c4691b5
Add command context
ValentaTomas Oct 4, 2025
9581305
Fix error formatting
ValentaTomas Oct 4, 2025
fa72b74
Fix error formatting
ValentaTomas Oct 4, 2025
8230e4f
Improve error comparison
ValentaTomas Oct 4, 2025
1454794
Fix error formatting
ValentaTomas Oct 4, 2025
ac484d2
Change process exit
ValentaTomas Oct 4, 2025
f2d01de
Enable unpriviledged uffd mode in GH PR tests
ValentaTomas Oct 4, 2025
d27b2d4
Trigger build
ValentaTomas Oct 4, 2025
5e83359
Merge branch 'uffd-extract' of https://github.com/e2b-dev/infra into …
ValentaTomas Oct 4, 2025
05ae2e9
Fix uffd unpriviledged enable
ValentaTomas Oct 4, 2025
512fd04
Use 4k pages in uffd cross process test
ValentaTomas Oct 4, 2025
1ecc810
Add access checks to tests
ValentaTomas Oct 5, 2025
fd77d22
Cleanup
ValentaTomas Oct 5, 2025
b1a6d53
Remove unused constants for now
ValentaTomas Oct 5, 2025
2a329c8
Fix lint issue
ValentaTomas Oct 5, 2025
44984ea
Clarify naming
ValentaTomas Oct 5, 2025
c5e55e3
Clarify comment
ValentaTomas Oct 5, 2025
b04e552
Remove yet non-relevant diagram
ValentaTomas Oct 5, 2025
9607180
Remove comment
ValentaTomas Oct 5, 2025
3cf3bec
Remove write protection field
ValentaTomas Oct 5, 2025
ac9bfdf
Add explicit mmap cleanup
ValentaTomas Oct 6, 2025
3ab7848
Merge branch 'main' into uffd-extract
ValentaTomas Oct 6, 2025
69954c5
Improve test names
ValentaTomas Oct 6, 2025
4ce39ab
Fix test error message
ValentaTomas Oct 6, 2025
e8b9330
Cleanup tests
ValentaTomas Oct 6, 2025
e366753
Merge branch 'main' into uffd-extract
ValentaTomas Oct 6, 2025
5ef4373
Fix lint error
ValentaTomas Oct 6, 2025
bb951ba
Add uffd write protect constants
ValentaTomas Oct 5, 2025
8906575
Add UFFD write protection event diagram
ValentaTomas Oct 5, 2025
d89b81f
Add userfaultfd write protection methods
ValentaTomas Oct 5, 2025
f2a012a
Add tests todo
ValentaTomas Oct 5, 2025
e522612
[WIP] Add dirty tracking via WP
ValentaTomas Oct 6, 2025
64e2b13
Clarify WP flow
ValentaTomas Oct 7, 2025
bd8988e
[WIP] Add WP to the serve loop
ValentaTomas Oct 7, 2025
0dadb58
Wrap uffd fd in a struct with corresponding methods; Move the low lev…
ValentaTomas Aug 7, 2025
34ccfc5
Unify receiver name
ValentaTomas Aug 7, 2025
7312bca
[WIP] Add uffd tests
ValentaTomas Aug 7, 2025
3c75576
Add disabled wp
ValentaTomas Aug 7, 2025
b67f0f2
[WIP] WP
ValentaTomas Aug 8, 2025
9f1708c
[WIP] Check multicopy
ValentaTomas Aug 10, 2025
b07e13d
[WIP] Multicopy
ValentaTomas Aug 12, 2025
ff23f18
Remove experiments
ValentaTomas Aug 19, 2025
389862e
Add the page alignment check (only in method)
ValentaTomas Aug 19, 2025
a8ec1bf
Remove commented out part
ValentaTomas Aug 19, 2025
5632f63
Remove unused return field
ValentaTomas Aug 19, 2025
ef33099
Cleanup
ValentaTomas Aug 19, 2025
5384bec
Remove WP parts
ValentaTomas Aug 19, 2025
f26cc5c
Cleanup
ValentaTomas Aug 19, 2025
47e14b0
Fix compile errors
ValentaTomas Oct 3, 2025
7ba06e7
Cleanup
ValentaTomas Oct 4, 2025
e91945f
Simplify offset check
ValentaTomas Oct 4, 2025
d4c2ea0
Clarify comment
ValentaTomas Oct 4, 2025
091607e
Add test constant
ValentaTomas Oct 4, 2025
7ae5f70
Fix incorrect log
ValentaTomas Oct 4, 2025
f9f95c5
Fix format
ValentaTomas Oct 4, 2025
708d54b
Remove conversion
ValentaTomas Oct 4, 2025
2aa9449
Make method public
ValentaTomas Oct 4, 2025
dc7dc60
Add command context
ValentaTomas Oct 4, 2025
6331bd2
Fix error formatting
ValentaTomas Oct 4, 2025
97ee756
Fix error formatting
ValentaTomas Oct 4, 2025
03b0c46
Improve error comparison
ValentaTomas Oct 4, 2025
a331214
Fix error formatting
ValentaTomas Oct 4, 2025
6855c56
Change process exit
ValentaTomas Oct 4, 2025
359c17d
Trigger build
ValentaTomas Oct 4, 2025
835a32d
Enable unpriviledged uffd mode in GH PR tests
ValentaTomas Oct 4, 2025
76c3bf3
Fix uffd unpriviledged enable
ValentaTomas Oct 4, 2025
0ba2a14
Use 4k pages in uffd cross process test
ValentaTomas Oct 4, 2025
52d2fc7
Add access checks to tests
ValentaTomas Oct 5, 2025
f092687
Cleanup
ValentaTomas Oct 5, 2025
3f7216a
Remove unused constants for now
ValentaTomas Oct 5, 2025
7fb669e
Fix lint issue
ValentaTomas Oct 5, 2025
052b09f
Clarify naming
ValentaTomas Oct 5, 2025
1066947
Clarify comment
ValentaTomas Oct 5, 2025
d06985c
Remove yet non-relevant diagram
ValentaTomas Oct 5, 2025
179ba74
Remove comment
ValentaTomas Oct 5, 2025
bacedce
Remove write protection field
ValentaTomas Oct 5, 2025
5d4c576
Add explicit mmap cleanup
ValentaTomas Oct 6, 2025
fe1f562
Improve test names
ValentaTomas Oct 6, 2025
70015bd
Fix test error message
ValentaTomas Oct 6, 2025
6920876
Cleanup tests
ValentaTomas Oct 6, 2025
cb5cfdb
Fix lint error
ValentaTomas Oct 6, 2025
ac77fe5
Put back offset log on uffd panic
ValentaTomas Oct 7, 2025
c11e5ef
Fix lint errors
ValentaTomas Oct 8, 2025
dcea5f1
Merge branch 'main' into uffd-extract
djeebus Oct 10, 2025
43f7daa
Merge branch 'main' into uffd-extract
ValentaTomas Oct 11, 2025
6e6e073
Fix diagram flags
ValentaTomas Oct 13, 2025
1ec8b01
Add uffd write handling
ValentaTomas Oct 14, 2025
f0247a0
Fix test errors
ValentaTomas Oct 14, 2025
131b801
Merge branch 'uffd-extract' into use-uffd-wp-to-only-save-dirty-pages…
ValentaTomas Oct 14, 2025
c283d0c
Make offsetmap thread safe
ValentaTomas Oct 14, 2025
7e78473
Fix merge problems; [WIP] Add triggerable uffd copy
ValentaTomas Oct 14, 2025
bc50b15
Fix refactor bug
ValentaTomas Oct 16, 2025
96f546c
Fix compile error
ValentaTomas Oct 16, 2025
edb1c4c
[WIP] Refactor memory access
ValentaTomas Oct 17, 2025
ec4421f
Fix test after refactor
ValentaTomas Oct 17, 2025
f916358
Cleanup mapping
ValentaTomas Oct 17, 2025
6838b66
Improve naming
ValentaTomas Oct 17, 2025
0d4dc64
[WIP] Cleanup
ValentaTomas Oct 18, 2025
65cf118
Fix test bugs
ValentaTomas Oct 18, 2025
0505ab3
Add testing case
ValentaTomas Oct 18, 2025
a388c74
Cleanup
ValentaTomas Oct 18, 2025
4f89a59
[WIP] Add overlay layer
ValentaTomas Oct 20, 2025
2051bd6
Configure mise
ValentaTomas Oct 20, 2025
8fc2164
Exclude mise tools from git
ValentaTomas Oct 20, 2025
8995e6d
Extend tracker
ValentaTomas Oct 20, 2025
7ac927b
[WIP] Add masked overlay
ValentaTomas Oct 20, 2025
64be117
[WIP] Update masked overlay
ValentaTomas Oct 20, 2025
20c0766
Remove files that will be added later
ValentaTomas Oct 20, 2025
ae57cb4
Cleanup
ValentaTomas Oct 20, 2025
9783690
Remove files that will be added later
ValentaTomas Oct 20, 2025
aea1db4
Remove unnecessary change
ValentaTomas Oct 20, 2025
d9db61a
Cleanup
ValentaTomas Oct 20, 2025
12911de
Remove files that will be added later
ValentaTomas Oct 20, 2025
3b9249c
Add mapping tests
ValentaTomas Oct 20, 2025
06a82ba
Add invalid event log
ValentaTomas Oct 20, 2025
446c935
Remove files that will be added later
ValentaTomas Oct 20, 2025
1bd8700
Remove methods that will be added later
ValentaTomas Oct 20, 2025
345b335
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas Oct 20, 2025
51ccb5e
Minimize changes
ValentaTomas Oct 20, 2025
bc3e626
Add settle counter tests
ValentaTomas Oct 20, 2025
ae02a32
Minimize changes
ValentaTomas Oct 20, 2025
38e57f7
Cleanup
ValentaTomas Oct 20, 2025
2055343
Fix lint issues
ValentaTomas Oct 20, 2025
4d44340
Revert noop memory change
ValentaTomas Oct 21, 2025
71103ec
Fix formatting
ValentaTomas Oct 21, 2025
c7db6b3
Merge branch 'main' into refactor-uffd-add-wp
ValentaTomas Oct 21, 2025
98dfa4f
Fix uninitialized handler
ValentaTomas Oct 21, 2025
b5a632f
Fix lint errors
ValentaTomas Oct 21, 2025
8614b7b
Test disabling dedup
ValentaTomas Oct 21, 2025
031b7c9
Synchronize test
ValentaTomas Oct 21, 2025
83566b0
Add wp dedup
ValentaTomas Oct 21, 2025
a716af2
Test removing only wp dedup
ValentaTomas Oct 21, 2025
7c3cb44
Cleanup
ValentaTomas Oct 21, 2025
41908a0
Fix linter errors
ValentaTomas Oct 21, 2025
2fa17bc
Clarify uffd behavior
ValentaTomas Oct 21, 2025
0237c08
Add tests for parallel uffd; [WIP] testing non-ready uffd
ValentaTomas Oct 22, 2025
23836ca
[WIP] Add parallel test
ValentaTomas Oct 22, 2025
de1219d
Fix settle counter test
ValentaTomas Oct 23, 2025
8018841
Cleanup
ValentaTomas Oct 24, 2025
4b0ce69
Minimize changes
ValentaTomas Oct 27, 2025
32fdc01
Minimize changes
ValentaTomas Oct 27, 2025
db1543a
Minimize changes
ValentaTomas Oct 27, 2025
57c4f53
Minimize changes
ValentaTomas Oct 27, 2025
450f278
Merge branch 'main' into uffd-refactor
ValentaTomas Oct 27, 2025
2150035
Fix fmt
ValentaTomas Oct 27, 2025
29dbcd3
Tweak tests
ValentaTomas Oct 27, 2025
7ed0a49
Fix lint
ValentaTomas Oct 27, 2025
680dcf5
Minimize changes
ValentaTomas Oct 27, 2025
6bdfaa6
Remove log file
ValentaTomas Oct 27, 2025
81238c0
[WIP] Add tests to current implementation
ValentaTomas Oct 29, 2025
007420d
Cleanup
ValentaTomas Nov 3, 2025
169a666
Fix test race
ValentaTomas Nov 3, 2025
81fe1c7
Merge branch 'main' into uffd-tests
ValentaTomas Nov 3, 2025
20f7757
Fix test operation
ValentaTomas Nov 3, 2025
e2b11e6
Cleanup tests
ValentaTomas Nov 3, 2025
bb5d630
Merge branch 'uffd-tests' into uffd-refactor
ValentaTomas Nov 4, 2025
1bc2b21
Merge
ValentaTomas Nov 4, 2025
ed4516f
Fix map passing
ValentaTomas Nov 4, 2025
d08a2f9
Put back eagain increase
ValentaTomas Nov 4, 2025
026471d
Remove log
ValentaTomas Nov 4, 2025
c1f8966
Remove unused var
ValentaTomas Nov 4, 2025
1789c88
Merge branch 'main' into uffd-refactor
ValentaTomas Nov 4, 2025
be8c768
Merge
ValentaTomas Nov 4, 2025
30fbc35
Fix map passing
ValentaTomas Nov 4, 2025
bdc15de
Merge branch 'main' into uffd-refactor
ValentaTomas Nov 7, 2025
d6dbdd5
Merge branch 'main' into uffd-refactor
ValentaTomas Nov 7, 2025
e33692c
Merge
ValentaTomas Nov 7, 2025
f04dcfa
Fix tests
ValentaTomas Nov 7, 2025
73be91e
Cleanup
ValentaTomas Nov 7, 2025
888bc66
Cleanup
ValentaTomas Nov 7, 2025
c505ed7
Cleanup
ValentaTomas Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

32 changes: 32 additions & 0 deletions packages/orchestrator/internal/sandbox/uffd/memory/mapping.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package memory

import (
"fmt"
)

type AddressNotFoundError struct {
hostVirtAddr uintptr
}

func (e AddressNotFoundError) Error() string {
return fmt.Sprintf("address %d not found in any mapping", e.hostVirtAddr)
}

type Mapping struct {
Regions []Region
}

func NewMapping(regions []Region) *Mapping {
return &Mapping{Regions: regions}
}

// GetOffset returns the relative offset and the page size of the mapped range for a given address.
func (m *Mapping) GetOffset(hostVirtAddr uintptr) (int64, uint64, error) {
for _, r := range m.Regions {
if hostVirtAddr >= r.BaseHostVirtAddr && hostVirtAddr < r.endHostVirtAddr() {
return r.shiftedOffset(hostVirtAddr), uint64(r.PageSize), nil
}
}

return 0, 0, AddressNotFoundError{hostVirtAddr: hostVirtAddr}
}
247 changes: 247 additions & 0 deletions packages/orchestrator/internal/sandbox/uffd/memory/mapping_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
package memory

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/e2b-dev/infra/packages/shared/pkg/storage/header"
)

func TestMapping_GetOffset(t *testing.T) {
regions := []Region{
{
BaseHostVirtAddr: 0x1000,
Size: 0x2000,
Offset: 0x5000,
PageSize: header.PageSize,
},
{
BaseHostVirtAddr: 0x5000,
Size: 0x1000,
Offset: 0x8000,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)

tests := []struct {
name string
hostVirtAddr uintptr
expectedOffset int64
expectedSize uint64
expectError error
}{
{
name: "valid address in first region",
hostVirtAddr: 0x1500,
expectedOffset: 0x5500, // 0x5000 + (0x1500 - 0x1000)
expectedSize: 0x1000,
},
{
name: "valid address at start of first region",
hostVirtAddr: 0x1000,
expectedOffset: 0x5000,
expectedSize: 0x1000,
},
{
name: "valid address at end-1 of first region",
hostVirtAddr: 0x2FFF, // 0x1000 + 0x2000 - 1
expectedOffset: 0x6FFF, // 0x5000 + (0x2FFF - 0x1000)
expectedSize: 0x1000,
},
{
name: "valid address in second region",
hostVirtAddr: 0x5500,
expectedOffset: 0x8500, // 0x8000 + (0x5500 - 0x5000)
expectedSize: 0x1000,
},
{
name: "valid address at start of second region",
hostVirtAddr: 0x5000,
expectedOffset: 0x8000,
expectedSize: 0x1000,
},
{
name: "valid address at end-1 of second region",
hostVirtAddr: 0x5FFF,
expectedOffset: 0x8FFF, // 0x8000 + (0x5FFF - 0x5000)
expectedSize: 0x1000,
},
{
name: "address before first region",
hostVirtAddr: 0x500,
expectError: AddressNotFoundError{hostVirtAddr: 0x500},
},
{
name: "address after last region",
hostVirtAddr: 0x7000,
expectError: AddressNotFoundError{hostVirtAddr: 0x7000},
},
{
name: "address in gap between regions",
hostVirtAddr: 0x4000,
expectError: AddressNotFoundError{hostVirtAddr: 0x4000},
},
{
name: "address at exact end of first region (exclusive)",
hostVirtAddr: 0x3000, // 0x1000 + 0x2000
expectError: AddressNotFoundError{hostVirtAddr: 0x3000},
},
{
name: "address at exact end of second region (exclusive)",
hostVirtAddr: 0x6000, // 0x5000 + 0x1000
expectError: AddressNotFoundError{hostVirtAddr: 0x6000},
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
offset, size, err := mapping.GetOffset(tt.hostVirtAddr)
if tt.expectError != nil {
require.ErrorIs(t, err, tt.expectError)
} else {
require.NoError(t, err)
assert.Equal(t, tt.expectedOffset, offset)
assert.Equal(t, tt.expectedSize, size)
}
})
}
}

func TestMapping_EmptyRegions(t *testing.T) {
mapping := NewMapping([]Region{})

// Test GetOffset with empty regions
_, _, err := mapping.GetOffset(0x1000)
require.Error(t, err)
}

func TestMapping_OverlappingRegions(t *testing.T) {
// Test with overlapping regions (edge case)
regions := []Region{
{
BaseHostVirtAddr: 0x1000,
Size: 0x2000,
Offset: 0x5000,
PageSize: header.PageSize,
},
{
BaseHostVirtAddr: 0x2000, // Overlaps with first region
Size: 0x1000,
Offset: 0x8000,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)

// The first matching region should be returned
offset, size, err := mapping.GetOffset(0x2500) // In overlap area
require.NoError(t, err)

// Should get result from first region
require.Equal(t, int64(0x5000+(0x2500-0x1000)), offset) // 0x6500
require.Equal(t, uint64(header.PageSize), size)

// Also test that the underlying implementation prefers the first region if both regions contain the address
offset2, size2, err2 := mapping.GetOffset(0x2000)
require.NoError(t, err2)
require.Equal(t, int64(0x5000+(0x2000-0x1000)), offset2) // 0x6000 from first region
require.Equal(t, uint64(header.PageSize), size2)
}

func TestMapping_BoundaryConditions(t *testing.T) {
regions := []Region{
{
BaseHostVirtAddr: 0x1000,
Size: 0x2000,
Offset: 0x5000,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)

// Test exact start boundary
offset, _, err := mapping.GetOffset(0x1000)
require.NoError(t, err)
require.Equal(t, int64(0x5000), offset) // 0x5000 + (0x1000 - 0x1000)

// Test just before end boundary (exclusive)
offset, _, err = mapping.GetOffset(0x2FFF) // 0x1000 + 0x2000 - 1
require.NoError(t, err)
require.Equal(t, int64(0x5000+(0x2FFF-0x1000)), offset) // 0x6FFF

// Test exact end boundary (should fail - exclusive)
_, _, err = mapping.GetOffset(0x3000) // 0x1000 + 0x2000
require.Error(t, err)

// Test below start boundary (should fail)
_, _, err = mapping.GetOffset(0x0FFF)
require.Error(t, err)
}

func TestMapping_SingleLargeRegion(t *testing.T) {
// Entire 64-bit address space region
regions := []Region{
{
BaseHostVirtAddr: 0x0,
Size: ^uintptr(0), // Max uintptr
Offset: 0x100,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)

offset, size, err := mapping.GetOffset(0xABCDEF)
require.NoError(t, err)
require.Equal(t, int64(0x100+0xABCDEF), offset)
require.Equal(t, uint64(header.PageSize), size)
}

func TestMapping_ZeroSizeRegion(t *testing.T) {
regions := []Region{
{
BaseHostVirtAddr: 0x2000,
Size: 0,
Offset: 0x1000,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)
_, _, err := mapping.GetOffset(0x2000)
require.Error(t, err)
}

func TestMapping_MultipleRegionsSparse(t *testing.T) {
regions := []Region{
{
BaseHostVirtAddr: 0x100,
Size: 0x100,
Offset: 0x1000,
PageSize: header.PageSize,
},
{
BaseHostVirtAddr: 0x10000,
Size: 0x100,
Offset: 0x2000,
PageSize: header.PageSize,
},
}
mapping := NewMapping(regions)
// Should succeed for start of first region
offset, size, err := mapping.GetOffset(0x100)
require.NoError(t, err)
require.Equal(t, int64(0x1000), offset)
require.Equal(t, uint64(header.PageSize), size)

// Should succeed for start of second region
offset, size, err = mapping.GetOffset(0x10000)
require.NoError(t, err)
require.Equal(t, int64(0x2000), offset)
require.Equal(t, uint64(header.PageSize), size)

// In gap
_, _, err = mapping.GetOffset(0x5000)
require.Error(t, err)
}
23 changes: 23 additions & 0 deletions packages/orchestrator/internal/sandbox/uffd/memory/region.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package memory

// Region is a mapping of a region of memory of the guest to a region of memory on the host.
// The serialization is based on the Firecracker UFFD protocol communication.
type Region struct {
BaseHostVirtAddr uintptr `json:"base_host_virt_addr"`
Size uintptr `json:"size"`
Offset uintptr `json:"offset"`
// This is actually in bytes.
// This field is deprecated in the newer version of the Firecracer with a new field `page_size`.
PageSize uintptr `json:"page_size_kib"`
}

// endHostVirtAddr returns the end address of the region in host virtual address.
// The end address is exclusive.
func (r *Region) endHostVirtAddr() uintptr {
return r.BaseHostVirtAddr + r.Size
}

// shiftedOffset returns the offset of the given address in the region.
func (r *Region) shiftedOffset(addr uintptr) int64 {
return int64(addr - r.BaseHostVirtAddr + r.Offset)
}
Loading
Loading