CVE-2024-56786: bpf: put bpf_link's program when link is safe to be deallocated

Published Jan 8, 2025
·
Updated

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

bpf: put bpflink's program when link is safe to be deallocated

In general, BPF link's underlying BPF program should be considered to be reachable through attach hook -> link -> prog chain, and, pessimistically, we have to assume that as long as link's memory is not safe to free, attach hook's code might hold a pointer to BPF program and use it.

As such, it's not (generally) correct to put link's program early before waiting for RCU GPs to go through. More eager bpfprogput() that we currently do is mostly correct due to BPF program's release code doing similar RCU GP waiting, but as will be shown in the following patches, BPF program can be non-sleepable (and, thus, reliant on only "classic" RCU GP), while BPF link's attach hook can have sleepable semantics and needs to be protected by RCU Tasks Trace, and for such cases BPF link has to go through RCU Tasks Trace + "classic" RCU GPs before being deallocated. And so, if we put BPF program early, we might free BPF program before we free BPF link, leading to use-after-free situation.

So, this patch defers bpfprogput() until we are ready to perform bpflink's deallocation. At worst, this delays BPF program freeing by one extra RCU GP, but that seems completely acceptable. Alternatively, we'd need more elaborate ways to determine BPF hook, BPF link, and BPF program lifetimes, and how they relate to each other, which seems like an unnecessary complication.

Note, for most BPF links we still will perform eager bpfprogput() and link dealloc, so for those BPF links there are no observable changes whatsoever. Only BPF links that use deferred dealloc might notice slightly delayed freeing of BPF programs.

Also, to reduce code and logic duplication, extract program put + link dealloc logic into bpflinkdealloc() helper.

Other sources

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

bpf: put bpflink's program when link is safe to be deallocated

The Linux kernel CVE team has assigned CVE-2024-56786 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2025010808-CVE-2024-56786-1f56@gregkh/T

Red Hat

Rejected reason: This CVE ID has been rejected or withdrawn by its CVE Numbering Authority.

NVD

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

Launchpad

Affected Software

10 affected componentsFixes available
Linux Linux kernel<6.6.66
Linux Linux kernel>=6.7<6.12.5
debian/linux<=5.10.223-1, <=5.10.234-1, <=6.1.129-1, <=6.1.135-1
6.12.27-1
Microsoft azl3 kernel 6.6.64.2-9
Microsoft azl3 kernel 6.6.76.1-1
Microsoft cbl2 kernel 5.15.182.1-1
IBM Verify Identity Access<=11.0 - 11.0.2
IBM Security Verify Access<=10.0 - 10.0.9.1
IBM Verify Identity Access Container<=11.0 - 11.0.2
IBM Security Verify Access Container<=10.0 - 10.0.9.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.12.27-1

Event History

Jan 8, 2025
CVE Published
via MITRE·05:52 PM
Rejected
via MITRE·05:52 PM
Data Sourced
via NVD·06:15 PM
Description
Jan 9, 2025
Data Sourced
via Red Hat·12:55 PM
DescriptionSeverityAffected Software
Mar 13, 2025
Data Sourced
via Microsoft·12:00 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·07:00 AM
SeverityAffected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity
Mar 27, 2025
Data Sourced
via Launchpad·06:47 PM
Description
May 2, 2025
Data Sourced
via Ubuntu·06:55 PM
RemedyDescriptionSeverityAffected Software
Jun 19, 2025
Rejected
via MITRE·12:46 PM
Jul 8, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-56786?

The severity of CVE-2024-56786 is classified as a high vulnerability due to potential impacts on the Linux kernel's BPF program management.

2

How do I fix CVE-2024-56786?

To fix CVE-2024-56786, update the Linux kernel to version 6.6.67 or later for versions before 6.12.6.

3

Which versions of Linux Kernel are affected by CVE-2024-56786?

CVE-2024-56786 affects Linux Kernel versions prior to 6.6.67 and between 6.7 and 6.12.5.

4

What components are impacted by CVE-2024-56786?

CVE-2024-56786 impacts the BPF link's program management within the Linux kernel.

5

Is there a workaround for CVE-2024-56786?

Currently, the best approach to mitigate CVE-2024-56786 is to apply the latest updates to the Linux kernel, as no specific workaround is provided.

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