Fix address translation for copy_data_between_cages#582
Fix address translation for copy_data_between_cages#582rennergade merged 8 commits intoLind-Project:mainfrom
copy_data_between_cages#582Conversation
|
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.
what is the different between this and the above function translate_ptr_to_host
There was a problem hiding this comment.
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.
Oh I see that makes sense. Do we have to handle a NULL condition here?
There was a problem hiding this comment.
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.
Great job! Could you also add unit test cases for this?
rennergade
left a comment
There was a problem hiding this comment.
Ok looks good. Approved.
* Fix: copy_data_between_cages address translations * Lint fix: improper blank line * Do not convert NULL in sc_convert_uaddr_to_host() * Add comments for cage/memory and glibc address conversions * Panic instead of a silent error * Fix lint error. * Fix lint error. * Final linting fix
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.