tcp: tcp_rtx_synack() can be called from process context
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef · < 88cd232146207ff1d41dededed5e77c0d4438113| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
tcp: tcp_rtx_synack() can be called from process context
Laurent reported the enclosed report [1]
This bug triggers with following coditions:
0) Kernel built with CONFIG_DEBUG_PREEMPT=y
1) A new passive FastOpen TCP socket is created. This FO socket waits for an ACK coming from client to be a complete ESTABLISHED one. 2) A socket operation on this socket goes through lock_sock() release_sock() dance. 3) While the socket is owned by the user in step 2), a retransmit of the SYN is received and stored in socket backlog. 4) At release_sock() time, the socket backlog is processed while in process context. 5) A SYNACK packet is cooked in response of the SYN retransmit. 6) -> tcp_rtx_synack() is called in process context.
Before blamed commit, tcp_rtx_synack() was always called from BH handler, from a timer handler.
Fix this by using TCP_INC_STATS() & NET_INC_STATS() which do not assume caller is in non preemptible context.
From the CVE record · Linux
The Linux kernel’s TCP SYN-ACK retransmission code can trigger a preemption debug warning when the kernel is built with CONFIG_DEBUG_PREEMPT=y. This can occur when a client retransmits a SYN to a passive TCP Fast Open socket while a socket operation holds the socket lock; the retransmission is then processed when the lock is released. The report does not specify authentication requirements or additional user interaction.
Engineers running Linux kernels built with CONFIG_DEBUG_PREEMPT=y and using passive TCP Fast Open sockets should check their kernel vendor’s advisory for affected versions.