CVE-2024-47794 bpf: Prevent tailcall infinite loop caused by freplace
A flaw in the Linux kernel BPF subsystem allows a local attacker to cause a kernel panic via an infinite loop triggered by specific tail call and freplace combinations.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-47794?
CVE-2024-47794 is a high-severity denial of service vulnerability in Linux kernel, published on 11 Jan 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
bpf: Prevent tailcall infinite loop caused by freplace
There is a potential infinite loop issue that can occur when using a combination of tail calls and freplace.
In an upcoming selftest, the attach target for entry_freplace of tailcall_freplace.c is subprog_tc of tc_bpf2bpf.c, while the tail call in entry_freplace leads to entry_tc. This results in an infinite loop:
entry_tc -> subprog_tc -> entry_freplace --tailcall-> entry_tc.
The problem arises because the tail_call_cnt in entry_freplace resets to zero each time entry_freplace is executed, causing the tail call mechanism to never terminate, eventually leading to a kernel panic.
To fix this issue, the solution is twofold:
1. Prevent updating a program extended by an freplace program to a prog_array map. 2. Prevent extending a program that is already part of a prog_array map with an freplace program.
This ensures that:
* If a program or its subprogram has been extended by an freplace program, it can no longer be updated to a prog_array map. * If a program has been added to a prog_array map, neither it nor its subprograms can be extended by an freplace program.
Moreover, an extension program should not be tailcalled. As such, return -EINVAL if the program has a type of BPF_PROG_TYPE_EXT when adding it to a prog_array map.
Additionally, fix a minor code style issue by replacing eight spaces with a tab for proper formatting.
Weakness: CWE-835
Which versions are affected by CVE-2024-47794?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2024-47794?
Apply the vendor's patch.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2024-47794 being exploited?
There is no known exploitation of CVE-2024-47794 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as AZL-62711, AZL-67712, BELL-CVE-2024-47794, DEBIAN-CVE-2024-47794, GHSA-qrrc-56f8-gw3j, ROOT-OS-DEBIAN-11-CVE-2024-47794 and 3 more.