<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wintun, branch master</title>
<subtitle>Layer 3 TUN Driver for Windows</subtitle>
<id>https://git.zx2c4.com/wintun/atom/?h=master</id>
<link rel='self' href='https://git.zx2c4.com/wintun/atom/?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/'/>
<updated>2026-03-18T17:49:30Z</updated>
<entry>
<title>driver: fix missed-wakeup race in ring buffer Alertable signaling</title>
<updated>2026-03-18T17:49:30Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon.rozman@amebis.si</email>
</author>
<published>2026-02-24T23:47:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=ec0a6b98456fe1ba52567bb2add4bbf5f64315a1'/>
<id>urn:sha1:ec0a6b98456fe1ba52567bb2add4bbf5f64315a1</id>
<content type='text'>
Add MemoryBarrier() between store-load pairs in the Dekker-style
synchronization used by the Receive ring's Alertable/Tail protocol.

On x86-64, WriteRelease/ReadAcquire only prevent compiler reordering and
provide acquire/release semantics, but do not emit MFENCE — the only
instruction that prevents store-load reordering across cores. Without a
full barrier, both the userspace producer and the kernel consumer can
simultaneously read stale values:

  Userspace: STORE(Tail)  ...  LOAD(Alertable) -&gt; sees FALSE (stale)
  Driver:    STORE(Alertable=TRUE) ... LOAD(Tail) -&gt; sees old tail

The driver then enters KeWaitForMultipleObjects with no pending
SetEvent, sleeping until a TCP retransmission (typically 4-5s later)
re-triggers the send path and wins the race.

The fix adds MemoryBarrier() (MFENCE on x86) on both sides:
- api/session.c WintunSendPacket: between WriteULongRelease(Tail) and
  ReadAcquire(Alertable)
- driver/twintun.c TunProcessReceiveData: between
  WriteRelease(Alertable, TRUE) and ReadULongAcquire(Tail)

This guarantees that at least one side always observes the other's
store, preventing the missed wakeup while preserving the Alertable
optimization that avoids unnecessary SetEvent syscalls.

Reported-by: Alexey Lapuka &lt;alexey@twingate.com&gt;
Reference: https://lists.zx2c4.com/pipermail/wireguard/2026-February/009523.html
Signed-off-by: Simon Rozman &lt;simon.rozman@amebis.si&gt;
</content>
</entry>
<entry>
<title>driver: fix race condition at Ring-&gt;Head</title>
<updated>2026-02-20T13:30:57Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon.rozman@amebis.si</email>
</author>
<published>2026-02-19T19:32:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=dd050927f42081dce7c2ae262be55ffd8210c11a'/>
<id>urn:sha1:dd050927f42081dce7c2ae262be55ffd8210c11a</id>
<content type='text'>
This PR fixes a critical race condition in the Wintun driver that causes
ring buffer overruns when multiple UDP senders operate in parallel. The
issue occurred because multiple threads could read the same Ring-&gt;Head
value without synchronization, leading to concurrent modifications that
corrupted the ring buffer and resulted in ERROR_INVALID_DATA errors.

In order to prevent buffer overrun (which was observed while sending
multiple high throughput UDP streams from different threads) I move the
driver spinlock to protect Ring buffer Head.

I observed that the Ring-&gt;Head was taken and manipulated later on with
just a `ReadULongAcquire` which isn't OK when 2 are trying to manipulate
it later on based on the same received value.

A fix was provided in 4fc590853b8281552631b79dacda484a5782f3bf, but it
didn't solve the issue.

Reported-by: odedkatz &lt;katz.oded@gmail.com&gt;
Reference: https://lists.zx2c4.com/pipermail/wireguard/2026-February/009489.html
Reference: https://lists.zx2c4.com/pipermail/wireguard/2026-February/009510.html
Signed-off-by: Simon Rozman &lt;simon.rozman@amebis.si&gt;
</content>
</entry>
<entry>
<title>driver: explicitly terminate NBL</title>
<updated>2026-02-20T13:10:55Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon.rozman@amebis.si</email>
</author>
<published>2026-02-09T11:13:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=4fc590853b8281552631b79dacda484a5782f3bf'/>
<id>urn:sha1:4fc590853b8281552631b79dacda484a5782f3bf</id>
<content type='text'>
The ActiveNbls list uses MINIPORT_RESERVED[1] as the next pointer, but
never NULL-terminates the tail entry. It was never observed the
allocated NBL would contain a non-zero MiniportReserved array, but this
being unspecified in the official documentation, let's stay out of
"unspecified" area.

