Skip to content
Heist/ feed
High

bpf, x86: fix freeing of not-finalized bpf_prog_pack

Type: advisorySource: Official CVE List1 source record

In the Linux kernel, the following vulnerability has been resolved: bpf, x86: fix freeing of not-finalized bpf_prog_pack syzbot reported a few issues with bpf_prog_pack [1], [2]. This only happens with multiple subprogs. In jit_subprogs(), we first call bpf_int_jit_compile() on each sub program. And then, we call it on each sub program again. jit_data is not freed in the first call of bpf_int_jit_compile(). Similarly we don't call bpf_jit_binary_pack_finalize() in the first call of bpf_int_jit_compile(). If bpf_int_jit_compile() failed for one sub program, we will call bpf_jit_binary_pack_finalize() for this sub program. However, we don't have a chance to call it for other sub programs. Then we will hit "goto out_free" in jit_subprogs(), and call bpf_jit_free on some subprograms that haven't got bpf_jit_binary_pack_finalize() yet. At this point, bpf_jit_binary_pack_free() is called and the whole 2MB page is freed erroneously. Fix this with a custom bpf_jit_free() for x86_64, which calls bpf_jit_binary_pack_finalize() if necessary. Also, with custom bpf_jit_free(), bpf_prog_aux->use_bpf_prog_pack is not needed any more, remove it. [1] https://syzkaller.appspot.com/bug?extid=2f649ec6d2eea1495a8f [2] https://syzkaller.appspot.com/bug?extid=87f65c75f4a72db05445

Announced Source revision 1
Original source ↗

CVE-2022-50168

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: cve:CVE-2022-50168

Linux

Source reference: /containers/cna/affected/0/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Linux

Source reference: /containers/cna/affected/1/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "1022a5498f6f745c3b5fd3f050a5e11e7ca354f0",
        "lessThan": "f91ce608a79c0db3e72bd63c23e011a9ebc31505",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "1022a5498f6f745c3b5fd3f050a5e11e7ca354f0",
        "lessThan": "60e66074812dde9cde3d99cdd3caa9e40f1a4516",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "1022a5498f6f745c3b5fd3f050a5e11e7ca354f0",
        "lessThan": "1d5f82d9dd477d5c66e0214a68c3e4f308eadd6d",
        "versionType": "git"
      }
    ],
    "programFiles": [
      "arch/x86/net/bpf_jit_comp.c",
      "include/linux/bpf.h",
      "include/linux/filter.h",
      "kernel/bpf/core.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "5.18"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "5.18",
        "versionType": "semver"
      },
      {
        "status": "unaffected",
        "version": "5.18.18",
        "versionType": "semver",
        "lessThanOrEqual": "5.18.*"
      },
      {
        "status": "unaffected",
        "version": "5.19.2",
        "versionType": "semver",
        "lessThanOrEqual": "5.19.*"
      },
      {
        "status": "unaffected",
        "version": "6.0",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "arch/x86/net/bpf_jit_comp.c",
      "include/linux/bpf.h",
      "include/linux/filter.h",
      "kernel/bpf/core.c"
    ],
    "defaultStatus": "affected"
  }
]
Related CVEs
CVE-2022-50168

Source reference: /cveMetadata/cveId

Publisher severity

high

Source reference: /containers/cna/metrics

Event
#30203 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement