You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you store the pointer from the golang buffer in a struct that is passed to io_uring systerm calls which will access the data buffer long after the push_write_request function returns.
while this may work in some cases where the gc doesnt run till the file is written to, it is very possible that the gc runs after this call to push_write_request and relocates the data buffer to a whole different address. in fact for the zeroBytes buffer case
Good catch there, and thanks for reading through the code!
I wrote this mainly as a POC, and just to understand io_uring better. So there may definitely be bugs like this. I am not sure what the fix here would be though since io_uring is asynchronous by design.
the only correct way would be to copy the contents of 'data' into a new C allocated buffer. the copying of course would lessen the benefits of using io_uring in the first place, which is why it's difficult to implement in garbage collected languages
The golang doc says
however in this line
frodo/frodo.c
Line 105 in 55a39bb
push_write_request
function returns.while this may work in some cases where the gc doesnt run till the file is written to, it is very possible that the gc runs after this call to
push_write_request
and relocates thedata
buffer to a whole different address. in fact for thezeroBytes
buffer casefrodo/frodo.go
Line 173 in 55a39bb
push_write_request
callThe text was updated successfully, but these errors were encountered: