aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-05-26 15:36:28 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-10 22:11:38 +0200
commit7360a092712ad01c5803901df5ca6e0edef4150f (patch)
treebb0b78b99b867a239bf8e53dac74d3cae4ee41df
parent9393fb33d0405cfb99449241139413f0aae6f4f0 (diff)
downloadhurd-7360a092712ad01c5803901df5ca6e0edef4150f.tar.gz
hurd-7360a092712ad01c5803901df5ca6e0edef4150f.tar.bz2
hurd-7360a092712ad01c5803901df5ca6e0edef4150f.zip
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.
-rw-r--r--console/display.c4
-rw-r--r--eth-multiplexer/device_impl.c2
2 files changed, 3 insertions, 3 deletions
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)
{
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;