-
Notifications
You must be signed in to change notification settings - Fork 157
Add scratch region #1182
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
Open
syntactically
wants to merge
7
commits into
main
Choose a base branch
from
lm/add-scratch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add scratch region #1182
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6b72ae7
Update Cargo.lock
syntactically 5cef80b
[nix] Bump toolchains, add cargo-hyperlight dependency
syntactically 8e3e52d
[nix] Hack to use vendored deps in shell
syntactically 36bca87
[nix] Add `typos` to the flake dev shell environment
syntactically d7e811b
[dev] Make licence header check more friendly
syntactically 867e0bd
whp: support dynamically mapping/unmapping regions from the surrogate
syntactically 3066d57
Add scratch region
syntactically 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
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 |
|---|---|---|
|
|
@@ -86,11 +86,11 @@ impl GuestView { | |
| let regions = ctx | ||
| .regions | ||
| .iter() | ||
| .filter(|r| !r.host_region.is_empty()) | ||
| .filter(|r| !r.guest_region.is_empty()) | ||
ludfjig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .map(|r| VaRegion { | ||
| begin: r.guest_region.start as u64, | ||
| end: r.guest_region.end as u64, | ||
| offset: r.host_region.start as u64, | ||
| offset: <_ as Into<usize>>::into(r.host_region.start) as u64, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a fix straight from rust-analyzer 😄 can this be just |
||
| protection: VaProtection { | ||
| is_private: false, | ||
| read: r.flags.contains(MemoryRegionFlags::READ), | ||
|
|
@@ -225,8 +225,8 @@ impl ReadProcessMemory for GuestMemReader { | |
| let offset = base - r.guest_region.start; | ||
| let region_slice = unsafe { | ||
| std::slice::from_raw_parts( | ||
| r.host_region.start as *const u8, | ||
| r.host_region.len(), | ||
| <_ as Into<usize>>::into(r.host_region.start) as *const u8, | ||
| r.guest_region.len(), | ||
| ) | ||
| }; | ||
|
|
||
|
|
@@ -463,9 +463,20 @@ mod test { | |
| #[test] | ||
| fn test_crashdump_dummy_core_dump() { | ||
| let dummy_vec = vec![0; 0x1000]; | ||
| use crate::mem::memory_region::{HostGuestMemoryRegion, MemoryRegionKind}; | ||
| #[cfg(target_os = "windows")] | ||
| let host_base = crate::mem::memory_region::HostRegionBase { | ||
| from_handle: windows::Win32::Foundation::INVALID_HANDLE_VALUE.into(), | ||
| handle_base: 0, | ||
| handle_size: -1isize as usize, | ||
| offset: dummy_vec.as_ptr() as usize, | ||
| }; | ||
| #[cfg(not(target_os = "windows"))] | ||
| let host_base = dummy_vec.as_ptr() as usize; | ||
| let host_end = <HostGuestMemoryRegion as MemoryRegionKind>::add(host_base, dummy_vec.len()); | ||
| let regions = vec![MemoryRegion { | ||
| guest_region: 0x1000..0x2000, | ||
| host_region: dummy_vec.as_ptr() as usize..dummy_vec.as_ptr() as usize + dummy_vec.len(), | ||
| host_region: host_base..host_end, | ||
| flags: MemoryRegionFlags::READ | MemoryRegionFlags::WRITE, | ||
| region_type: crate::mem::memory_region::MemoryRegionType::Code, | ||
| }]; | ||
|
|
||
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.
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.
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.
Is this a typo or I don't understand it correctly?
Why is the
MAX_GPAis0x0000_00ff_ffff_ffff(40 bit) when the comment above says36 bit?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.
Indeed, thanks for catching that.