kernel: msg: async messages no longer hold a pointer to the thread/port that sent them

this prevents a race condition where an event is sent as a port is being destroyed.
when the server gets around to handling the event, it now refers to a different port
that was created in the mean-time.
This commit is contained in:
2026-03-25 20:19:19 +00:00
parent a0a6a061a4
commit 95d33ddcb9
3 changed files with 22 additions and 9 deletions
+14 -2
View File
@@ -21,8 +21,20 @@ struct msg {
enum kmsg_status msg_status;
struct btree_node msg_node;
msgid_t msg_id;
struct port *msg_sender_port;
struct thread *msg_sender_thread;
union {
/* only valid for asynchronous messages (msg_status ==
* KMSG_ASYNC) */
struct {
koid_t msg_sender_port_id;
tid_t msg_sender_thread_id;
};
/* only valid for synchronous messages (msg_status !=
* KMSG_ASYNC) */
struct {
struct port *msg_sender_port;
struct thread *msg_sender_thread;
};
};
kern_status_t msg_result;
kern_msg_type_t msg_type;