Conversation
|
@likebreath Please review |
snue
left a comment
There was a problem hiding this comment.
The API change to drop the reference and use Option<File> looks like a good simplification to me.
Thanks for fixing the off by one.
likebreath
left a comment
There was a problem hiding this comment.
@blitz Thanks for the contributions. Changes are looking good to me.
Would you please update the commit message with prefix server instead of vfio_user? This would be very helpful to clarify the scope of changes, say consumers of client APIs are not impacted (such as Cloud Hypervisor).
When a DmaMap message arrives with one file descriptor, the backend still receives None in its dma_map call, because the for fds.len() the code passes None instead of fds[0]. Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
If the backend wants to hang on to the file descriptor, it now has to resort to unsafe code to dup() the File object. Since we don't intend to hold on to the file object, we can just pass it on by value and let the callee do with it as they please. While we are here, also reject malformed input with too many file descriptors. Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
Good point. Done! |
Summary of the PR
This PR fixes handling the DmaMap command. There are two issues:
DmaMapmessage arrives with one file descriptor, the backend still receivesNonein itsdma_mapcall, because forfds.len() == 1the code passesNoneinstead offds[0].Fileobject it gets viabackend.dma_map(), they have a hard time, because we currently only pass a&File. Change this toFileto give the callee more options to hang on to theFilewithout resorting to unsafelibc::dup().Technically only 1 is strictly necessary to get DMA mapping working:
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).
unsafecode is properly documented.