-
Notifications
You must be signed in to change notification settings - Fork 15
Fix address translation for copy_data_between_cages
#582
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
base: main
Are you sure you want to change the base?
Fix address translation for copy_data_between_cages
#582
Conversation
|
Adding @Yaxuan-w @ssannkkallpp and @rennergade for comments/reviews. |
|
ef5a13c to
58de566
Compare
|
I don't think the thread cases are failing because of any of the address translation changes. They seem to panic because the Interestingly, if I add a random @ssannkkallpp if you've encountered something similar please shed some light! |
|
I believe this is some sort of race condition given that the second test run succeeded for one of the previously failing Looking into the |
| } | ||
|
|
||
| static inline uint64_t | ||
| __lind_translate_uaddr_to_host (const uint64_t uaddr, const uint64_t cageid) |
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.
what is the different between this and the above function translate_ptr_to_host
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.
Takes an addr instead of a pointer. Also since copy_data_between_cages has no way to know which one of src or dest needs to converted, we also need to pass down the cageid info for it.
In essence it does the same thing (__lind_base + input) but only under specific conditions and not for a pointer.
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.
Oh I see that makes sense. Do we have to handle a NULL condition here?
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.
Don't think so, I believe it's handled at a later stage for copy_data, but will run some tests
|
Tests are passing now, my new implementation of However, The current implementation of this function does nothing, and is currently used in a handful of places -
I believe these are unnecessary now that address translations occur in glibc. Should these be removed? (CC: @Yaxuan-w & @rennergade) |
|
Filed a PR to clean up remaining uses #589 |
Yaxuan-w
left a comment
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.
Great job! Could you also add unit test cases for this?
This addresses #581.
Fix works by:
TRANSLATE_UADDR_TO_HOST(uaddr, cageid)macro.check_addrto subtractvmmap.base_addressbefore passing this tocheck_addr_mapping.sc_convert_uaddr_to_host. Currently this function doesnt do anything. This is not required for this fix, can be removed if this is not needed in the long run.My understanding is:
That within glibc, we only have access to
__lind_baseand__lind_cageidfor the current/calling cage. i.e. when a grate callscopy_data_between_cagesit is only capable of converting betweenuaddrandhostfor this specific__lind_cageid. The macro specified above assumes that if the cageid matches the__lind_cageid, it needs to append the base memory, otherwise it can ignore it.If there is a cleaner approach to doing this translation, please let me know.