From 7360a092712ad01c5803901df5ca6e0edef4150f Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Wed, 26 May 2021 15:36:28 +0300 Subject: Do not use ports_get_right () for send-one rights ports_get_right () expects the caller to make a send, not a send-once, right from the returned receive right, and increments the expected make-send count accordingly. The kernel, however, does not increment the make-send count when a send-once right is being made. The result can be described as a "no-senders leak": libports' idea of the current make-send count always stays one step ahead of it actual value (or several steps ahead, if the process is repeated), which makes libports ignore *all* the subsequent no-senders notifications for the port as outdated. --- eth-multiplexer/device_impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'eth-multiplexer/device_impl.c') diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c index a6e6f59c..74f78f22 100644 --- a/eth-multiplexer/device_impl.c +++ b/eth-multiplexer/device_impl.c @@ -189,7 +189,7 @@ ds_device_set_filter (struct vether_device *vdev, mach_port_t receive_port, return D_NO_SUCH_DEVICE; err = mach_port_request_notification (mach_task_self (), receive_port, MACH_NOTIFY_DEAD_NAME, 0, - ports_get_right (notify_pi), + notify_pi->port_right, MACH_MSG_TYPE_MAKE_SEND_ONCE, &tmp); if (err != KERN_SUCCESS) goto out; -- cgit v1.2.3