CVE-2024-44991: tcp: prevent concurrent execution of tcp_sk_exit_batch

Published Sep 4, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

tcp: prevent concurrent execution of tcpskexitbatch

Its possible that two threads call tcpskexitbatch() concurrently, once from the cleanupnet workqueue, once from a task that failed to clone a new netns. In the latter case, error unwinding calls the exit handlers in reverse order for the 'failed' netns.

tcpskexitbatch() calls tcptwskpurge(). Problem is that since commit b099ce2602d8 ("net: Batch inettwskpurge"), this function picks up twsk in any dying netns, not just the one passed in via exitbatch list.

This means that the error unwind of setupnet() can "steal" and destroy timewait sockets belonging to the exiting netns.

This allows the netns exit worker to proceed to call

WARNONONCE(!refcountdecandtest(&net->ipv4.tcpdeathrow.twrefcount));

without the expected 1 -> 0 transition, which then splats.

At same time, error unwind path that is also running inettwskpurge() will splat as well:

WARNING: .. at lib/refcount.c:31 refcountwarnsaturate+0x1ed/0x210 ... refcountdec include/linux/refcount.h:351 [inline] inettwskkill+0x758/0x9c0 net/ipv4/inettimewaitsock.c:70 inettwskdescheduleput net/ipv4/inettimewaitsock.c:221 inettwskpurge+0x725/0x890 net/ipv4/inettimewaitsock.c:304 tcpskexitbatch+0x1c/0x170 net/ipv4/tcpipv4.c:3522 opsexitlist+0x128/0x180 net/core/netnamespace.c:178 setupnet+0x714/0xb40 net/core/netnamespace.c:375 copynetns+0x2f0/0x670 net/core/netnamespace.c:508 createnewnamespaces+0x3ea/0xb10 kernel/nsproxy.c:110

... because refcountdec() of twrefcount unexpectedly dropped to 0.

This doesn't seem like an actual bug (no tw sockets got lost and I don't see a use-after-free) but as erroneous trigger of debug check.

Add a mutex to force strict ordering: the task that calls tcptwskpurge() blocks other task from doing final decandtest before mutex-owner has removed all tw sockets of dying netns.

Affected Software

11 affected componentsFixes available
Linux Linux kernel>=6.1<6.1.107
Linux Linux kernel>=6.2<6.6.48
Linux Linux kernel>=6.7<6.10.7
Linux Linux kernel=6.11-rc1
Linux Linux kernel=6.11-rc2
Linux Linux kernel=6.11-rc3
Linux Linux kernel=6.11-rc4
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
debian/linux-6.1
6.1.129-1~deb11u1
Microsoft azl3 kernel 6.6.51.1-5
Microsoft azl3 kernel 6.6.47.1-1

Event History

Sep 4, 2024
CVE Published
via MITRE·07:54 PM
Data Sourced
via MITRE·07:54 PM
Description
Data Sourced
via NVD·08:15 PM
RemedyDescriptionSeverityAffected Software
Oct 16, 2024
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity
Jan 13, 2025
Data Sourced
via Ubuntu·06:30 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-44991?

CVE-2024-44991 has a low severity rating as it relates to a concurrency issue in the Linux kernel.

2

How do I fix CVE-2024-44991?

To fix CVE-2024-44991, you should update to a patched version of the Linux kernel, such as 5.10.223-1 or 6.1.123-1.

3

Which Linux kernel versions are affected by CVE-2024-44991?

CVE-2024-44991 affects Linux kernel versions from 6.1 to 6.10, including several release candidates.

4

What does CVE-2024-44991 involve in terms of system behavior?

CVE-2024-44991 involves a vulnerability where two threads can call tcp_sk_exit_batch() concurrently, potentially leading to unstable behavior.

5

Is there any specific recommendation for Linux distribution users regarding CVE-2024-44991?

Linux distribution users should consult their package manager for available kernel updates that address CVE-2024-44991.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203