Linux: bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn
What fixes it
- 57cf929a33cb76be3f24886073ae820b4c496914LinuxCVE List
- 7a0855e73757ee9cf25ba635a1c735018ecba742LinuxCVE List
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
In the Linux kernel, the following vulnerability has been resolved:
bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn
The BPF_MOV64_PERCPU_REG insn requires JIT to emit native code to for 'dst_reg = src_reg + <percpu_base_off>'.
However, the interpreter ignores the 'off' at its ALU64_MOV_X label. The 'off' indicates the insn is BPF_MOV64_PERCPU_REG insn. Then, when the interpreter loads memory from the register, it will hit a page fault.
[ 2.545572] BUG: unable to handle page fault for address: ffffffffacaaf034 [ 2.546485] #PF: supervisor read access in kernel mode [ 2.547167] #PF: error_code(0x0000) - not-present page [ 2.547850] PGD 134e63067 P4D 134e63067 PUD 134e64063 PMD 10021c063 PTE 800ffffeca550062 [ 2.548912] Oops: Oops: 0000 [#1] SMP PTI
Set jit_required as true in order to disallow interpreter fallback in core.c::__bpf_prog_select_runtime(), if any BPF_ADDR_PERCPU insn is patched to the prog.
BTW, rename the helper bpf_map_supports_cpu_flags() to bpf_map_is_percpu_map().
Text from CVE List
Affected versions 6
- Linuxaffected: 7bdbf7446305cb65c510c16d57cde82bc76b234a before 57cf929a33cb76be3f24886073ae820b4c496914CVE List
- Linuxaffected: 7bdbf7446305cb65c510c16d57cde82bc76b234a before 7a0855e73757ee9cf25ba635a1c735018ecba742CVE List
- Linuxaffected: 6.10CVE List
- Linuxunaffected: all versions before 6.10CVE List
- Linuxunaffected: 7.2.6 through 7.2.*CVE List
- Linuxunaffected: 7.3CVE List