Hello,

Damien Zammit, le dim. 10 mars 2024 02:32:48 +0000, a ecrit:
> No, and I'm glad you asked me to.  It seems that there is a bug in 
> mach_msg_server(),
> it does not exit the while(1) loop if the irq->port is deallocated.

Was that really the last reference to the port.

> Is this server supposed to exit?  It would make sense if it did.
> Should it check the refs on the port perhaps and break out of the loop if 
> there are none left?

When there are not refs left, the port is released and the name may be
reused for another port, so it doesn't make sense to test for "none
left". Also, it would make the msg loop much more expensive by making it
do mach_msg+mach_port_get_refs per loop instead of just mach_msg.

The port name should rather be turned into a dead name, by adding a send
ref to the port and deallocating the receive ref. That way the name
stays allocated, and just cannot be used for reception (unless there
is still another receive ref, thus the question above). The caller of
mach_msg_server can then finish the destruction of the port name.

Samuel

Reply via email to