freenode
Kernel & Low-Level

Kernel drops PSP and kTLS offload packets that would leave cleartext

IPv6 extension headers, IPv4 fragments, and ICMP error quotes could bypass hardware encryption intent on the transmit path.

Linux networking is closing several holes where PSP and kernel TLS (kTLS) hardware-offloaded traffic could leave the host in cleartext, despite an association that means the stack intends encryption.

Todd Freed of Meta found the gaps while extending PSP. On affected paths the stack either built a malformed offload packet or stripped the decrypted mark that tells the device to encrypt, so the NIC could emit plaintext. The fixes drop those packets instead of sending them unprotected.

One case is IPv6 packets with extension headers on the Mellanox mlx5 PSP transmit path. Encapsulation rewrites only the fixed header and can leave a malformed packet that the hardware sends unencrypted. Socket options or routing can introduce those headers, so the driver now rejects them when TCP does not sit directly after the fixed header.

Another is IPv4 fragmentation of already-decrypted skbs. Non-initial fragments lack the L4 header offload needs, and fragmentation cleared the decrypted mark, so later fragments could go out in the clear. The stack now refuses to fragment decrypted packets; TCP rarely hits this, but route MTU tricks and IP_PMTUDISC_OMIT can force it for IPv4. IPv6 TCP does not fragment this way.

ICMP and ICMPv6 errors were also a leak: they quote part of the invoking packet, and a device-decrypted packet would put recovered bytes back on the wire. For kTLS RX offload the quote is trimmed to headers that were already clear on the wire. For PSP, which also covers the L4 header, the error is not sent, because a header-only quote is useless to Linux receivers and would still expose intent. Locally originated transmit errors still go out in full when destined locally.

A separate mlx5 fix corrects TSO TCP checksum seeding for PSP when the L3 destination is an intermediate hop (for example IPv4 source routing), which had produced bad checksums on every segment. Selftests cover extension-header drops and forced IPv4 fragmentation so cleartext fragments no longer reach the peer.

Jakub Kicinski and Björn Töpel suggested directions on the error-quote handling. The changes matter anywhere PSP or kTLS device offload is relied on for confidentiality: without them, unusual headers, fragmentation, or error replies could silently defeat the offload contract.