This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix RPC interface when sending and recieving aribtrary packets
ClosedPublic

Authored by jhuber6 on May 10 2023, 4:19 PM.

Details

Summary

The interface exported by the RPC library allows users to simply send
and recieve fixed sized packets without worrying about the data motion
underneath. However, this was broken in the current implementation. We
can think of the send and recieve implementations in terms of waiting
for ownership of the buffer, using the buffer, and posting ownership to
the other side. Our implementation of recv was incorrect in the
following scenarios.

recv -> send we still own the buffer and should give away ownership
recv -> close
The other side is not waiting for data, this will

result in multiple openings of the same port

This patch attempts to fix this with an admittedly hacky fix where we
track if the previous implementation was a recv and post conditionally.

Diff Detail

Event Timeline

jhuber6 created this revision.May 10 2023, 4:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 10 2023, 4:19 PM
jhuber6 requested review of this revision.May 10 2023, 4:19 PM
JonChesterfield accepted this revision.May 10 2023, 4:27 PM

s/recieve/receive/g but otherwise looks reasonable. Seems a good sign that send and recv now do different things, and I'm glad that you've changed the behaviour without modifying process (as that means I don't have to try to think through the concurrency behaviour)

This revision is now accepted and ready to land.May 10 2023, 4:27 PM