The attached patch[1] fixes a problem where a recipient may get the thread ID of a propagating thread rather than the propagator's VirtualSender TCR.
This misbehaviour was observed when the propagator and the recipient were in one address space and the original sender was in another, and the propagator went through a blocking send phase to deliver the message. The issue was that at the end of the last function in kernel/src/api/v4/ipc.cc, from_tcb->get_global_id() was used interchangeably with current->get_partner() when in the propagating case they almost certainly refer to distinct threads. As for why this was only observed in a blocking-send case and not in the non-blocking case, I have no idea. I only drilled down from the return value observed by the recipient, and correcting it seemed the right thing to do. The changeset also enforces, using an ASSERT(), the notion that the virtual sender in IPC propagation is always identified by global TID. This is supported by lines 313-329 in kernel/src/api/v4/ipc.cc, which silently disables[2] propagation if VirtualSender is not a global TID (as a local TID cannot be equal to the result of get_global_id() of the virtual sender's tcb_t). As requiring that the VirtualSender TCR always contain a global TID when propagation is specified in the message tag, I'd like to recommend that the L4.X2 spec be revised accordingly. If it matters for a short patch like this, the attached changeset is licensed under the two-clause BSD license as given at the start of the source file it modifies. [1] hg bundle -- I hope this is the correct format [2] IMO, silently disabling propagation is the wrong thing to do as it tells the sender that the IPC operation succeeded as specified when it did not. This behaviour also diverges from that of Pistachio 0.4 . -- Kalle A. Sandstro"m ksand...@iki.fi 746B 4B14: BFB5 6D3B 0758 CFBE 11F9 DF41 4C28 67FB 746B 4B14 void *truth = &truth; http://ksandstr.iki.fi/
pistachio-propagate-partner-properly.hg
Description: Binary data