[PATCH] wg-quick: darwin: fix set_dns() and del_dns() race

Dmitry Ilvokhin d at ilvokhin.com
Wed Oct 7 10:21:42 UTC 2026


On Wed, Sep 30, 2026 at 10:30:41AM +0000, Dmitry Ilvokhin wrote:
> The monitor deamon restores the DNS servers by running del_dns() from
> its INT, TERM and EXIT trap. Every route event also schedules an ALRM 2
> seconds later, and the ALRM trap runs set_dns().
> 
> If ALRM arrives during cleanup, set_dns() can run in the middle of
> del_dns(), and the DNS servers may not be restored after the WireGuard
> interface is removed.
> 
> Ignore ALRM in cleanup signal handler to avoid this race.
> 
> Signed-off-by: Dmitry Ilvokhin <d at ilvokhin.com>
> ---
> Resending the patch, since mailing list didn't accept it first time,
> because I was not a member of the list.

Hello Jason,

Any thoughts on the patch?

I applied this patch locally, tested it for a few weeks and never hit
the race again. I'd love to get the fix upstream.


More information about the WireGuard mailing list