Skip to content

tun: use 32-bit ioctl reads for vnet header checks (tailscale/tailscale#22649) - #143

Open
TES286 wants to merge 1 commit into
tailscale:tailscalefrom
TES286:tailscale
Open

TES286 wants to merge 1 commit into
tailscale:tailscalefrom
TES286:tailscale

Conversation

@TES286

@TES286 TES286 commented Nov 25, 2026

Copy link
Copy Markdown

checkTUNVnetHeader previously used unix.IoctlGetInt for TUNGETVNETHDRSZ, TUNGETVNETBE, and TUNGETVNETLE. On 64-bit big-endian architectures such as s390x, passing a 64-bit pointer where the kernel writes a 32-bit int causes the value to land in the upper 32 bits (for example, 10 becomes 42949672960), failing the virtio net header size check during TUN creation.

Switch these ioctl calls to unix.IoctlGetUint32 so a 32-bit value is read consistently across endiannesses.

Fixes tailscale/tailscale#22649

…le#22649)

checkTUNVnetHeader previously used unix.IoctlGetInt for TUNGETVNETHDRSZ,
TUNGETVNETBE, and TUNGETVNETLE. On 64-bit big-endian architectures such
as s390x, passing a 64-bit pointer where the kernel writes a 32-bit int
causes the value to land in the upper 32 bits (for example, 10 becomes
42949672960), failing the virtio net header size check during TUN
creation.

Switch these ioctl calls to unix.IoctlGetUint32 so a 32-bit value is
read consistently across endiannesses.

Fixes tailscale/tailscale#22649
Signed-off-by: TES286 <tes286@tes286.top>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CreateTUN fails on s390x with "incompatible virtio net header size 42949672960, want 10"

1 participant