{
   "containers": {
      "cna": {
         "providerMetadata": {
            "orgId": "f4215fc3-5b6b-47ff-a258-f7189bd81038"
         },
         "descriptions": [
            {
               "lang": "en",
               "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix tail_call_reachable rejection for interpreter when jit failed\n\nDuring testing of f263a81451c1 (\"bpf: Track subprog poke descriptors correctly\nand fix use-after-free\") under various failure conditions, for example, when\njit_subprogs() fails and tries to clean up the program to be run under the\ninterpreter, we ran into the following freeze:\n\n  [...]\n  #127/8 tailcall_bpf2bpf_3:FAIL\n  [...]\n  [   92.041251] BUG: KASAN: slab-out-of-bounds in ___bpf_prog_run+0x1b9d/0x2e20\n  [   92.042408] Read of size 8 at addr ffff88800da67f68 by task test_progs/682\n  [   92.043707]\n  [   92.044030] CPU: 1 PID: 682 Comm: test_progs Tainted: G   O   5.13.0-53301-ge6c08cb33a30-dirty #87\n  [   92.045542] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014\n  [   92.046785] Call Trace:\n  [   92.047171]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.047773]  ? __bpf_prog_run_args32+0x8b/0xb0\n  [   92.048389]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.049019]  ? ktime_get+0x117/0x130\n  [...] // few hundred [similar] lines more\n  [   92.659025]  ? ktime_get+0x117/0x130\n  [   92.659845]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.660738]  ? __bpf_prog_run_args32+0x8b/0xb0\n  [   92.661528]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.662378]  ? print_usage_bug+0x50/0x50\n  [   92.663221]  ? print_usage_bug+0x50/0x50\n  [   92.664077]  ? bpf_ksym_find+0x9c/0xe0\n  [   92.664887]  ? ktime_get+0x117/0x130\n  [   92.665624]  ? kernel_text_address+0xf5/0x100\n  [   92.666529]  ? __kernel_text_address+0xe/0x30\n  [   92.667725]  ? unwind_get_return_address+0x2f/0x50\n  [   92.668854]  ? ___bpf_prog_run+0x15d4/0x2e20\n  [   92.670185]  ? ktime_get+0x117/0x130\n  [   92.671130]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.672020]  ? __bpf_prog_run_args32+0x8b/0xb0\n  [   92.672860]  ? __bpf_prog_run_args64+0xc0/0xc0\n  [   92.675159]  ? ktime_get+0x117/0x130\n  [   92.677074]  ? lock_is_held_type+0xd5/0x130\n  [   92.678662]  ? ___bpf_prog_run+0x15d4/0x2e20\n  [   92.680046]  ? ktime_get+0x117/0x130\n  [   92.681285]  ? __bpf_prog_run32+0x6b/0x90\n  [   92.682601]  ? __bpf_prog_run64+0x90/0x90\n  [   92.683636]  ? lock_downgrade+0x370/0x370\n  [   92.684647]  ? mark_held_locks+0x44/0x90\n  [   92.685652]  ? ktime_get+0x117/0x130\n  [   92.686752]  ? lockdep_hardirqs_on+0x79/0x100\n  [   92.688004]  ? ktime_get+0x117/0x130\n  [   92.688573]  ? __cant_migrate+0x2b/0x80\n  [   92.689192]  ? bpf_test_run+0x2f4/0x510\n  [   92.689869]  ? bpf_test_timer_continue+0x1c0/0x1c0\n  [   92.690856]  ? rcu_read_lock_bh_held+0x90/0x90\n  [   92.691506]  ? __kasan_slab_alloc+0x61/0x80\n  [   92.692128]  ? eth_type_trans+0x128/0x240\n  [   92.692737]  ? __build_skb+0x46/0x50\n  [   92.693252]  ? bpf_prog_test_run_skb+0x65e/0xc50\n  [   92.693954]  ? bpf_prog_test_run_raw_tp+0x2d0/0x2d0\n  [   92.694639]  ? __fget_light+0xa1/0x100\n  [   92.695162]  ? bpf_prog_inc+0x23/0x30\n  [   92.695685]  ? __sys_bpf+0xb40/0x2c80\n  [   92.696324]  ? bpf_link_get_from_fd+0x90/0x90\n  [   92.697150]  ? mark_held_locks+0x24/0x90\n  [   92.698007]  ? lockdep_hardirqs_on_prepare+0x124/0x220\n  [   92.699045]  ? finish_task_switch+0xe6/0x370\n  [   92.700072]  ? lockdep_hardirqs_on+0x79/0x100\n  [   92.701233]  ? finish_task_switch+0x11d/0x370\n  [   92.702264]  ? __switch_to+0x2c0/0x740\n  [   92.703148]  ? mark_held_locks+0x24/0x90\n  [   92.704155]  ? __x64_sys_bpf+0x45/0x50\n  [   92.705146]  ? do_syscall_64+0x35/0x80\n  [   92.706953]  ? entry_SYSCALL_64_after_hwframe+0x44/0xae\n  [...]\n\nTurns out that the program rejection from e411901c0b77 (\"bpf: allow for tailcalls\nin BPF subprograms for x64 JIT\") is buggy since env->prog->aux->tail_call_reachable\nis never true. Commit ebf7d1f508a7 (\"bpf, x64: rework pro/epilogue and tailcall\nhandling in JIT\") added a tracker into check_max_stack_depth() which propagates\nthe tail_call_reachable condition throughout the subprograms. This info is then\nassigned to the subprogram's \n---truncated---"
            }
         ],
         "affected": [
            {
               "product": "Linux",
               "vendor": "Linux",
               "defaultStatus": "unaffected",
               "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
               "programFiles": [
                  "kernel/bpf/verifier.c"
               ],
               "versions": [
                  {
                     "version": "e411901c0b77",
                     "lessThan": "39f1735c8107",
                     "status": "affected",
                     "versionType": "git"
                  },
                  {
                     "version": "e411901c0b77",
                     "lessThan": "cbb086074dab",
                     "status": "affected",
                     "versionType": "git"
                  },
                  {
                     "version": "e411901c0b77",
                     "lessThan": "5dd0a6b8582f",
                     "status": "affected",
                     "versionType": "git"
                  }
               ]
            },
            {
               "product": "Linux",
               "vendor": "Linux",
               "defaultStatus": "affected",
               "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
               "programFiles": [
                  "kernel/bpf/verifier.c"
               ],
               "versions": [
                  {
                     "version": "5.10",
                     "status": "affected"
                  },
                  {
                     "version": "0",
                     "lessThan": "5.10",
                     "status": "unaffected",
                     "versionType": "custom"
                  },
                  {
                     "version": "5.10.54",
                     "lessThanOrEqual": "5.10.*",
                     "status": "unaffected",
                     "versionType": "custom"
                  },
                  {
                     "version": "5.13.6",
                     "lessThanOrEqual": "5.13.*",
                     "status": "unaffected",
                     "versionType": "custom"
                  },
                  {
                     "version": "5.14",
                     "lessThanOrEqual": "*",
                     "status": "unaffected",
                     "versionType": "original_commit_for_fix"
                  }
               ]
            }
         ],
         "references": [
            {
               "url": "https://git.kernel.org/stable/c/39f1735c8107ef43a53c4daf82f330d880488d8f"
            },
            {
               "url": "https://git.kernel.org/stable/c/cbb086074dab631ac43f8645cbac1d7b148e05c4"
            },
            {
               "url": "https://git.kernel.org/stable/c/5dd0a6b8582ffbfa88351949d50eccd5b6694ade"
            }
         ],
         "title": "bpf: Fix tail_call_reachable rejection for interpreter when jit failed",
         "x_generator": {
            "engine": "bippy-a5840b7849dd"
         }
      }
   },
   "cveMetadata": {
      "assignerOrgId": "f4215fc3-5b6b-47ff-a258-f7189bd81038",
      "cveID": "CVE-2021-47300",
      "requesterUserId": "gregkh@kernel.org",
      "serial": "1",
      "state": "PUBLISHED"
   },
   "dataType": "CVE_RECORD",
   "dataVersion": "5.0"
}
