bpf: Fix OOB in pcpu_init_value
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ d3bec0138bfbe58606fc1d6f57a4cdc1a20218db · < 576afddfee8d1108ee299bf10f581593540d1a36| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix OOB in pcpu_init_value
An out-of-bounds read occurs when copying element from a BPF_MAP_TYPE_CGROUP_STORAGE map to another pcpu map with the same value_size that is not rounded up to 8 bytes.
The issue happens when: 1. A CGROUP_STORAGE map is created with value_size not aligned to 8 bytes (e.g., 4 bytes) 2. A pcpu map is created with the same value_size (e.g., 4 bytes) 3. Update element in 2 with data in 1
pcpu_init_value assumes that all sources are rounded up to 8 bytes, and invokes copy_map_value_long to make a data copy, However, the assumption doesn't stand since there are some cases where the source may not be rounded up to 8 bytes, e.g., CGROUP_STORAGE, skb->data. the verifier verifies exactly the size that the source claims, not the size rounded up to 8 bytes by kernel, an OOB happens when the source has only 4 bytes while the copy size(4) is rounded up to 8.
From the CVE record · Linux
The Linux kernel’s BPF pcpu_init_value can read out of bounds when copying a value from a CGROUP_STORAGE map to a per-CPU map with the same value size if that size is not aligned to 8 bytes. The input does not specify whether exploitation requires local access, authentication, or user interaction.
Engineers running the Linux kernel should check their versions; affected versions are not specified in the input.