Reference: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/nbl/ns-nbl-net_buffer_list
Signed-off-by: Simon Rozman &lt;simon.rozman@amebis.si&gt;
</content>
</entry>
<entry>
<title>driver: introduce NET_BUFFER_LIST_OFFSET helper</title>
<updated>2026-02-09T11:41:08Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon.rozman@amebis.si</email>
</author>
<published>2026-02-09T11:39:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=d36f37582da4c0cc7b3cd49ccc38fe2fc18f17b3'/>
<id>urn:sha1:d36f37582da4c0cc7b3cd49ccc38fe2fc18f17b3</id>
<content type='text'>
Since NET_BUFFER_LIST_MINIPORT_RESERVED[1] is assigned our next NBL
pointer and we have a macro for it (NET_BUFFER_LIST_NEXT_NBL_EX), let's
have a macro for NET_BUFFER_LIST_MINIPORT_RESERVED[0], we assigned NBL
offset and flags to, too.

Signed-off-by: Simon Rozman &lt;simon.rozman@amebis.si&gt;
</content>
</entry>
<entry>
<title>doc: fix WintunReceivePacket name</title>
<updated>2026-02-09T10:24:51Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon.rozman@amebis.si</email>
</author>
<published>2026-02-09T10:24:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=ce4940dce875c5ba93eb410dcd4427bb5e23c1ed'/>
<id>urn:sha1:ce4940dce875c5ba93eb410dcd4427bb5e23c1ed</id>
<content type='text'>
There is no `WintunReceivePackets`. Just `WintunReceivePacket`.

Signed-off-by: Simon Rozman &lt;simon.rozman@amebis.si&gt;
</content>
</entry>
<entry>
<title>api: ignore instance not found when removing instance</title>
<updated>2025-05-21T08:34:59Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon@rozman.si</email>
</author>
<published>2025-05-21T08:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=28627e00f0889f19ecb0abbf013e04bc897ab9f5'/>
<id>urn:sha1:28627e00f0889f19ecb0abbf013e04bc897ab9f5</id>
<content type='text'>
Should SetupAPI report ERROR_PATH_NOT_FOUND on attempt to remove the
adapter instance, the adapter is already gone and we already have what
we wanted.

Reference: https://lists.zx2c4.com/pipermail/wireguard/2025-February/008762.html
Signed-off-by: Simon Rozman &lt;simon@rozman.si&gt;
</content>
</entry>
<entry>
<title>driver: fix spelling mistakes in comments</title>
<updated>2022-05-23T13:57:34Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-05-23T13:57:34Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=41624504341307f7f55afe72e86d5d8c76f81c0e'/>
<id>urn:sha1:41624504341307f7f55afe72e86d5d8c76f81c0e</id>
<content type='text'>
Suggested-by: Dimitri Papadopoulos &lt;dimitri.papadopoulos@cea.fr&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>README: mention Windows 11</title>
<updated>2022-04-22T16:22:47Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon@rozman.si</email>
</author>
<published>2022-04-22T16:22:47Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=87c38c7494d0d185d2f07217730034fd25fdeba2'/>
<id>urn:sha1:87c38c7494d0d185d2f07217730034fd25fdeba2</id>
<content type='text'>
Reported-by: Dimitri Papadopoulos Orfanos &lt;dimitri.papadopoulos@cea.fr&gt;
Signed-off-by: Simon Rozman &lt;simon@rozman.si&gt;
</content>
</entry>
<entry>
<title>api: header: silence MSVC warnings for MSVC only</title>
<updated>2021-12-03T08:17:19Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon@rozman.si</email>
</author>
<published>2021-12-03T08:17:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=c2315570e08f52149c6c3878311aea661b9193ca'/>
<id>urn:sha1:c2315570e08f52149c6c3878311aea661b9193ca</id>
<content type='text'>
MinGW ignores unknown `#pragma warning` lines, but displays a warning
nevertheless.

Signed-off-by: Simon Rozman &lt;simon@rozman.si&gt;
</content>
</entry>
<entry>
<title>proj: stop building for arm32</title>
<updated>2021-10-25T19:47:07Z</updated>
<author>
<name>Simon Rozman</name>
<email>simon@rozman.si</email>
</author>
<published>2021-10-21T09:45:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wintun/commit/?id=6187c95d56d178b7c964bca485881f6f781ce126'/>
<id>urn:sha1:6187c95d56d178b7c964bca485881f6f781ce126</id>
<content type='text'>
This does not remove 32-bit ARM compilation support out of the project
yet.

Shipping of 32-bit ARM drivers became a real challenge:
- Microsoft changed policy to prohibit EV-signed drivers
- Attestation signing is not supported for this platform
- Setting up Windows 8 ARM HCK to get WHQL certification requires a lot
  of effort if doable in 2021 at all.

Signed-off-by: Simon Rozman &lt;simon@rozman.si&gt;
</content>
</entry>
</feed>
