CVE-2024-58060: bpf: Reject struct_ops registration that uses module ptr and the module btf_id is missing
In the Linux kernel, the following vulnerability has been resolved:
bpf: Reject structops registration that uses module ptr and the module btfid is missing
There is a UAF report in the bpfstructops when CONFIGMODULES=n. In particular, the report is on tcpcongestionops that has a "struct module owner" member.
For structops that has a "struct module owner" member, it can be extended either by the regular kernel module or by the bpfstructops. bpftrymoduleget() will be used to do the refcounting and different refcount is done based on the owner pointer. When CONFIGMODULES=n, the btfid of the "struct module" is missing:
WARN: resolvebtfids: unresolved symbol module
Thus, the bpftrymoduleget() cannot do the correct refcounting.
Not all subsystem's structops requires the "struct module owner" member. e.g. the recent schedextops.
This patch is to disable bpfstructops registration if the structops has the "struct module " member and the "struct module" btfid is missing. The btftypeisfwd() helper is moved to the btf.h header file for this test.
This has happened since the beginning of bpfstructops which has gone through many changes. The Fixes tag is set to a recent commit that this patch can apply cleanly. Considering CONFIGMODULES=n is not common and the age of the issue, targeting for bpf-next also.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2024-58060?
CVE-2024-58060 has been categorized based on its potential impact on system integrity and availability.
How do I fix CVE-2024-58060?
To resolve CVE-2024-58060, ensure your Linux kernel is updated to the latest version that includes the patch for this vulnerability.
What systems are affected by CVE-2024-58060?
CVE-2024-58060 affects systems running the Linux kernel where CONFIG_MODULES is not enabled.
What type of vulnerability is CVE-2024-58060?
CVE-2024-58060 is classified as a use-after-free (UAF) vulnerability found in the bpf_struct_ops.
Is CVE-2024-58060 a remote exploit vulnerability?
CVE-2024-58060 requires local access to exploit, as it involves operations within the Linux kernel.