-
Notifications
You must be signed in to change notification settings - Fork 19
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
mirage: data race in write buffer handling #29
Comments
There is also a |
The buffer is owned by |
Aha, thanks for digging further into this. It looks like the correct fix is to modify the Mirage bindings to always make a copy in its writev implementation. |
This was fixed in #32 |
When using the "direct" network interface of MirageOS, there is the possibility that the write buffer is overwritten before it is flushed out. For example the following writev sequence from a H2 request (custom debug logging):
Resulted in the following frame being sent out:
As you can see, the last byte sequence written out
00 00 00 00 01 00 00 00 01
shows up not only at the end of the frame, but also in the middle at00000054
although the writev call before sent00 00 31 01 04 00 00 00 01
instead, which means that the same buffer is used twice in one frame, resulting in data being overwritten.If the buffer is copied before
Flow.writev
is called heregluten/mirage/gluten_mirage.ml
Lines 65 to 72 in 7257692
like this:
the issue is gone.
The implementation of
Flow.writev
for TCP in the direct interface implementation is herehttps://github.com/mirage/mirage-tcpip/blob/a7b799cb36435ecb810a92df05ff49fbd264bfbb/src/tcp/flow.ml#L623
The text was updated successfully, but these errors were encountered: