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. --- console/display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'console/display.c') diff --git a/console/display.c b/console/display.c index c59e74f0..cff99be3 100644 --- a/console/display.c +++ b/console/display.c @@ -513,7 +513,7 @@ display_notice_changes (display_t display, mach_port_t notify) return errno; } - notify_port = ports_get_right (display->notify_port); + notify_port = display->notify_port->pi.port_right; /* Request dead-name notification for the user's port. */ err = mach_port_request_notification (mach_task_self (), notify, @@ -543,7 +543,7 @@ display_notice_filechange (display_t display) error_t err; struct modreq *req = display->filemod_reqs_pending; struct modreq **preq = &display->filemod_reqs; - mach_port_t notify_port = ports_get_right (display->notify_port); + mach_port_t notify_port = display->notify_port->pi.port_right; while (req) { -- cgit v1.2.3