CVE-2021-47300

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

bpf: Fix tail_call_reachable rejection for interpreter when jit failed

During testing of f263a81451c1 ("bpf: Track subprog poke descriptors correctly
and fix use-after-free") under various failure conditions, for example, when
jit_subprogs() fails and tries to clean up the program to be run under the
interpreter, we ran into the following freeze:

  [...]
  #127/8 tailcall_bpf2bpf_3:FAIL
  [...]
  [   92.041251] BUG: KASAN: slab-out-of-bounds in ___bpf_prog_run+0x1b9d/0x2e20
  [   92.042408] Read of size 8 at addr ffff88800da67f68 by task test_progs/682
  [   92.043707]
  [   92.044030] CPU: 1 PID: 682 Comm: test_progs Tainted: G   O   5.13.0-53301-ge6c08cb33a30-dirty #87
  [   92.045542] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
  [   92.046785] Call Trace:
  [   92.047171]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.047773]  ? __bpf_prog_run_args32+0x8b/0xb0
  [   92.048389]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.049019]  ? ktime_get+0x117/0x130
  [...] // few hundred [similar] lines more
  [   92.659025]  ? ktime_get+0x117/0x130
  [   92.659845]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.660738]  ? __bpf_prog_run_args32+0x8b/0xb0
  [   92.661528]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.662378]  ? print_usage_bug+0x50/0x50
  [   92.663221]  ? print_usage_bug+0x50/0x50
  [   92.664077]  ? bpf_ksym_find+0x9c/0xe0
  [   92.664887]  ? ktime_get+0x117/0x130
  [   92.665624]  ? kernel_text_address+0xf5/0x100
  [   92.666529]  ? __kernel_text_address+0xe/0x30
  [   92.667725]  ? unwind_get_return_address+0x2f/0x50
  [   92.668854]  ? ___bpf_prog_run+0x15d4/0x2e20
  [   92.670185]  ? ktime_get+0x117/0x130
  [   92.671130]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.672020]  ? __bpf_prog_run_args32+0x8b/0xb0
  [   92.672860]  ? __bpf_prog_run_args64+0xc0/0xc0
  [   92.675159]  ? ktime_get+0x117/0x130
  [   92.677074]  ? lock_is_held_type+0xd5/0x130
  [   92.678662]  ? ___bpf_prog_run+0x15d4/0x2e20
  [   92.680046]  ? ktime_get+0x117/0x130
  [   92.681285]  ? __bpf_prog_run32+0x6b/0x90
  [   92.682601]  ? __bpf_prog_run64+0x90/0x90
  [   92.683636]  ? lock_downgrade+0x370/0x370
  [   92.684647]  ? mark_held_locks+0x44/0x90
  [   92.685652]  ? ktime_get+0x117/0x130
  [   92.686752]  ? lockdep_hardirqs_on+0x79/0x100
  [   92.688004]  ? ktime_get+0x117/0x130
  [   92.688573]  ? __cant_migrate+0x2b/0x80
  [   92.689192]  ? bpf_test_run+0x2f4/0x510
  [   92.689869]  ? bpf_test_timer_continue+0x1c0/0x1c0
  [   92.690856]  ? rcu_read_lock_bh_held+0x90/0x90
  [   92.691506]  ? __kasan_slab_alloc+0x61/0x80
  [   92.692128]  ? eth_type_trans+0x128/0x240
  [   92.692737]  ? __build_skb+0x46/0x50
  [   92.693252]  ? bpf_prog_test_run_skb+0x65e/0xc50
  [   92.693954]  ? bpf_prog_test_run_raw_tp+0x2d0/0x2d0
  [   92.694639]  ? __fget_light+0xa1/0x100
  [   92.695162]  ? bpf_prog_inc+0x23/0x30
  [   92.695685]  ? __sys_bpf+0xb40/0x2c80
  [   92.696324]  ? bpf_link_get_from_fd+0x90/0x90
  [   92.697150]  ? mark_held_locks+0x24/0x90
  [   92.698007]  ? lockdep_hardirqs_on_prepare+0x124/0x220
  [   92.699045]  ? finish_task_switch+0xe6/0x370
  [   92.700072]  ? lockdep_hardirqs_on+0x79/0x100
  [   92.701233]  ? finish_task_switch+0x11d/0x370
  [   92.702264]  ? __switch_to+0x2c0/0x740
  [   92.703148]  ? mark_held_locks+0x24/0x90
  [   92.704155]  ? __x64_sys_bpf+0x45/0x50
  [   92.705146]  ? do_syscall_64+0x35/0x80
  [   92.706953]  ? entry_SYSCALL_64_after_hwframe+0x44/0xae
  [...]

