tests: Check for wrong fd delivery with zombie objects

Until recently, if an event attempting to deliver an fd to a zombie
object was demarshalled after the object was made into a zombie, we
leaked the fd and left it in the buffer.

If another event attempting to deliver an fd to a live object was in that
same buffer, the zombie's fd would be delivered instead.

This test recreates that situation.

While this is a ridiculously contrived way to force this race - delivering
an event from a destruction handler - I do have reports of this race
being hit in real world code.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Derek Foreman 2017-12-06 11:22:25 -06:00 committed by Daniel Stone
parent f74c9b98db
commit ff992951a7
2 changed files with 160 additions and 4 deletions

View file

@ -26,7 +26,7 @@
SOFTWARE.
</copyright>
<interface name="fd_passer" version="1">
<interface name="fd_passer" version="2">
<description summary="Sends an event with an fd">
A trivial interface for fd passing tests.
</description>
@ -39,5 +39,14 @@
<description summary="passes a file descriptor"/>
<arg name="fd" type="fd" summary="file descriptor"/>
</event>
<!-- Version 2 additions -->
<request name="conjoin" since="2">
<description summary="register another fd passer with this one">
Tells this fd passer object about another one to send events
to for more complicated fd leak tests.
</description>
<arg name="passer" type="object" interface="fd_passer"/>
</request>
</interface>
</protocol>