CVE-2022-49764

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-49764
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49764.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49764
Downstream
Published
2025-05-01T14:09:04.252Z
Modified
2025-11-28T02:34:24.287449Z
Summary
bpf: Prevent bpf program recursion for raw tracepoint probes
Details

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

bpf: Prevent bpf program recursion for raw tracepoint probes

We got report from sysbot [1] about warnings that were caused by bpf program attached to contentionbegin raw tracepoint triggering the same tracepoint by using bpftraceprintk helper that takes traceprintk_lock lock.

Call Trace: <TASK> ? traceeventraweventbpftraceprintk+0x5f/0x90 bpftraceprintk+0x2b/0xe0 bpfproga9aec6167c091eefprog+0x1f/0x24 bpftracerun2+0x26/0x90 nativequeuedspinlockslowpath+0x1c6/0x2b0 _rawspinlockirqsave+0x44/0x50 bpftraceprintk+0x3f/0xe0 bpfproga9aec6167c091eefprog+0x1f/0x24 bpftracerun2+0x26/0x90 nativequeuedspinlockslowpath+0x1c6/0x2b0 _rawspinlockirqsave+0x44/0x50 bpftraceprintk+0x3f/0xe0 bpfproga9aec6167c091eefprog+0x1f/0x24 bpftracerun2+0x26/0x90 nativequeuedspinlockslowpath+0x1c6/0x2b0 _rawspinlockirqsave+0x44/0x50 bpftraceprintk+0x3f/0xe0 bpfproga9aec6167c091eefprog+0x1f/0x24 bpftracerun2+0x26/0x90 nativequeuedspinlockslowpath+0x1c6/0x2b0 _rawspinlockirqsave+0x44/0x50 _unfreezepartials+0x5b/0x160 ...

The can be reproduced by attaching bpf program as raw tracepoint on contentionbegin tracepoint. The bpf prog calls bpftraceprintk helper. Then by running perf bench the spin lock code is forced to take slow path and call contentionbegin tracepoint.

Fixing this by skipping execution of the bpf program if it's already running, Using bpf prog 'active' field, which is being currently used by trampoline programs for the same reason.

Moving bpfprogincmissescounter to syscall.c because trampoline.c is compiled in just for CONFIGBPFJIT option.

[1] https://lore.kernel.org/bpf/YxhFe3EwqchC%2FfYf@krava/T/#t

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49764.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
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Fixed
2e5399879024fedd6cdc41f73fbf9bbe7208f899
Fixed
05b24ff9b2cfabfcfd951daaa915a036ab53c9e1

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.0.10