Linux kernel teardown race in stream parser receive handling
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e27cca96cd68fa2c6814c90f9a1cfd36bb68c593 · < d2b5f637b9b67a79a50d42614d10653c13b4e449| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
strparser: make sure __strp_recv isn't running before tearing down the parser
The comment above strp_done() claims that if strp is stopped, strp_recv will no longer be called. That's only true if the caller has a mechanism (eg locking) to guarantee that strp_recv() calls that started before strp_stop() have completed by the time we call strp_done().
This adds a dummy lock_sock/release_sock pair to guarantee that any in-flight strp_recv() (which runs under either bh_lock_sock or lock_sock, depending if it's called from ->sk_data_ready or strp_work) has completed.
Only espintcp can be affected by this race condition, but this patch makes sure no future user of strp can have the bug.
This could crash on strp->sk ("general mode" of strp), but this mode has been here for 9 years and has never been used. It'll be gone soon, no point worrying about it.
Switch the stopped/paused/etc bits to u8's to avoid races between strp_stop() and strp_pause/unpause().
A reproducer has been published and turns the possible UAF into an exploit [1].
From the CVE record · Linux
A race in the Linux kernel’s strparser can allow an in-flight receive operation to continue while the parser is being torn down. The affected user is espintcp; a published reproducer turns the possible use-after-free into an exploit. The input does not specify attacker access or user-interaction requirements.
Engineers running Linux kernels with espintcp should check whether their kernel includes the fix; affected versions are not specified.