Turns out that the program rejection from e411901c0b77 ("bpf: allow for tailcalls
in BPF subprograms for x64 JIT") is buggy since env->prog->aux->tail_call_reachable
is never true. Commit ebf7d1f508a7 ("bpf, x64: rework pro/epilogue and tailcall
handling in JIT") added a tracker into check_max_stack_depth() which propagates
the tail_call_reachable condition throughout the subprograms. This info is then
assigned to the subprogram's 
---truncated---
ProviderTypeBase ScoreAtk. VectorAtk. ComplexityPriv. RequiredVector
NISTNIST
5.5 MEDIUM
LOCAL
LOW
LOW
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
LinuxCNA
---
---
CISA-ADPADP
---
---
CVEADP
---
---
Base Score
CVSS 3.x
EPSS Score
Percentile: 13%
VendorProductVersion
linuxlinux_kernel
5.10 ≤
𝑥
< 5.10.54
linuxlinux_kernel
5.11 ≤
𝑥
< 5.13.6
linuxlinux_kernel
5.14:rc1
linuxlinux_kernel
5.14:rc2
𝑥
= Vulnerable software versions
Debian logo
Debian Releases
Debian Product
Codename
linux
bullseye
5.10.223-1
fixed
buster
not-affected
bullseye (security)
5.10.226-1
fixed
bookworm
6.1.106-3
fixed
bookworm (security)
6.1.112-1
fixed
trixie
6.11.5-1
fixed
sid
6.11.6-1
fixed
Ubuntu logo
Ubuntu Releases
Ubuntu Product
Codename
linux
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
bionic
not-affected
xenial
not-affected
trusty
not-affected
linux-allwinner-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
bionic
not-affected
xenial
not-affected
trusty
not-affected
linux-aws-5.0
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-aws-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-aws-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-aws-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-aws-hwe
noble
dne
mantic
dne
jammy
dne
focal
dne
xenial
not-affected
linux-azure
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
bionic
ignored
xenial
not-affected
trusty
not-affected
linux-azure-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-azure-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-azure-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-azure-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-azure-edge
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-fde
noble
dne
mantic
dne
jammy
not-affected
focal
ignored
linux-azure-fde-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-azure-fde-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-fde-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-bluefield
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-gcp
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
bionic
ignored
xenial
not-affected
linux-gcp-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-gcp-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-gcp-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-gcp-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gcp-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-gcp-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-gcp-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-gcp-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-gke
noble
not-affected
mantic
dne
jammy
not-affected
focal
ignored
linux-gke-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gke-5.15
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gke-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gkeop
noble
dne
mantic
dne
jammy
not-affected
focal
not-affected
linux-gkeop-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-gkeop-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-hwe
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
xenial
not-affected
linux-hwe-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-hwe-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-hwe-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-hwe-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-hwe-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-hwe-edge
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
xenial
ignored
linux-ibm
noble
not-affected
mantic
ignored
jammy
not-affected
focal
not-affected
linux-ibm-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-ibm-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-intel
noble
not-affected
mantic
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-intel-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-intel-iotg
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-intel-iotg-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-iot
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-kvm
noble
dne
mantic
dne
jammy
not-affected
focal
not-affected
bionic
not-affected
xenial
not-affected
linux-laptop
noble
dne
mantic
not-affected
jammy
dne
focal
dne
linux-lowlatency
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
dne
linux-lowlatency-hwe-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-lowlatency-hwe-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-lts-xenial
noble
dne
mantic
dne
jammy
dne
focal
dne
trusty
not-affected
linux-nvidia
noble
not-affected
mantic
dne
jammy
not-affected
focal
dne
linux-nvidia-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-nvidia-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-nvidia-6.8
noble
dne
jammy
not-affected
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-nvidia-lowlatency
noble
not-affected
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-oem
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oem-5.10
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.14
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.17
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-5.6
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-6.0
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-6.1
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-oem-6.8
noble
not-affected
mantic
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-oracle
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
bionic
not-affected
xenial
not-affected
linux-oracle-5.0
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-oracle-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-oracle-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-raspi
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
not-affected
linux-raspi-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-raspi2
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-riscv
noble
not-affected
mantic
not-affected
jammy
ignored
focal
ignored
linux-riscv-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-riscv-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-riscv-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-riscv-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-riscv-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-starfive
noble
dne
mantic
not-affected
jammy
dne
focal
dne
linux-starfive-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-starfive-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-starfive-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-xilinx-zynqmp
noble
dne
mantic
dne
jammy
not-affected
focal
not-affected