CVE-2024-36937

Source
https://cve.org/CVERecord?id=CVE-2024-36937
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-36937.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-36937
Downstream
Related
Published
2024-05-30T15:29:26.353Z
Modified
2026-03-13T07:55:39.935563Z
Summary
xdp: use flags field to disambiguate broadcast redirect
Details

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

xdp: use flags field to disambiguate broadcast redirect

When redirecting a packet using XDP, the bpfredirectmap() helper will set up the redirect destination information in struct bpfredirectinfo (using the _bpfxdpredirectmap() helper function), and the xdpdoredirect() function will read this information after the XDP program returns and pass the frame on to the right redirect destination.

When using the BPFFBROADCAST flag to do multicast redirect to a whole map, __bpfxdpredirectmap() sets the 'map' pointer in struct bpfredirectinfo to point to the destination map to be broadcast. And xdpdoredirect() reacts to the value of this map pointer to decide whether it's dealing with a broadcast or a single-value redirect. However, if the destination map is being destroyed before xdpdoredirect() is called, the map pointer will be cleared out (by bpfclearredirectmap()) without waiting for any XDP programs to stop running. This causes xdpdoredirect() to think that the redirect was to a single target, but the target pointer is also NULL (since broadcast redirects don't have a single target), so this causes a crash when a NULL pointer is passed to devmapenqueue().

To fix this, change xdpdoredirect() to react directly to the presence of the BPFFBROADCAST flag in the 'flags' value in struct bpfredirectinfo to disambiguate between a single-target and a broadcast redirect. And only read the 'map' pointer if the broadcast flag is set, aborting if that has been cleared out in the meantime. This prevents the crash, while keeping the atomic (cmpxchg-based) clearing of the map pointer itself, and without adding any more checks in the non-broadcast fast path.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/36xxx/CVE-2024-36937.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
e624d4ed4aa8cc3c69d1359b0aaea539203ed266
Fixed
12481f30128fbebc2eeb55eb2d56390fdfa30c5e
Fixed
272bfb019f3cc018f654b992115774e77b4f3ffc
Fixed
e22e25820fa04ea5eaac4ef7ee200e9923f466a4
Fixed
6fd81f9d333e7b3532036577b1beb74ba1323553
Fixed
5bcf0dcbf9066348058b88a510c57f70f384c92c

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-36937.json"