-
Notifications
You must be signed in to change notification settings - Fork 112
Deprecate try_access()
#349
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
Conversation
92a0e25
to
59e3811
Compare
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.
Nice! You make it look easy.
Typo note on the first commit: Should be “range” instead of “rnage” in the title.
a9ecfa4
to
e70475c
Compare
Changes v1 -> v2:
|
@roypat sorry I messed up using the suggestion feature :/ if you squash my misguided commit, I'll approve. |
dd33c70
to
db00f74
Compare
haha, no worries! squashed (and fixed a typo I noticed, "when if" -> "when it") :) |
No idea why that would fail only under Miri... I cannot even reproduce it locally. |
Argh, that must be the same thing as 029c652. Let me add a commit marking this one as cfg(not(miri)) as well |
Switching the check_range() implementation from try_access() to get_slices() will mean that the test requires a working implementation of get_slice(), which MockRegion does not have. So instead have the test use the actual memory regions defined in the mmap module. Signed-off-by: Patrick Roy <[email protected]>
Declare `len` as type `usize`, which reduce the number of casts between usize and u64 (the variable is most often uses as a usize, and only once needs to be u64). Signed-off-by: Patrick Roy <[email protected]>
Panic in get_slices() if the call to .get_slice() returns a slice that does not match the `len` parameter passed to it. If this happens there is an application bug somewhere in the GuestMemoryRegion implementation, and the library code in vm-memory, while not doing anything unsound, will probably react unpredictably to this situation. This way, the final paragraph in the get_slices() documentatoin about cumulative lengths is actually true. Signed-off-by: Patrick Roy <[email protected]>
Deprecate 'GuestMemory::try_access()` in favor of the external iterator provided by `GuestMemory::get_slices()`. Rewrite all internal usages of `try_access()` in terms of `get_slices()`. Signed-off-by: Patrick Roy <[email protected]>
d4469c1
to
8b0d3c1
Compare
Miri sometimes non-deterministically has its mocks for read(2)/write(2) do only partial reads/writes, which our unittests cannot deal with. See also commit 029c652 ("fix(test): do not try to read files under miri"). Mark these test cases as cfg(not(miri)). Signed-off-by: Patrick Roy <[email protected]>
8b0d3c1
to
9c8fb09
Compare
Looks good to me, thanks! (Is it common to use ntoskrnl.exe as a known-content file under Windows 😅?) |
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.
Ah, this is how I need to do it.
I have no idea, I haven't touched a windows system since high school haha |
@roypat any objections to inviting Hanna to the repo so that her reviews count as approving? |
Sure! Thanks to @stefano-garzarella it’s not as pressing anymore, but I can take on some reviewing anyway. |
As discussed on PR rust-vmm#349, adding myself to the CODEOWNERS file to help with reviews. Signed-off-by: Hanna Czenczek <[email protected]>
As discussed on PR #349, adding myself to the CODEOWNERS file to help with reviews. Signed-off-by: Hanna Czenczek <[email protected]>
Summary of the PR
Following up on some discussions in #339, attempt to figure out how feasible it is to replace
try_access()
withget_slices()
+ functions in Rust's iterator trait.cc @XanClic
cc @bonzini
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.