Adding event mask validation for ModifyWaitEvent - Mailing list pgsql-hackers

From Josh Kupershmidt
Subject Adding event mask validation for ModifyWaitEvent
Date
Msg-id CAK3UJREEiWR4W_8j=5oGn8d6yvu-2xBKSSPcEHg2giWUHrnSeQ@mail.gmail.com
Whole thread
List pgsql-hackers
Hi,

Please find attached a patch implementing an old FIXME comment [1] about validating the event mask in ModifyWaitEvent(). To prevent callers of ModifyWaitEvent() from passing invalid flags that can be silently accepted, I propose adding two checks:

 1. Prevent setting socket wait flags on an event that has no socket, mirroring line 600 of AddWaitEventToSet() [2].

 2. Prevent promoting a non-latch event to a latch event through ModifyWaitEvent(). The setup for latch events is handled in AddWaitEventToSet(), but not supported in ModifyWaitEvent(). For example, AddWaitEventToSet() enforces "cannot wait on more than one latch" [3] per set, registering the latch pointer [4], and handles platform-specific latch behavior [5]. We do still allow the behavior documented in the comment for ModifyWaitEvent() [6] about setting a latch to NULL to disable it, and enabling again as a latch later.


Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: PG 19 release notes and authors
Next
From: Thomas Munro
Date:
Subject: Re: Automatically sizing the IO worker pool